{input} is about the \input command which makes LaTeX process the content of a given file basically the same way as if it would be written instead of \input.

learn more… | top users | synonyms

401
votes
4answers
166k views

When should I use \input vs. \include?

There are two different commands to incorporate another file into the source of some document, \input and \include. When should I use one or the other? What are the differences between them? Are there ...
34
votes
3answers
4k views

Replace \input{fileX} by the content of fileX automatically

Suppose I have a document with multiple include or input statements \input{fileA} \input{fileB} etc. Is there an easy way to generate a single .tex file where \input{fileA} is replaced by the ...
8
votes
2answers
787 views

Make a .tex file that combines complete .tex documents in subdirectories

I'm using LaTeX for my research journal (similar to WordPress). There are a number of subdirectories that contain complete (standalone) .tex files along with PDF files that I made from those ...
34
votes
4answers
4k views

\input only part of a file

I would like to include part of the contents of a .tex file into a different .tex file. I don't have the option of modifying the file to include. The file to include may change so simply copying and ...
13
votes
3answers
9k views

Path to External Files in Nested \input

Problem I usually load a helping TeX file that contains my customizations, e.g., usual packages, corporate standard colors, and macros for abbreviations. I want my helping file to also load another ...
27
votes
4answers
19k views

How to make the main file recognize relative paths used in the imported files?

I'm currently using doxygen to generate some documentation for a project, and doxygen generate some LaTeX code that then can be used to generate a nice pdf. But let's say I would like to write ...
15
votes
3answers
2k views

Expandable version of \InputIfFileExists or \IfFileExists

From this question: Cannot use \toprule when doing \input inside tabular -- why? I know that everything inside the tabular environment should better be expandable. The MWE below suggests that ...
14
votes
1answer
558 views

Why is \input not expandable?

In latex.ltx I found \def\input{\@ifnextchar\bgroup\@iinput\@@input} where \@@inputis expandable. I would like to know if there is an expandable version of \input. The problem comes from an example ...
15
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 ...
6
votes
4answers
2k views

How to make “\input” in a “\include”-d file use the correct current path?

I'm having a master file let's say test.tex and also some folders sub1/ and sub2/. There is also a TeX file in each of them: sub1/sub1.tex and sub2/sub2.tex. In the sub1/ and sub2/ are also some ...
11
votes
2answers
2k views

How to make \include work with a quoted string path containing spaces?

In Windows, \input can work with a quoted string path containing spaces, but \include cannot. How to fix it? \documentclass{book} \begin{document} %\input works! \input{"Contents/Installing and ...
27
votes
2answers
2k views

Insert libreoffice table as input

This question led to a new package: odsfile Suppose you have an localc spreadsheet myspread.ods and you want to insert the content of the range H4:I40 as a table into your latex document. I ...
21
votes
2answers
6k views

Inputting multiple files in LaTeX

Suppose I have a directory containing a bunch of LaTeX source files, and I want to input all of them into a single main file. I could do this by saying \input{dir/file1.tex} \input{dir/file2.tex} ...
4
votes
3answers
400 views

Can i automatically load chapters and sections based on the filesystem?

I was interested in knowing if i can load chapters and sections of my book based on the filesystem. For example: Chapter 1/ Section 1.tex Section 2.tex Section 3.tex Chapter 2/ Section 1.tex ...
10
votes
1answer
574 views

Tabs in output file written by xelatex and pdflatex are different

I'm trying out pgfplots with gnuplot to generate the data. This works by having pgfplots write some stuff to an external file, run gnuplot on the file, and then use the generated data to plot the ...
14
votes
1answer
590 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 ...
4
votes
2answers
679 views

how do I use the \input command on windows, combined with \IfFileExists?

I'm trying to use a command in my LaTeX file that inputs a file if it exists, and if it doesn't exit, inputs another one. This is the command: ...
4
votes
4answers
6k views

how to use \input{file.tex} correctly?

Suppose I have two latex files file1 and file2 with the same preamble and so on. Then I want to create a file called bigfile which just puts the two files together. This is not working for some ...
13
votes
3answers
482 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 ...
12
votes
2answers
2k views

Splitting a large document into several files

Why is it recommended to split a large document into several parts and include them with \include? Is it only a relic of the past times when computers and LaTeX compilers were slower, or is it still ...
10
votes
6answers
308 views

How can I '\input' a file without getting the implicit newline?

Intro I'm working on a lightweight package that allows you to put any content (typically LaTeX code) in an environment, then use that content multiple times, each time scanned separately, so you can ...
8
votes
3answers
7k views

Include data from a .txt

I am using a finite element program that outputs data in .txt files. And I want to input these data in my latex code. Is there a way to input the data files so that they appear as the program output ...
7
votes
1answer
140 views

What are the pros and cons of packages versus \input for a preamble?

For a some simple cases it seems to me that there would be no important difference between putting some code in a file preamble.tex and having \input{preamble.tex} in the main .tex file putting it ...
12
votes
2answers
926 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
1answer
1k views

Can a default path be set globally for \input{…} akin to \graphicspath{…}?

For the graphicx package, we can use \graphicspath{...} so that we can directly use filenames in the argument of \includegraphics{...}. Can a similar thing be done for directly using filenames in ...
6
votes
1answer
952 views

tabular, siunitx and input - `Extra }, or forgotten $.`

I'm trying to include data into a tabular environment \usepackage{booktabs} \usepackage{siunitx} \begin{table} \begin{center} \begin{tabular}{SSSS} \toprule {$na^3$} & ...
5
votes
1answer
1k views

Special characters in input file

I want to have my sections in independent .txt files in the folder of my assignment. So I use \input{text.txt}. The problem is, I write in Danish and we have the 'æ' 'ø' 'å' characters that aren't ...
3
votes
2answers
492 views

Disable including of system files [duplicate]

Possible Duplicate: How can I safely compile other people's LaTeX documents? I've got a Linux server that is rendering LaTeX documents, I want to disable the access of LaTeX to system ...
8
votes
1answer
2k views

latexdiff + svn not working with multiple files (flatten)

Short question Seems like --flatten doesn't work properly with latexdiff-vc. How can I get this working, without reverting to my elaborated workflow described below? Context I track the history of ...
7
votes
1answer
326 views

Typesetting multiple TeX files

Q1. Is there an existing template with the following features: (1) Multiple files, which I can typeset individually (as and when necessary). (2) A single .bib file from which I can cite in ...
7
votes
3answers
1k views

How to make nonstopmode really not stop on a missing input file

I have a file test.tex with these contents: \input{missing} \input{present} When I run PDFLaTeX with --interaction=nonstopmode it stops after the first missing input file: $ pdflatex ...
4
votes
2answers
3k views

How to prevent a \lstinputlisting being split across pages?

This question shows how to prevent a long listing from being split across several pages when the code is written directly into the tex file. I want to achieve the same effect when including code in ...
12
votes
2answers
7k views

How to use the import package?

I've read about the import package and am now trying to use it in my document, but I only run into errors. I have a main file named /ProjectPath/header.tex which loads all packages, etc. ...
8
votes
2answers
2k views

Cannot use \toprule when doing \input inside tabular — why?

Using \input inside a tabular environment does not seem to work in all cases, but I don't see why. The MWE below gives the following error message: ! Misplaced \noalign. \toprule ->\noalign ...
7
votes
2answers
282 views

Options for building multiple documents from the same content with different layouts

I need to produce two document layouts using the same content. I'm going to be making heavy use of the input{} command to do this, but it is more complex than just this. I'm looking for suggestions ...
1
vote
1answer
4k views

Input file folder

In my main LaTeX file I'm using a number of input files which are dynamics (changing the contents). I want to put some of these files in a higher order folder but at the same time don't want to fix it ...
11
votes
3answers
876 views

force long text inside \item[{\texttt{}] to wrap

I have a LaTeX document that is automatically generated and then inserted as part of my own larger document with \input. This other document has a description environment for examples, one item for ...
8
votes
2answers
583 views

Bind reports/articles into a book, but keep the ability to compile them individually

I see a few questions and answers about writing a book/thesis in LaTeX (here's one). But I would like to be able to compile reports separately as I write them to have a bunch of standalone documents. ...
6
votes
1answer
734 views

\input only part of a file using catchfilebetweentags package

I would like to include only a part of a .tex file into a different .tex file. The part I want to include is delimited by some comment tags, as it is used by catchfilebetweentags package. I tried the ...
4
votes
1answer
411 views

Relative paths for \input and building from different directories

The minimal example If I have a directory containing my main LaTeX source file and it uses \input to incorporate some data in another file, I can use a relative pathname. E.g., with these files: ...
4
votes
1answer
195 views

Using a non-centralized structure for tex files - similar to \graphicspath

I have a fairly large document, that I have picked apart into different sections etc, each in their own file. To include graphics that are not in one central directory I use \graphicspath which works ...
4
votes
1answer
533 views

remove unwanted contents from list of listings

The following code adds a wrong line to the list of listings \documentclass{scrbook} \usepackage{listings} \usepackage{filecontents} \begin{document} \begin{filecontents*}{democodefile} ...
8
votes
3answers
223 views

How to join two or more external .tex file using another .tex file and then compile?

Suppose I have two tex files file1.tex and file2.tex. I want to join them in another tex file. I have tried to do this with the following one : \documentclass{book} \begin{document} ...
7
votes
3answers
283 views

Avoid inputting a file multiple times

I have a revision string automatically saved to a file VERSION (it is the output of git describe and usually looks like v2.2-19-g0a51c27), and define a command ...
10
votes
2answers
273 views

Large document edited by a dozen people

We, a team of 12 people, plan to write a 50 pages paper. The paper will be divided into chapters. Usually, no more than 2 or 3 people will work on a given chapter. Having one large file will create ...
6
votes
2answers
224 views

Use input inside a spreadtab environment with calculations

My aim is to create a command for inserting tables, which will format the table, and add calculations on its values, given a file containing the raw data of the rows only. ...
6
votes
3answers
274 views

Is there a way to load additional packages specified in the document environment?

It seems strange but I really need this. Is there a built-in macro to load additional packages specified in the document environment? % main.tex \documentclass{article} \begin{document} ...
5
votes
1answer
98 views

Mark on document where input starts and what is the filename

I have a master document, and use many input{...} commands to compile the total document from many parts. I would like to mark on the working document, the start of each new input, and, what the ...
3
votes
1answer
137 views

How do I best combine several documents?

I have a collection of articles written in latex, and I would like to "merge" them into a larger thesis document, in which each article will be a chapter. I have been looking at include and input, ...
7
votes
2answers
1k views

Avoid warnings in TeXlipse

I'm using TeXlipse, an Eclipse plugin, to create my TeX documents. To structure my files I use \input{filename}. Now the problem is, that every file is one section or subsection. TeXlipse shows me a ...