Tag Info

Hot answers tagged

52

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 ...


44

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 ...


41

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


37

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 ...


27

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 ...


26

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 ...


24

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 ...


23

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 ...


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

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: ...


20

You can place (almost) arbitrary LaTeX code in macros for later use. So you can use these to store your equations. Here is a simple example showing some possibilities: \documentclass{article} %% Can be in external file which can be inserted with \input \newcommand{\myeqintf}{f(x) = \int_a^x g(t)\,dt} \newcommand{\myeqintt}{\begin{displaymath} f(x) = ...


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 % ...


19

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 ...


19

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%


19

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), ...


19

\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 ...


19

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).


18

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.


18

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 ...


18

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 ...


16

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

The defaults are defined in the driver files, not by graphicx itself. A simple way to see them is to use texdef, e.g. texdef -t pdflatex -p graphicx Gin@extensions. For latex in DVI mode the default extension list is .eps,.ps,.eps.gz,.ps.gz,.eps.Z, for pdflatex and lualatex it is .png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,.JB2,.eps ...


16

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 ...


15

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


15

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} ...


15

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 ...


15

Don't use backslashes recklessly. The standard directory separator should work fine on all platforms: \includegraphics[width=0.5\textwidth]{folder/test.jpg} % ^^^^^ You can even omit the suffix .jpg to let the driver pick the best representation of the image (e.g. JPEG for PDF, and EPS for PS).


14

Another option is to use the datatool package. \documentclass[a4paper]{scrartcl} \usepackage{datatool,tikz} \DTLloaddb[noheader=false]{coordinates}{coord.dat} \begin{document} \begin{tikzpicture} \DTLforeach*{coordinates}{\x=x, \y=y, \r=r}{\draw (\x,\y) circle (\r);} \end{tikzpicture} \end{document} where coord.dat is a comma separated file with header ...


14

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. ...


13

I've never experimented with changing it, but texmf.cnf has (near the end) max_in_open = 15 % simultaneous input files and error insertions, which you could paste into the local texmf.cnf and adjust. (On my system, the appropriate file to make changes to is /usr/local/texlive/2010/texmf.cnf.) I guess you would have to rebuild your formats after ...



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