Questions tagged [write]

{write} is about writing to files in TeX macros.

170 questions
12
votes
2 answers

How to output a tabulation into a file

With the commands \openout and \write I output text into a file. How can i output a tab ? \documentclass{article} \begin{document} \newwrite\tempfile \immediate\openout\tempfile="filename.txt" \immediate\write\tempfile{I want a tab at the…
Loic Rosnay
  • 8,167
8
votes
1 answer

What is the difference between \write and \immediate\write?

What is the difference between \write and \immediate\write commands when writing to a text file? \write command seems to write nothing on the text file... Here a…
zetyty
  • 779
7
votes
2 answers

How to write the result of a citation to a file?

I would like to write the result of "\cite{xyz}" to a file. The following MWE gives me Forbidden control sequence found while scanning text of \write. So I do not know how to do it.…
7
votes
1 answer

Why doesn't \write work when nothing is typeset in document?

I can't understand at which point \openout opens files, \write writes to them and \closeout closes them. I find that if nothing is typeset in the document environment, only the immediate writes write anything, and only if all of \openout, \write and…
6
votes
3 answers

Expanding control sequences and writing the raw result to a file

I'm attempting to automatically generate a BiBTeX file from within LaTeX. I'd like to expand all control sequences, but disable any active character expansion in the output. The idea is that the following…
Witiko
  • 1,216
4
votes
1 answer

Why get control sequences expanded in the process of writing them to an auxiliary file?

I was looking at LamsTeX, an old TeX format, because it has some interesting macros. I found this article about it. In the article we can read \bitem Many \LaTeX\ difficulties just now being addressed have simply never existed in \LamSTeX{}.…
User
  • 2,530
  • 1
  • 14
  • 25
4
votes
1 answer

Using \newcommand with \write\@auxout inside

I have read some related posts but still cannot resolve the problem with \newcommand{\myLabel}[2]{\makeatletter\write\@auxout{\string\newlabel{#1}{{#2}{\thepage}}}\makeatother} I would like to write a line to .aux that will be later read as a…
Peter
  • 43
  • 3
3
votes
2 answers

newwrite and read in with umlauts

I write the file out.csv, which contains umlauts and tried to read it in. How can I make this work? \documentclass[margin=5pt,…
cis
  • 8,073
  • 1
  • 16
  • 45
3
votes
2 answers

Difficulty with \write

I have a macro \Content wich contains several occurence of a macro \comm. The latter increases a counter a displays the value of the counter. Calling \Content gives the correct output. But i want to write this \Content into a file, and i encounter a…
Loic Rosnay
  • 8,167
2
votes
3 answers

How to write macro outcome to file

I have a macro \printauthors that contains a list of authors, for example John Doe, Barack Obama,... How can I write this content to a file, for example authors.txt. The command \immediate\write\myfile{\printauthors} doesn't work. Am I doing…
konewka
  • 377
2
votes
0 answers

Alternative to Morewrites

Is there an alternative to morewrites? Using the glossaries package for different types of lists, as well as lstlisting package has put me over the maximum writes number, however, I cannot seem to load morewrites as it is throwing many "invalid…
1
vote
0 answers

How to escape before saving to a file?

I'm trying to create a command that will be able to save plain text to a file (without any TeX commands): \documentclass{article} \begin{document} \newwrite\xwrite \newcommand\tofile[1]{ \immediate\openout\xwrite=foo.txt\relax …
yegor256
  • 12,021
1
vote
1 answer

How to \write content with backslashes to a file?

The following MWE works as I expect but when I make certain changes I get errors: If I introduce say \textbf{something} within a \solution{} say \solution{\textbf{xx}}. If I change \theenumi to \textbf{\theenumi} Probably both issues are the same…
Geoff
  • 2,637
1
vote
1 answer

TeX-file output another TeX-file

My problem, is to generate some .tex-file from within another .tex-file. The origin of problem is to extract some information from scientific paper, and create another .tex->.pdf-file with data about authors and so on. My MWE now work with using…
sergiokapone
  • 5,578
  • 1
  • 16
  • 39
0
votes
1 answer

\write command generates "incomplete \iffalse" error

I'm using LaTeX to generate a 100 pages document. Every page is basically a different randomly generated identity. At the end of every page, I use the \write command to write some datas that I generated in an external document. When the compiler…
il mietitore
  • 702
  • 1
  • 5
  • 19
1
2