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

learn more… | top users | synonyms

7
votes
1answer
178 views

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

Does morewrites not support filecontents, and can I write body of environment using TeX primatives?

Is there an equivalent way to write the body of my environment to a file without filecontents using TeX primatives? morewrites or filecontents limitation I suspect a limitation that these packages ...
4
votes
0answers
36 views

\write at the beginning of a table cell adds spurious vertical space

If a tabular column of type p (or a few others such as tabularx's X) starts with a write, this inserts some vertical space. MWE: \documentclass{article} %\usepackage{array} \newcommand{\writethis}{\...
1
vote
1answer
45 views

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 ...
1
vote
0answers
36 views

How to use \@writefile without blocking a write stream?

From what I understand, to properly use \@writefile one has to block a write stream, like this: \documentclass{article} \usepackage{lipsum} \begin{document} \makeatletter \newwrite\tf@foo \openout\...
5
votes
1answer
55 views

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

\addxcontentsline causes empty to part of mdframed box before page break

I’m using mdframed to surround an own environment called {myenv} (for this example). And this environment is setup as a trio list and uses \addxcontentsline to write a list of these environments (I’m ...
1
vote
1answer
131 views

Tikz: flow chart how to write label over a line

I'm using tiKZ to design a flow chart. On that FC, I have, mainly, two principal box: a normal rectangle a diamond box (as a decision) On the decision box, I need to write, over the line that ...
3
votes
3answers
304 views

ç doesn't work in \write and \read

In Plain TeX when I do a \write containing ç or Ç in the string it gets expanded generating a lot of code in the output file, which can't be read back. I got this problem when reading a TOC: This is ...
2
votes
0answers
50 views

Converting/Re-Writing Paper in LaTeX from Word [duplicate]

I have a paper that I wrote in Word with accompanied math equations (for my undergraduate level research paper for mathematics degree) and I just am not at all familiar with LaTeX. I was wondering ...
1
vote
0answers
15 views

How do I stop \write and \message from inserting a newline at 80 characters? [duplicate]

I have the following file: \immediate\write16{abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKL 80 char split is right here -><- this is on the next line} \message{...
10
votes
1answer
147 views

Translate \typeout to LaTeX3

The command \typeout{argument} expands its argument and writes the result to the log and the terminal. Writing l3build tests, I sought for an equivalent command in LaTeX3, but only found \iow_log:x ...
0
votes
0answers
34 views

How to duplicate content/vboxes?

I am trying to create exercise and answer environments for lecture notes, where I type \begin{exercise}... \end{exercise} followed by \begin{answer}...\end{answer} within the text. I want to include ...
7
votes
2answers
112 views

\write and \ifmmode

This is related to a previous question of mine (if I understand correctly, \write works a bit like \edef). Consider the following code: \documentclass[varwidth,convert={size=640}]{standalone} \...
5
votes
2answers
66 views

How to expand a register value in a \write argument (plain TeX)?

I am using \write to output table of contents information. While the correct heading counter information apears in the headings itself, the TOC headings have the number of the last heading of a page. ...
6
votes
3answers
184 views

Appendixify: Move selected slides to appendix in Beamer

When working with Beamer I often have slides that I initially write in the body of the presentation, then decide they should be consigned to an appendix. This is also useful when reapplying slides ...
3
votes
1answer
66 views

Macro expansion in \write

I want to use a macro in \write18, but this causes the space after it to be ignored. The following example prints foobar to test.txt, whereas I want it to print foo bar: \documentclass{standalone} \...
1
vote
1answer
37 views

How to enable verbatim environment under self defined environment?

So I want to define an inline environment !foo!, and write foo into an exteral file. Here is my source code: \catcode`!=13 \newwrite\mmtlatexfile \immediate\openout\mmtlatexfile=\jobname.mmtlatex \...
2
votes
1answer
78 views

commands with optional arguments in \write

To extract text from huge LaTeX-files in a safe and controllable manner, I am having LaTeX itself write to a textfile. To retain and adapt some formatting informations and structural elements I have ...
2
votes
1answer
98 views

Writing the size of a Tikz node to a file

I write a program that typesets elements in a Tikz picture. In general the items are not placed correctly. In order to solve this, I was thinking of running a two-stage compiler: the first time the ...
1
vote
1answer
58 views

What process can generate a new write sequence

While compiling a very large document recently in xelatex and tex4ht I have observed that tex4ht doesn't handle write streams the same as xelatex. I am trying to prepare a MWE to troubleshoot my ...
6
votes
3answers
280 views

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

Write absolute pagenumber of a reference to a file by macro

I want to write the absolute pagenumber of a reference to a file. therefore i cant use \immediate\write. The problem is now i think that \write expands its parameters when a page is finished, but then ...
0
votes
0answers
74 views

Creating a question-solution capability

I am trying to modify a question-solution capability that was answered brilliantly a while back here. After each question text, one can freely use \solution to keep the solution directly with the ...
4
votes
2answers
54 views

Empty groups {} when writing environment contents verbatim (but with expanded macros)

In answering this question, I noticed some trickiness regarding empty groups {} in an otherwise verbatim context. Suppose you capture the contents of an environment verbatim (as in that question), ...
3
votes
1answer
76 views

Append verbatim material to a file

I am using the fancyvrb package. I'd like to create a verbatim-like environment that does the following two things: 1) Append the verbatim material as-is to a file that has already been opened. 2) ...
1
vote
3answers
78 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 \immediate\write\...
7
votes
2answers
67 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} \usepackage{...
2
votes
2answers
56 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
1answer
118 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
268 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
89 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
124 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 ...
4
votes
1answer
69 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
130 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
1answer
480 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
139 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, ...
9
votes
1answer
152 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 ...
10
votes
2answers
1k 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
458 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
296 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
344 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 different,...
7
votes
1answer
76 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*} a+...
6
votes
1answer
812 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
112 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. \documentclass{...
9
votes
1answer
651 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} \newcommand{\...
10
votes
3answers
430 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 ...
10
votes
1answer
172 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 \edef\reserved@...
10
votes
1answer
195 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
319 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 ...