0

I often surf arXiv for new articles to read. I usually benefit doubly from this endeavour: secondly to mathematical knowledge I like to learn different LaTeX techniques which are used to typeset beautiful documents. But recently I got a hold of rather peculiar .tex file. Its origins derive from a brilliant article regarding algebraic topology which can be found here.

The whole file is way too large to be rawly posted in my comment, so I included it in my Google Drive. However I can express two of my remarks:

It seems strange to me that multiple .sty files were packed in a single .tex file, as recognised via Google Drive analysis; more accurately, it seems that 8 individual files (1 .aux, 1 .bbl, 3 .sty and 3 .tex) are somehow compressed in one .tex file. Strange.

I decided to post the beginning of the "big" .tex document for further clarity and to make the situation simpler for the community:

                              \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{Cobordism}[2011/03/01]

\RequirePackage{tikz}

\usepackage{forarray}

\newcommand\ignore[1]{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Variables, Variable Commands, and Styles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% Variables %%%
\newlength{\cobordismhalfendwidth}
\newlength{\cobordismhalfendheight}
\newlength{\cobordismendwidth}

%%% New Variables %%%
\newlength{\cobheight}      % Height of a pair of pants
\newlength{\cobwidth}       % Width of a cylinder
\newlength{\cobgap}         % Gap between adjacent cylinders
\newlength{\cupheight}      % Height of a cup or cap
\newlength{\ellipseheight}  % Height of a boundary ellipse
\newcommand{\ellipsewidth}{\cobwidth}
\newlength{\cobordismlinewidth} % Width of line used to draw cobordisms
\newlength{\coboffset}      % cobwidth + cobgap; the horizontal offset between adjacent cylinders
\newlength{\obscurewidth}
\setlength{\obscurewidth}{4pt}
\newlength{\inseamheight}
\newlength{\selectwidth}
\setlength{\selectwidth}{1pt}
\newlength{\dashlength}
\setlength{\dashlength}{2pt}

Those of you who want to help me with my struggle can find the full file here.

The ones who took their time and opened my uploaded .tex file will probably understand the source of my confusion. My primary request is to clarify the syntax to me as much as possible. And a bonus: how can I achieve the beautiful results presented in the paper with the normal format? Thank you in advance. (Please don't mark this as off-topic; it's just a complex question.)

God bless
  • 1,767
  • 5
    Is there something in particular you want clarified or the entire thing? I personally don't want to go through thousands of lines of code for that. – Sean Roberson Jul 27 '17 at 19:17
  • 3
    I don't know if it is off-topic, but I don't like questions very much where all relevant information is behind some links. Imho you should make an effort to add at least some example/screenshot here – Ulrike Fischer Jul 27 '17 at 19:17
  • @UlrikeFischer I was thinking about adding the first portion of the .tex file. Of course, you can download a copy from my Google Drive for yourself (I've provided a link) and see the situation in the upmost clarity. Edit incoming soon. – God bless Jul 27 '17 at 19:20
  • 1
    (The source can be downloaded from arXiv as well, so not really much need for you posting it to Google Drive.) As it stands though, I'd say your question is either unclear or too broad, or both. There are 8000 lines of code in the paper, so you cannot be expecting a clarification of all of it. Are you referring to the diagrams? – Torbjørn T. Jul 27 '17 at 19:27
  • @TorbjørnT. No, I am referring to the structure of the .tex file as well. When you add ".tex" to the name of the source name (1509.06811) you can edit it with your TeX - LaTeX editor of choice (or even with Notepad++). If you are interested in helping me out, please follow the procedure mentioned above. – God bless Jul 27 '17 at 19:31
  • @TorbjørnT. To add, I'd mostly like to know why some of .sty and .bbl files are so strangely "morphed" with .tex packages. If you can shine any light onto as to why such a structure even exist, I'd be very grateful. – God bless Jul 27 '17 at 19:33
  • 2
    "Delivered as a gzipped tar (.tar.gz) file if there are multiple files," It's not a single text file, it's a zipped file. If you unpack it, instead of renaming, you'll see that it's actually 8 files. – Torbjørn T. Jul 27 '17 at 19:35
  • @TorbjørnT. Yes, I was suspecting that I did something wrong (check out my edit). I still don't understand why there are *3* .tex files though? What am I supposed to do with those? – God bless Jul 27 '17 at 19:39
  • 1
    Keep them in the folder. Note in line 8 and 9 of paperIV.tex that the two other .tex files are input here. It's just a way of making the source of the main .tex file more tidy, by placing (most of) the preamble in separate files. – Torbjørn T. Jul 27 '17 at 19:42
  • @TorbjørnT. Thanks, this clarifies things up a little bit. I know I must move .sty files somewhere where PDFLaTeX can reach them and compile my commands. But where? And furthermore, how do I compile 3 .tex files at once? – God bless Jul 27 '17 at 19:44
  • 2
    You don't compile three .tex at once, you just compile paperIV.tex. That file reads the two other ones. And you don't need to move the .sty files either, if they are placed in the same folder as paperIV.tex, LaTeX will find them. – Torbjørn T. Jul 27 '17 at 19:46
  • @TorbjørnT. Thanks a lot man! It's a shame that you didn't post this as an answer. You would indeed get my tick and an upvote... – God bless Jul 27 '17 at 19:49
  • 2
    Well, to answer a question you first need to understand the problem ... I can summarize my comments in an answer later. – Torbjørn T. Jul 27 '17 at 19:51
  • @TorbjørnT. That would be great! Keep up the good work! – God bless Jul 27 '17 at 19:52
  • @TorbjørnT. Um, another question. I tried compiling paperIV.tex. All was well (you know, the standard stuff; editor automatically installs requested packages etc.) until this error showed up: Cobordism.sty error line 4118 undefined control sequence. I suspect that the .sty file has some kind of fallacy in it (is not written correctly). Your thoughts? – God bless Jul 27 '17 at 20:16
  • Not much. Possibly written for an older version of TikZ, but I'd suggest asking a new question about that, I don't really know. – Torbjørn T. Jul 27 '17 at 20:22
  • @TorbjørnT. Did the .tex file compile for you though? – God bless Jul 27 '17 at 20:23
  • No, same error. – Torbjørn T. Jul 27 '17 at 20:25
  • @TorbjørnT. Any ideas as to why? – God bless Jul 27 '17 at 20:49
  • I already said I don't know. – Torbjørn T. Jul 27 '17 at 22:27

1 Answers1

4

arXiv says this about the source:

Source

Delivered as a gzipped tar (.tar.gz) file if there are multiple files, otherwise as a PDF file, or a gzipped TeX, DVI, PostScript or HTML (.gz, .dvi.gz, .ps.gz or .html.gz) file depending on submission format.

And indeed, my terminal tells me this:

$ file 1509.06811 
1509.06811: POSIX tar archive (GNU)

Hence, you cannot just rename the file, you need to unpack/extract it. Exact details for that will depend on the system, in Kubuntu I can just right click the file and choose Extract.

After extracting, you'll see that there are eight different files:

$ ls
Cobordism.sty  knots.sty    paperIV.bbl  spath.sty
header.tex     paperII.aux  paperIV.tex  stringdiagram-header.tex

The file paperIV.tex is the main article file. The other two .tex files contain the bulk of the preamble for paperIV.tex, and are included in lines 8-9 of that:

7 % Import the preamble
8 \include{header}
9 \include{stringdiagram-header}

(The numbers indicate line numbers. Note that in the preamble one should use \input, not \include, see When should I use \input vs. \include?)

Hence, the two other .tex files should not be compiled, the reason for having them is to make the preamble of the "main" file more tidy. You could have replaced line 8 and 9 in paperIV.tex with the 700+ lines of code from those files and the result would be the same.

To make a PDF you should in theory just be able to do pdflatex paperIV.tex, but unfortunately that throws an error in Cobordism.sty:

! Undefined control sequence.
\anchor ... \csname pgf@anchor@\pgf@sm@shape@name 
                                                  @#1\endcsname {#2}
l.4118 }

I don't know exactly why that occurs, possibly Cobordism.sty was written for TikZ 2.x, and needs some updating for use with TikZ 3. That is just a wild stab in the dark though, I'd suggest asking a new question about that specific problem.

LaTeX will always look in the current folder for packages, so you don't have to move the .sty files anywhere else, but for reference: Where do I place my own .sty or .cls files, to make them available to all my .tex files?

Note however a couple of things:

  • There is a newer version of spath, called spath3, already on CTAN, and in TeXLive/MikTeX.
  • You might be interested in the tqft package, see e.g. drawing cobordisms using tqft
Torbjørn T.
  • 206,688