Tag Info

72

Like with any TeX code you can put your TikZ picture environment into own .tex files and load them in your document with \input{<filename>} (never with \include). Because I faced similar issues like you while writing my thesis I wrote standalone class and package which allows you to add a full preamble to these files and compile them on their own while ...

65

You can use the xr package to reference to other LaTeX document. So in chapterII.tex you say: \usepackage{xr} \externaldocument{chapterI} And then can use \ref{a} like normal. You can also add a prefix: \externaldocument[I-]{chapterI} then you can reference it as \ref{I-a} which is useful if you have identical label names in different chapters. Note ...

60

Use package grffile: \usepackage{graphicx} \usepackage[space]{grffile} [ ... ] \includegraphics[...]{A file with spaces}

48

you could use \write18 and a curl or wget script to grab the image from the web and download it to your directory. \documentclass{article} \usepackage{graphicx} % includegraphics command is implemented here \begin{document} \write18{wget http://www.some-site.com/path/to/image.png} \includegraphics{image.png} \end{document} note however, that recent ...

39

if you want get rid of those files in your document directory then use the optional argument -output-directory=whatever. Then all auxiliary files and the pdf are saved in that directory. For example what I use: pdflatex -output-directory=target <file> then my <file>.pdf is also in target, but I always use a softlink ln -s ...

34

Short answer: no. You will need to download the image and use it locally if you want to include it in your document. pdfTeX and XeTeX do not include the necessary code to grab an image from an arbitrary location. Of course, you can link to an image at at remote location. You can make use of the hyperref package to include a suitable link. You might do this ...

32

Yes, you can: \IfFileExists{filename}{true-branch}{false-branch} Notice that this looks for the file in all search pathes of LaTeX, so not only in the current directory, but in the texmf tree as well. Therefore, you can use it for instance for a "poor man's solution" when a package is missing: ...

28

I know of three ways to put one .tex file into an other: 1. \include{⟨filename⟩} 2. \input{⟨filename⟩} 3. \import{⟨path⟩}{⟨filename⟩} \include is only used in the main document, and is the preferred way in large documents. You can not use \include in documents that has themselves been included with \include. \include will always start on a new page. With ...

28

The snapshot package gives you a list of the external dependencies of a LaTeX document. Use it by saying \RequirePackage{snapshot} before the \documentclass command (to have the information written to a .dep file), or by saying \RequirePackage[log]{snapshot} before the \documentclass command (to have the information written to the .log file).

27

No, TeX itself can't delete files, just create or overwrite them. You need to use an external tool, like a LaTeX editor or Makefile to delete it for you. For example latexmk has a -c option which cleans up all auxiliary files. I also use Makefiles under Linux which contain a clean rule which remove all auxiliary files. However, this isn't really a good way ...

26

Try: \usepackage{etoolbox} \makeatletter \patchcmd{\Ginclude@eps}{"#1"}{#1}{}{} \makeatother ... \includegraphics{"file name.eps"} The macro \Ginclude@eps is defined in the file dvips.def. It uses \special{PSfile="#1"\space ... which causes problems if additional "" are used. I patched this, such that it behaves like it was written PSfile=#1 and it worked ...

24

You want the macro \jobname. This isn't quite the filename; to quote from the TeX FAQ: TeX retains what it considers the name of the job, only, in the primitive \jobname; this is the name of the file first handed to TeX, stripped of its directory name and of any extension (such as .tex). If no file was passed (i.e., you're using TeX interactively), ...

23

http://www.tex.ac.uk/cgi-bin/texfaq2html?label=extref Referring to labels in other documents When producing a set of inter-related documents, you’ll often want to refer to labels in another document of the set; but LaTeX, of its own accord, doesn’t permit this. So the package xr was written: if you say \usepackage{xr} ...

22

pdftex.def Version 2011/05/28 v0.06e The list depends on the version of pdftex.def, the version of pdfTeX (temporarily TIFF was available, latest addition is JBIG2), the version of the generated PDF (JBIG2 requires PDF 1.4). For the current versions (2012) and PDF ≥ 1.4, the list is: ...

21

\documentclass{minimal} \makeatletter \def\app@exe{\immediate\write18} \def\inputAllFiles#1{% \app@exe{ls #1/*.txt | xargs cat >> \jobname.tmp}% \InputIfFileExists{\jobname.tmp}{} \AtEndDocument{\app@exe{rm -f #1/\jobname.tmp}}} \makeatother \begin{document} \inputAllFiles{.}% from the current dir \end{document} Not really difficult. It is ...

21


21

Your comments indicate that you'd like to have some kind of database of equations. An easy approach would be to have a separate file equations.tex, say, which defines two macros \saveequation{<ID>}{<equation code>} \useequation{<ID>} and also contains the equations defined with \saveequation and maybe also calls some often needed related ...

21

The LaTeX2e kernel, provides some commands for parsing paths and extensions. It is preferable to use them for this type of parsing. The macro \filename@parse scans its argument and splits it into three parts which are then saved in the macros \filename@area, \filename@base, \filename@ext \documentclass{article} \begin{document} \makeatletter ...

21

Sure. TeX inserts (by default) ^^M at the end of each line. So something like \begingroup \catcode\^^M\active \let ^^M\par% \input{youressay.txt}% \endgroup% should do it, although I didn't test. Edit: I just remembered the \obeylines macro which does exactly what I wrote above. \begingroup \obeylines \input{youressay.txt}% \endgroup%

20

The filename syntax is one of the few explicitly system dependent parts of TeX-the-program. In texlive (ie web2c tex) most characters are allowed (especially after the syntax was changed to allow " quoting names including spaces). Of course the characters are interpreted by TeX's macro expansion before being considered as possible filename characters, so % ...

20

I'm afraid you cannot alter the output name from within the LaTeX source: the \jobname primitive can be read but not altered. You can arrange two-file solutions which allow one LaTeX file to 'call' another, but I am not sure that will answer your problem here.

19

You can set the every picture locally in a group around the input file to set any option which should be used for the tikzpicture in that file. \begingroup \tikzset{every picture/.style={scale=0.3}}% \input{sometikzpic}% \endgroup However, if you have other tikzpictures inside nodes of the main picture they will also be affected (twice I mean). In this ...

19

The PDF format includes file attachments, which means other files can be attached much like in emails. One package that can do this is the attachfile package. This package inserts a link to the attached file in the document text. My preferred package is navigator. Navigator simply attaches the file; nothing appears in the document. The file is accessed ...

18

You can store your bib file in $LOCALTEXMF/bibtex/bib or any subdirectory of it. Then LaTeX (and BibTeX, biblatex, and biber) will find it. Note that you have to update the filename database whenever you put a new file in this location (but not when the file is only updated). The$LOCALTEXMF part can be any directory which is known to your TeX distribution. ...

18

I believe what you're looking for is the sepfootnotes package. Here is an example of its basic usage: % to keep this example self-contained % the file that contains the footnotes: \RequirePackage{filecontents} \begin{filecontents}{\jobname-notes.tex} \Anotecontent{id1}{\label{id1}This is the footnote with id1.} \Anotecontent{id2}{\label{id2}This is the ...

16

You should use commas to separate the fields. Then you can plot the file using \addplot table [col sep=comma] {datafile.csv}; If you want to use whitespaces in addition to the commas to keep the file more readable, you need to use [col sep=comma,trim cells=true] to strip the spaces around the commas. Here's a minimal example of plotting a file with dates ...

16


16

TestInput.out probably contains a new line at the end of the file (text files usually do, even when created with echo 'abc' > file). TeX interprets new lines as spaces. To remove that space, simply add \unskip directly afterwards, i.e. use A\input{TestInput.out}\unskip B (this will also remove any intentional space at the end of the file, should there ...

16

Here's a Plain TeX solution that uses the ε-TeX extension \readline. It copies its source to \jobname.copy. \newread\in \openin\in=\jobname.tex \newwrite\out \immediate\openout\out\jobname.copy \endlinechar-1 \loop \unless\ifeof\in \readline\in to\l \immediate\write\out{\l} \repeat \immediate\closeout\out \closein\in \end

16

Unfortunately, latexmk -c does not delete all generated files by default. For example, it does not delete files generated for glossary, acronym and index creation. I managed to have latexmk -c delete more temporary files by creating a global .latexmkrc file (on Unix-like systems, put it into your home directory): @generated_exts = qw(aux idx ind lof lot ...

Only top voted, non community-wiki answers of a minimum length are eligible