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

learn more… | top users | synonyms

1
vote
3answers
32 views

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 ...
6
votes
2answers
44 views

How to 'robustly' use file contents in command arguments?

I have the following code which sets up a XeLaTeX document (to be run with --enable-write18) and defines two commands, \showme and \prRaise: \documentclass[a4paper,oneside]{memoir} ...
2
votes
2answers
40 views

Pattern to detect need for recompilation from auxfile

I am using an auxfile to access the results of some computations which I need before they can actually be computed. Since this requires two runs when something changes the result I would like to have ...
1
vote
0answers
29 views

Evaluating \luaexec while writing to the aux file

In the document end hook I'm trying to write \luaexec{x = 1} to the aux file, where the 1 is computed in Lua itself (and more complex in the real document, of course). MWE: \documentclass{article} ...
14
votes
2answers
180 views

Is there any way to interact with the shell but keep the same session open?

I'm preparing some course material (PDF) for a tutorial that involves the Unix command line. Because I strive for automation (some call that laziness), I've written a little package that allows me, ...
6
votes
1answer
42 views

Write reference of linenumber to file

I want to write the actual linenumbers that a \lineref command generates into an external file. The lines are referenced correctly (after 2 times compiling), but the writing to a file does not work. ...
3
votes
1answer
107 views

A templating system in LaTeX [closed]

I need to generate quite a few LaTeX files in an automated way. I do not want to use any templating engine in Python or Elisp (two languages I'm probably most comfortable with); I'd prefer to do it ...
3
votes
1answer
41 views

Replacing some macro tokens in a list before \write ing

I'm trying to hack a bibliography package (amsrefs), and fall into the following problem. I'm trying to convert the amsrefs format back to .bib files. This doesn't quite work, because strings get ...
4
votes
1answer
41 views

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 ...
6
votes
0answers
214 views

TeX engine can't write on hidden aux files in Windows

To make my latex folder clean, I tried to hide all auxiliary files with the following DOS command: attrib +S +H *.aux ...... attrib +S +H *.toc But when I tried to compile my latex file again, ...
4
votes
2answers
94 views

Generate file write handles on the fly

I am experimenting a little bit with automatic generation of file handles via \newwrite. I want to achieve following behaviour: A user provides a list of file categories, for example Hints, ...
5
votes
0answers
68 views

Difference between morewrites and scrwfile

I have tested morewrites and scrwfile in my template which uses so many writes that without loading any of those packages I would run into the no room for new \write problem. I find that with ...
7
votes
1answer
360 views

debug No room for a new \write problem

I have a template with an extensive documentation. (See TemplateDocumentation.pdf). It compiled several month ago. Now with updated packages it does not compile anymore because of the famous No room ...
9
votes
2answers
219 views

Adding newlines while writing text to a file

Within a custom command, I'm doing the following to write to a file: \newcommand\mycommand[1]{ \newwrite\file \immediate\openout\file=foobar.tex \immediate\write\file{ foo bar #1 ...
2
votes
0answers
191 views

Alternative to Morewrites [closed]

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 ...
7
votes
1answer
212 views

Writing \\ to a File

I have a local class that a number of people use. One of the new things I want it to do is write out various user-defined data to a file, so that a follow-up LaTeX document can do something ...
7
votes
1answer
61 views

How many times is “align” processed?

Consider the following MWE which writes the word "Cat" to a file. \documentclass{article} \usepackage{amsmath} \begin{document} \newwrite\datei \immediate\openout\datei=Beispiel.txt \begin{align*} ...
6
votes
1answer
449 views

At which point does \immediate\write write to file?

Assume I have opened a file myfile and write to it with \immediate\write\myfile{My cat is too old} I have multiple such statements in my document and do calculations in between which influence the ...
3
votes
1answer
86 views

Modify the stored value of enumeration in output file

This question is in reference to a previous question: Write the value of enumerate to output file. I would like to take the solution one step further, but I couldn't get it to work. ...
9
votes
1answer
572 views

Write the value of enumerate to output file

I would like to save the present value of an enumeration into an output file. Using information from another question I have the following minimal example: \documentclass{article} ...
9
votes
3answers
310 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 ...
8
votes
1answer
118 views

Is there any side effect in using \immediate in the definition of \protected@write?

In latex.ltx, \protected@write is defined as: \long\def \protected@write#1#2#3{% \begingroup \let\thepage\relax #2% \let\protect\@unexpandable@protect ...
10
votes
1answer
145 views

How to write the € symbol into a file, when using Package [utf8]{inputenc}

With the following MWE, I can write the € symbol into the file euro.txt \documentclass{article} \newwrite\tempfile \immediate\openout\tempfile="euro.txt" \begin{document} Write Euro symbol into a ...
6
votes
2answers
256 views

How to redefine commands and environments, and make them acceptable for `\write`

My general problem is the following. I want to "convert" many .tex files into some other format (xml-like). I don't want to modify the tex files, I can only build a documentclass. The texfiles are ...
3
votes
2answers
501 views

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 ...
8
votes
2answers
812 views

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" ...
9
votes
2answers
2k views

How to use an underscore in a filename

With the commands \openout and \write I output text into a file. I want this file to have a name of containing an underscore (eg. name_01.txt), but I'm unable to get the underscore in the filename. My ...
15
votes
3answers
1k views

Writing { and } to a file with LaTeX

How can the special characters { and } be written literally to an external file in LaTeX, without being balanced? Obviously the following does not work: \immediate\write\my@outfile{{} ...
4
votes
2answers
667 views

write macro parameter character to file (#)

During pdfLaTeX processing, I'm writing a string of key-value pairs to an external file. Sometimes the value will contain \# and I want only the # to be written to the file. Here is my code which ...
8
votes
4answers
1k 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 ...
9
votes
4answers
1k views

How to use a \write command inside a \newenvironment ?

I'd like to make a new environment which would store its content in a file, so that I can read that file at another part of the document. More specifically, I want to have an environment {proof} such ...
6
votes
2answers
1k views

“Illegal parameter number” errors, in a macro for writing macro definitions to a file

Problem. I'm trying to write a command similar to \newcommand, but I'm having problems with illegal parameter numbers: for reasons that I can't fix out, it's asking me to use parameters of the type ...
12
votes
4answers
1k views

Making efficient use of \writes

I'm currently trying to compile my thesis using LaTeX and have run up against the old ! No room for a new \write . problem. After some googling it seems the only way to actually resolve this problem ...
10
votes
3answers
920 views

`\write` non-printable ASCII characters to a file

\immediate\write\SomeStream{x} writes x to the file open in \SomeStream. I would like to write non-printable ASCII characters, such as ``, to a file. My naive guess is \begingroup %To keep ...
6
votes
3answers
518 views

Spurious newline in \write

When I \immediate\write\somefile{foo}, TeX writes foo to the file open in the output stream \somefile, but it also goes to the next line. (The resulting file has 4 bytes.) Since I am writing files ...
6
votes
2answers
356 views

Processing the body of an environment multiple times

Dear all, I am new to package writing (LaTeX2e) and to this forum, and I probably read to much of the TeXBook and not enough on LaTeX. My package works, except that verbatim is verboten. Given a user ...
9
votes
3answers
566 views

What are the right rites to \write right now?

(with apologies for the title) I've just entered the murky waters of trying to get one LaTeX file to write out something useful as it goes along. In brief, I want my lecture LaTeX file to be able to ...