130

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


72

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: \IfFileExists{upgreek.sty}{\usepackage{upgreek}}{\let\upmu\mu} ...


47

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


39

A simpler solution would be... \includegraphics{{"../Current folder/1.This file"}.png} (For Windows users,) note that the slashes all need to be forward slashes.


34

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


30

Perhaps you have set a language using \lstset. You can disable the language by using the empty language: \lstinputlisting[language={}]{file.txt}


29

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: .png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,....


24

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


23

Use \href{run:d:/my folder/test.pdf}{<link text>} instead of \url{...}: \documentclass{article} \usepackage{hyperref} \begin{document} \href{run:d:/my folder/test.pdf}{This is my link} \end{document} This works fine with Adobe Reader X (Windows).


23

There are several things you need to consider : Readability : tikz scripts tend to be quite long, and can easily cause a big break in the rest of your source code. From that view, leaving only the document-specific issues in the main document (that is the figure environment, caption, etc), and loading the tikz file from an external file is positive. The ...


22

When using the import package (which provides the \import command), you must ensure that the path argument includes the trailing slash /. So you need to do: \import{/Users/john/Documents/Uni/Studienarbeit/Latex/Kapitel/GDP/}{GDP} Note the / at the end of the path. As others have noted in the comments, it's usually better to use the \include command for ...


22

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


22

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


21

That's a pretty basic mechanism in (La)TeX which you can also use to "separate out" other parts of your document. Simply paste any number of lines into a new text file (say, file.tex) and then input it by putting \input{file} in the place where the lines used to be (note you can leave out the .tex extension). \input will act exactly like 'pasting' the ...


21

I wrote the following mwe using trial and error. The main file mwe.tex: \documentclass{minimal} \usepackage{tikz} \begin{document} \input{temp.tikz} \end{document} The file temp.tikz simply contains: \begin{tikzpicture} \draw (0,0) --(1,2); \end{tikzpicture} The output of mwe.tex looks like this:


20

It's a very common problem: if you want to typeset an underscore, you need to pass \_, which is not good for a file name. Solution: \documentclass[a4paper]{scrreprt} \usepackage{listings} \newcommand{\codelst}{\begingroup \catcode`_=12 \docodelst} \newcommand{\docodelst}[1]{% \lstinputlisting[caption=\texttt{#1}]{#1}% \endgroup } \begin{document} \...


20

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 specify additional parameters (like jobname) at the very beginning of your main file (even before \documentclass): %& -job-name=newfilenameialwayswanted It slightly depends on your compiler but it should work. An additional comment: If you use an IDE, this may cause troubles for file opening hotkeys (the file they will try to open will not be ...


18

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


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


18

You either need to specify the full path e.g.: \includepdf[pages={1-7}]{/home/bob/Documents/MyFolder/Resources/myfile.pdf} or specify it relative to the current directory e.g. suppose your document is /home/jane/mydirectory/mydoc.tex and you need to include /home/jane/myotherdirectory/Resources/myfile.pdf then: \includepdf[pages={1-7}]{../myotherdirectory/...


17

You could also use the catchfilebetweentags package. This package enables you to use a separate file to store you equations and then refer to them using tags that you specify. This blog post, Loading equations from an external file, explains this quite well but for the lazy I'll include an example: First you put your equations in a .tex file, delimiting ...


17

I came up with a quite nice solution I created based on these two questions on file IO: File input and output How can I open a file in “append” mode? Here is the code to put before \begin{document}: % create a new file handle \newwrite\pdfpcnotesfile % open file on \begin{document} \AtBeginDocument{% \immediate\openout\pdfpcnotesfile\jobname.pdfpc\...


16

The argument of \usepackage is a name not a file path. The fact that it sometimes works at all when passed a relative file path is just due to lack of error checking by the system. If the package does declare itself using \ProvidesPackage the use of such paths will generate a warning that the name is incorrect. The fact that the primitve \input works ...


16

Use the double quote symbol ". In this case, the file File Name.tex contained the words Hello World ... and Repin Painting.jpg contained, well, "Barge Haulers on the Volga" (Russian: Burlaki na Volge, Бурлаки на Волге), best viewed while listening to Lydia Salnikova perform Ah Ty Step Shirokaya http://www.broadjam.com/artists/songs.php?artistID=81353&...


16

\documentclass{book} \begin{document} \pdffilesize {example-image-duck.pdf} \end{document}


15

I am not sure to correctly understand your questions, but the BibLaTeX style files can be put in: /texmf/tex/latex/biblatex/bbx ---> .bbx files (= bibliographies) /texmf/tex/latex/biblatex/cbx ---> .cbx files (= in text citations) /texmf/tex/latex/biblatex/lbx ---> .lbx files (= language strings) /texmf/tex/latex/biblatex/ ---> other files (....


15

\includegraphics{foo} would work if your home directory is in your TEXINPUTS path, or \includegraphics{\string~/foo} should work on most systems.


15

There a few options to compile a LaTeX where a image is not available, each with some advantages and disadvantages: Comment the line of the \includegraphics command. With this option the format of the text obviously change to fill the space left by the deleted (commented) image. Need manual editing of the body text. But is is easy restore the deleted ...


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