{external-files} is about external files included in a document, e.g., pictures via \includegraphics, or parts of a document via \input or \include. For questions about files automatically generated by LaTeX (.aux, .log, .out, .toc, ...) use {auxiliary-files}.

learn more… | top users | synonyms

43
votes
2answers
11k views

How to include graphics with spaces in their path?

I want to import graphics into my main input file using the macro \includegraphics. It does not work if the filename contains spaces. Include image with spaces in path directory to be processed with ...
38
votes
2answers
4k views

Can I use an image located on the web in a LaTeX document?

I have tried \includegraphics{http://www.site.com/path/to/figure.png} But this returns the error ERROR: Package pdftex.def Error: File `http://www.website.com/path/to/figure.png' not found. ...
38
votes
3answers
3k views

Outsourcing TikZ code

My Tex files get very confusing since I have multiple long TikZ code in them. How do you organize your files when it comes to TikZ?
32
votes
11answers
9k views

Deleting external/auxiliary files?

Is there a way to make TeX delete files? In my document a lot of auxiliary files are created and it would be wonderful to have them removed after their content has been used.
28
votes
6answers
878 views

Is it possible to write all mathematical formulas in a separate file and add them in main file on-demand?

Consider this scenario: I have a report to write and I want to write all mathematical formulas in a separate file and then add them in the main report file on demand (i.e. include/import/add/call a ...
28
votes
2answers
12k views

Cross-referencing between different files

I want to cross-reference between different .tex files, just because I want to put every chapters separately. Let's say in file chapterI.tex I have \label{a} and I want to access this in file ...
26
votes
2answers
1k views

Graphics file extensions and their order of inclusion when not specified

When using graphicx's \includegraphics you can specify the file extension or not. For generic use and perhaps portability, extensions are commonly dropped. The types of "approved" inclusions and their ...
26
votes
3answers
3k views

How to influence the name of the pdf file created with pdfLaTeX (from within the source code)?

I have a source file called 2011-05-27_Myfilename.tex and I'd like to create a PDF file from it called only Myfilename.pdf. Can this be configured from within the .tex file itself? (It seems to be ...
26
votes
5answers
11k views

.bib library file in a different directory, how to use? (Mendeley centralised .bib file)

problem Hello All, I have the possibility of a centralised, updated .bib file using Mendeley Desktop. This file will stay updated with all the changes I make using my Mendeley citation software. I ...
20
votes
4answers
662 views

How to increase the TeX open file limit?

I noticed that TeX has a open file limit, while using some additional bibliographies with multibib, using hyperref, backrefs and so on (basically only 5 additional newcites were possible in that ...
19
votes
2answers
618 views

What are the allowed characters in filenames?

What characters can be used in filenames for the main document and input files, both .tex and images etc.? I'm not asking about which are recommended to be used, but about a list of all possible ...
15
votes
4answers
3k views

How to iterate through the name of files in a folder

Assume I have many TeX files. For the sake of simplicity, also asssume they are in a single folder or directory. I want to input all files from within my main LaTeX document. Actually I can create a ...
15
votes
3answers
409 views

How to trim .tex for each filename read from an external file?

I have an external text file that contains a list of names of TeX input files. The names have trailing extensions .tex. For example, the external text file named data.txt contains the following list: ...
14
votes
3answers
5k views

Scaling a TikZ figure from an external file

I would like to insert figures which were created with TikZ to my LaTeX document. I suppose that if I create the TikZ figure inside the document, that wouldn't be a problem - I'd just play with the ...
14
votes
1answer
10k views

How do I import a text file so that it becomes the body text of my LaTeX document?

I want to completely separate formatting and content creation. The articles I will write are all plain prose that requires minimum or zero LaTeX formatting. Also, the text file doesn't have the ...
14
votes
2answers
266 views

Write to /dev/null?

I'm working on package that (among other things) writes an external file during compilation. I'd like to provide an option to the package to not write the external file. I know I can set up a ...
14
votes
1answer
218 views

Poor man's “namespaces”

I have searched for "namespaces", but all of these posts seem to ask for something way more advanced. The problem I encounter can be solved by renaming everything, but that does not seem "right". ...
13
votes
6answers
931 views

Automating quoting across LaTeX documents

I occasionally face the following situation when writing LaTeX documents. (This question is probably not LaTeX specific, though). Suppose I have a document, say orig.tex. Then I quote from that ...
13
votes
3answers
1k views

Drawing different tikz shapes parameterized by data from a file

I have a file with three columns of data, x, y, r. # x y r 1 1 0.1 2 2 0.5 3 3 1.2 and so on. I'd like to loop over the rows, and draw a circle at x,y with radius r for each row. I first thought ...
13
votes
4answers
638 views

File copy without expansion

What is the command for file copy? I want to copy the contents of one file into another without any command expansion. The operative system would use copy source target I tried reading the contents ...
13
votes
2answers
2k views

What is the variable that contains the source file name?

I am writing a package that saves information to an external file. I would like to name that file according to the source one; something like foo.tex -> foo.bar But I cannot find any variable that ...
13
votes
3answers
395 views

Need help creating a custom aux file read/write routine to suit my needs

I require two new commands, \createreference and \citereference, to work with. They should work as shown in the following examples: \createreference{john}{John Q. Citizen} should write the text “John ...
13
votes
1answer
2k views

Can I test if a file exists? [duplicate]

Can I somehow test if a file exists? And can I use this to do only things when it exists? I like to do something like if(exist('members.csv')) { do something }
13
votes
3answers
814 views

How can I open a file in “append” mode?

Could not find anything in the TeXBook, but this could be just me. I guess it is always possible to open the file for reading, copy its content to another file, and then continue writing to that ...
12
votes
3answers
2k views

Create list of all external files used by master LaTeX document?

Is there an easy way to create a list of all external files (complete path) which are used by a LaTeX document (and its "sub-documents") by \input \include \includegraphics ? (may I have forgotten ...
12
votes
2answers
309 views

Is there any tool available to LaTeX to search for files with wildcards?

Say I want to find all of the packages of the form tikzlibrary*.code.tex Is there any way I can retrieve a list of all such files available in TeX's path in a portable way, hopefully one that ...
12
votes
2answers
136 views

Filecontents and newenvironment issue

I need to write some inlined code on an external file, then load it with listings. I would like to define a new environment, but if I do, filecontents does not save the first line of code (see MWE): ...
12
votes
2answers
2k views

referencing labels from other files

Sometimes I want to refer (using \ref) a \label from some other tex file. What is the right way to do it? (It's, of course, possible to \include all files in one and then use \includeonly — but it ...
12
votes
1answer
547 views

How do I create a macro which reads the content of a file when the macro is defined?

I am trying to do something like: \newcommand{\sometext}{\input{somefile.txt}} This works, but requires inputting the file every time the macro is used in the document. I would like to know a way ...
12
votes
1answer
1k views

How can I pass underscore to \newcommand properly?

I'd like to simplify my code appendix with this command definition: \usepackage{listings} % ... \newcommand{\CodeListing}[1]{% \lstinputlisting[caption=#1]{#1}% } That is, the caption should be ...
12
votes
2answers
798 views

Parsing files through LuaTeX

This question has two parts: How would one generally parse a file with LuaTeX, assuming the file only holds data that is delimited either by spaces, commas or semicolons. How would you parse the ...
11
votes
3answers
189 views

Read authors from file

At our university, we students write a lot of summaries in LaTeX. We have the convention of adding a CONTRIBUTORS.txt file to the repository containing the document code, which lists all contributors ...
11
votes
2answers
68 views

How can I insert an entire input stream (up to EOF) into an output stream?

I am trying to automate the generation of a text version of my resume. I'd like to incorporate a note to any potential human readers (most plain text resumes are, to my understanding, simply scanned ...
11
votes
2answers
638 views

TikZ read out file

I have a file called assocFile.dat. The file has the following format: 0/b 1/d 2/f 3/h I want to use this file to draw nodes (however it would be nice if this question can be ...
11
votes
2answers
3k views

Where can I put biblatex style modifications?

Guidelines for customizing biblatex styles says: Finally, assuming that I'll want to use my style adjustments in a multitude of documents: Where do I put the relevant macro stuff? The ...
11
votes
1answer
299 views

Can Footnotes reside in another file?

I want to know if is there a possibility/method/package, by which I can uniquely label all footnote positions in book.tex. And another file, footnote.tex, containing the footnotes and matching labels, ...
11
votes
1answer
4k views

pgfplot: Datafile format for datetime field

I have a datafile (which I may manipulate to any format), it contains a date-time stamp currently in the form "year-month-day hour:min" and a single variable for each recorded time. When I attempt to ...
11
votes
1answer
183 views

Can filecontents write an external file in a parent directory?

Reading Are there any disadvantages of TeX being Turing complete? got me thinking about the potential of .tex files for harbouring malicious code. The filecontents package is used to write external ...
11
votes
1answer
1k views

How do I make an attached file display like a link?

I'm embedding an external file in my pdf with \usepackage{attachfile2} and\textattachfile[color=1 1 1]{description}{file.pdf}. How can I make the text look the same as it would if I had used the ...
11
votes
1answer
197 views

How do you perform version control on TeX-related files that are used in multiple projects?

I'm an avid TeX user for quite some time now. I use LaTeX for most of my lecture notes and my assignments. That's why I'm usually working on about half a dozen LaTeX projects at a time. Over the time ...
11
votes
1answer
282 views

Organizing images for multiple latex files

This is kind of a soft question. In my work, I generate a lot of images (graphs with data, sketches of the experimental system, etc..) which I later use in various latex files (papers, beamer ...
10
votes
2answers
777 views

Space inserted after “\input” call

I've noticed a significant issue with the \input command, it seems. For some reason, I can't seem to prevent it from adding a space after it reads its input. Even if there is no newlines or spaces ...
9
votes
2answers
433 views

How do I typeset a file containing ASCII art using a fixed-width character font?

I have a string with the text precisely spaced the way I want it displayed. It's sort of an ASCII art project. I want to convert this text to a PDF so I can print a poster with the text at my local ...
9
votes
3answers
271 views

Make newlines expand to custom command

I am making a guest list which I will print on a sticker sheet, cut them out, then stick them to envelopes. This means that each guest/guest group will have a bounding box drawn around it as a cutting ...
9
votes
2answers
208 views

How can I create Table in TeX and get information from txt file

How may I input .txt file to the TeX tabular? I have a list of students (FirstName, LastName, and if this student was at school). 0 means not, 1 means yes, of course... .txt file look like this: \r ...
9
votes
2answers
683 views

How to avoid automatic .tex extension in filenames?

I am in an mildly unfortunate situation in which, because of the way I prepared the files automatically, I ended up with a file to be attached but also another file with the same name but ending in ...
9
votes
2answers
90 views

Including PDF pages from URL

Does anyone know a way of including an external PDF document from a URL? When using pdfpages the following will not work: \includepdf[pages=-]{http://www.mydomain.com/myfile.pdf} My reason for ...
9
votes
1answer
159 views

How to read from an external dictionary in LaTeX?

I'm wondering how to define a LaTeX command \x that prints "def1" when I write \x{name1}, reading from an external (dictionary) file having a structure like {name1}{def1} {name2}{def2} etc.
9
votes
1answer
156 views

Loop Over Grid File

I have a grid file with data such as: 5 4 0 0 0 0 0 0 1 1 2 0 0 2 2 1 0 3 0 0 3 1 where 5 is the width of the grid, 4 is the height, and each number in the grid corresponds to an elevation. I can ...
9
votes
2answers
199 views

Hooks into mathmode

Short version Is there a way to pipe every symbol in a math environment unevaluated to an external program w/o manipulating the (La)TeX file directly (except for adding header files) or patching TeX ...