Skip to main content
23 votes
Accepted

What do these commands specifically do?

You provide several interpretations of what various commands do. \makeatletter and \makeatother are just necessary for redefining macros or something. Not quite. By default, the character @ is ...
Mico's user avatar
  • 528k
22 votes
Accepted

Problems with \input{table.tex}\hline after 2020 fall LaTeX release

Yes, LaTeX changed here, but it also added new environments hooks, and you could use them to change to the primitive input in all tabular, This would have the additional benefit, that it will also ...
Ulrike Fischer's user avatar
21 votes

how to prevent \input from failing if the file is missing?

Instead of using \@input the better method is probably to use \InputIfFileExists{file}{then}{else} This will run \input on file if it exists, and then execute the code in then. If the file does not ...
daleif's user avatar
  • 56.4k
21 votes
Accepted

Dealing with strict rules for paper submission using LaTeX

The journal's input requirements are very straightforward. To fix ideas, let's assume that your document consists of four files you created yourself: main.tex, sec1.tex, sec2.tex, and mybib.bib. ...
Mico's user avatar
  • 528k
17 votes

When should I use \input vs. \include?

Great answers about input and include commands. If you need to nest this .tex archives, have import package that brings the \import. % at preamble \usepackage{import} % where you need \import{〈...
Jean Pimenta's user avatar
13 votes

Problems with \input{table.tex}\hline after 2020 fall LaTeX release

Using the primitive behaviour of TeX's \input works. This can be used in LaTeX if you omit the braces around the filename, in which case LaTeX will fallback to the primitive. You'll lose some of the ...
Skillmon's user avatar
  • 67.6k
13 votes
Accepted

Misplaced \noalign error with \input in a table after the 2020 fall LaTeX release

LaTeX's \input in tables was always tricky, because it was never expandable, then at the beginning of table cells it could not work properly sometimes, so it was never fully supported. This now ...
Phelype Oleinik's user avatar
11 votes
Accepted

Can arara detect a rule inside a \input file ?

I am sorry, arara limits the directive lookup scope to the current document. It would be quite challenging to detect special macros and process them accordingly, like following a file through \input, \...
Paulo Cereda's user avatar
  • 44.6k
10 votes

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

latexmk does a good job with this: latexmk -deps main.tex It prints everything: other .tex files, .bib files, .sty files, graphics.
japreiss's user avatar
  • 455
10 votes

How insert a character at the begin of every line from a source code?

With listings you can redefine the numberstyle: \documentclass{article} \usepackage{listings} \lstset{ language=tex, basicstyle=\footnotesize\ttfamily\selectfont, keepspaces=true, numbers=...
Ulrike Fischer's user avatar
10 votes
Accepted

How to input certain puzzles from a collection?

I made a package just for purposes like this. It's called exercisebank. Say you have your 2017.tex, and in there you should have puzzles and solutions in the following format. %% 2017.tex %% Heads ...
Andreas Storvik Strauman's user avatar
10 votes
Accepted

Same absolute path works for \input but does not work for \include, why?

\input only needs read permission, but \include writes an aux file for each included file, so it needs write permission.
David Carlisle's user avatar
10 votes
Accepted

Insert text with terminal color escape sequences

Here is an approximation of what you are asking for. TeX doesn't provide a way to input binary files reliably, but for pdfTeX there's the \pdffiledump primitive to read a binary file, escaped as a ...
siracusa's user avatar
  • 13.5k
9 votes

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

I've recently discovered TexSoup, a Python module to parse Latex files inspired by BeatifulSoup. It makes really easy to work with .tex files in a very straightforward way. For instance it allows to ...
gibbone's user avatar
  • 201
9 votes
Accepted

How to do multiple calls to \includeonly?

For your specific use case you could use just one includeonly by putting each chapter on its own line: \includeonly{% myfirstinclude, mysecondinclude, mythirdinclude, } This way it is easy to ...
thiagowfx's user avatar
  • 270
9 votes
Accepted

Compiling using latexmk from a different directory?

As was already mentioned in a comment, the -cd option to latexmk does exactly what you request latexmk -pdf -cd subfolder/subfolder/main.tex
John Collins's user avatar
  • 11.7k
9 votes
Accepted

How to \input or \include files from different directories?

Files that are \input need to use a path relative to the root file (the one containing \documentclass) not to the included file, so you need to use \includegraphics{Graphics/Image_1} instead of \...
Nicola Talbot's user avatar
9 votes

Insert text with terminal color escape sequences

Like this, for instance. \documentclass{article} \usepackage{fancyvrb} \usepackage{color} \def\defaultcode{[0} \def\bluecode{[1;34} \def\redcode{[1;31} \makeatletter \def\e#1m{% ...
Ian Thompson's user avatar
  • 44.3k
9 votes
Accepted

\documentclass in separate .tex file

Now I was reading some articles and posts about large multi file documents and in many places I found that a file imported with \input{file.tex} "should not contain any LaTeX preamble code (i.e. ...
David Carlisle's user avatar
8 votes

Splitting a large document into several files

As apostill to the other answers, for me an important reason to still split long documents is not always gain time in compilation previews or reusability (although often these are enough reasons) or ...
Fran's user avatar
  • 84.3k
8 votes
Accepted

Using `\input` to insert a section of a document into another

You can set up your file containing the code for the graphs like % from https://tex.stackexchange.com/a/234521/4427 \GRAPH graph1 \begin{tikzpicture} \begin{axis}[ylabel={Y label},xmin=-1,xmax=1,...
egreg's user avatar
  • 1.2m
8 votes
Accepted

Underfull \hbox with \input

The input is equivalent to \documentclass{article} \parindent0em \begin{document} \rule{\textwidth}{0.1em} {} \end{document} which has two space tokens at the end of a paragraph so ...
David Carlisle's user avatar
8 votes
Accepted

What state changes are caused by \input?

When the \input primitive is encountered, TeX starts reading the new file and starts a new line for the beginning: thus the state changes from 'whatever it was' to N. It then proceeds under the normal ...
Joseph Wright's user avatar
  • 265k
8 votes
Accepted

Why is the \input command not honored when there is an incorrect use of \texttt before it?

the braces around a TeX macro argument may always be omitted if the argument is a single token. \fbox{a} may be written \fbox a so \texttt \input{bar.txt} is \texttt{\input}{\bar.txt} which is (...
David Carlisle's user avatar
8 votes

LaTeX changing svg text font

\includesvg apparently treats text in your figure independently, so that it is rendered by LATEX by default. Probably the best way to solve this is to change the option inkscapelatex to false. Quote ...
clel's user avatar
  • 385
8 votes

scanf functionality in TeX?

I added a computation to check the answers you had put in the file. \documentclass{article} \newread\x \openin\x=input.txt \begin{document} \read\x to \varn \def\do#1 #2 #3 #4\relax{% \par $#1 + #2 ...
David Carlisle's user avatar
7 votes
Accepted

How to include contents of file as verbatim?

Try \documentclass[10pt]{article} \usepackage{verbatim} \begin{document} \verbatiminput{temp.txt} \end{document} I use this regularly to include TeX source, so lots of unusual characters are ...
Ethan Bolker's user avatar
  • 9,513
7 votes

Using `\input` to insert a section of a document into another

You could use the catchfilebetweentags package. In your main file: \usepackage{catchfilebetweentags} .... \ExecuteMetaData[file.tex]{graph} and in your file.tex %<*graph> code for the graph %...
samcarter_is_at_topanswers.xyz's user avatar
7 votes
Accepted

Combine siunitx S column with input value from tex file

You need an expandable version of \input; the standard one in LaTeX isn't, the TeX primitive \@@input is. Here I use filecontents just to make the example self-contained (and to not clobber my files)....
egreg's user avatar
  • 1.2m
7 votes
Accepted

Export each figure as a separate PDF-file

The endfloat package will export all the figures (LaTeX source) to a .fff file. \documentclass{article} \usepackage{endfloat} \usepackage{graphicx} \makeatletter \efloat@openpost{fff} \efloat@iwrite{...
John Kormylo's user avatar
  • 83.9k

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