{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.
233
votes
4answers
72k 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 ...
31
votes
4answers
991 views
What is the difference between font encoding and input encoding?
From list of obsolete packages and classes we must avoid, I found 2 terminologies, i.e., font-encoding and input-encoding. What is the difference between them?
25
votes
4answers
2k 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 ...
23
votes
4answers
12k 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 ...
20
votes
2answers
1k 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 ...
19
votes
3answers
1k 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 ...
18
votes
1answer
239 views
Rationale to use \input{filename} on the pdflatex command line?
In a tex.SX user profile, I read the best practice recommendation
Execute pdflatex \input{filename} instead of pdflatex filename.
I have always used the latter one, directly, in scripts, and in ...
13
votes
3answers
309 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
2answers
3k 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}
...
13
votes
1answer
249 views
Help automating calendar creation
I'm doing calendars for all the family, and I have a problem automating the process. I'm using the calendar tikz library.
I need to include the moon phase in the calendar. I can do it with this code
...
13
votes
1answer
321 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 ...
12
votes
6answers
1k views
\endinput: what is it for?
I am working on a big document and I am using the \include command to put chapters one after the other. On the internet I came to know about the existence of the \endinput command. However I do not ...
12
votes
2answers
171 views
Which TeX procedure removes trailing tabs?
From reading the TeX source, it seems that the input_ln procedure is responsible for removing trailing spaces from lines upon input (before category codes are considered). A very short excerpt from ...
11
votes
3answers
747 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 ...
11
votes
3answers
148 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
1answer
448 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 ...
10
votes
2answers
829 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 ...
10
votes
2answers
230 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 ...
10
votes
1answer
416 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 ...
9
votes
2answers
246 views
How to use the contents of a file as a number
I want to create a loop including n images.The number n is the only content of a help file (created by the application that generates the images).
Is it possible to read the contents of the help file ...
9
votes
3answers
260 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
3answers
4k views
\input and absolute paths
Sometimes it is convenient to use an absolute path to include a preamble. To do so, I use the following "hack":
\documentclass[a4paper, 12pt]{article}
\newcommand{\folder}{/path/to/folder}
...
9
votes
2answers
374 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
1k 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 ...
9
votes
1answer
63 views
Can I use \input inside an \include?
I know it is not possible to nest one \include inside another, but what about \input? Is it possible to have something like:
\documentclass{article}
\begin{document}
\include{file1}
...
9
votes
2answers
2k 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
702 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 ...
8
votes
6answers
204 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
210 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
350 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. ...
8
votes
2answers
1k 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
...
8
votes
4answers
195 views
Checking for a matching entry within a file
I have a file containing a list, like this:
apple
orange
pear
pineapple
How can I create a macro which checks if an item is on that list. E.g.:
\isfruit{pear} returns "1".
\isfruit{carrot} ...
8
votes
1answer
305 views
Is there a “selective” input command in LaTeX?
I'm likely going to have to write a document that includes some portions of source code, which I'd rather keep in separate source files. I know that I can include the contents of those files in my ...
8
votes
1answer
2k views
How to make \lstinputlisting applicable to file paths with spaces?
I am using the listings package and the path to the source code contains some spaces.
For example, the path can be /some dir/sub dir/file 1.txt and
\lstinputlisting{/some dir/sub dir/file 1.txt} does ...
8
votes
2answers
332 views
randomize the order of text lines in a .tex file
I need to create an environment (let's call it randomizer) that randomly changes the order of its lines, which may contain any text or latex commands (assume without verifying that they don't break ...
8
votes
1answer
767 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
3answers
167 views
Write on a file and input it
I'm trying to redefine a \tableofcontents-like command.
I proceed this way : the displayed elements are written to a file, and the file is input when I want the display.
If I know the toc will be ...
7
votes
1answer
124 views
Automatically convert \left to \Bigl
I have a LaTeX file, which includes tons of other auto-generated LaTeX files containing TikZ figures. Suppose I want to make every \left( in the TikZ figure appear at the same, fixed size, say \Bigl(. ...
7
votes
1answer
118 views
How can I prevent a new paragraph between two \input commands?
I want to use the command \input{} to insert two textfiles, text1.tex and text2.tex, into my latex working file. I want these two textfiles to produce one single paragraph when I am compiling my ...
7
votes
2answers
530 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 ...
7
votes
3answers
85 views
Command that expands to the contents of a file
I'd like to make a macro that expands to the contents of a file. Basically something like
\def{\mycommand}{\input{file.txt}} % file.txt contains "Hello%"
\anothercommand{\mycommand}
...
7
votes
1answer
305 views
How could I use \input within soul arguments?
So, I basically want to do something like this:
\documentclass{article}
\usepackage{soul}
\begin{document}
\so{Hello}
\so{\input{key.tex}}
\end{document}
Now the first "so" works but the second ...
7
votes
4answers
435 views
How to write a command to file
I am trying to write to a auxillary file using
\newwrite\tempfile
[...]
\immediate\openout\tempfile=list.tex
\immediate\write\tempfile{Text to write to file}
\immediate\closeout\tempfile
It works ...
7
votes
2answers
230 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 ...
7
votes
1answer
64 views
Suppress message during compilation
I use a macro with \write18 and \@@input, several times in each page of a large document. But \@@input output a message during compilation:
(filename)
This is very annoying and flood the other ...
7
votes
1answer
60 views
How can I access the numbers of pages on which input material begins and ends?
Is there a way to access the numbers of pages on which material included using \input begins and ends? Crude approaches along the lines of
\def\myinput#1{%
\typeout{ Input starts on page \thepage}
...
7
votes
1answer
249 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
1answer
96 views
How to use luatex callbacks to generate a verbatim copy of the input file
I'm trying to devise a LuaTeX solution for the question Extracting the contents of text in a specified environment into a new file, but it is turning more difficult than expected.
To begin, I need to ...
7
votes
1answer
171 views
Can I amend the preamble from outside the preamble?
I am writing a document (mydoc.tex) that will include a section as a separate document (mysection.tex) using \input{mysection.tex}.
If I want to include something in the preamble (specifically ...
7
votes
0answers
422 views
using \input and pygmentize together: trying to get line numbers to show [closed]
I am using pygments to highlight the code I insert in my lyx document.
The external file gets inserted in my document like this:
{\small \input{listings/blah.tex} }
And I use this command to ...
