Questions tagged [write]
{write} is about writing to files in TeX macros.
179 questions
2
votes
2
answers
67
views
expl3: l3file: \iow_now:Ne... doesn't expand tokens before writing to the stream?
MWE:
\documentclass{article}
\begin{document}
\ExplSyntaxOn
\iow_new:N \g__test_iow
\iow_open:Nn \g__test_iow { test.pl }
\iow_now:Ne \g__test_iow { \# }
\iow_close:N \g__test_iow
\ExplSyntaxOff
\end{...
3
votes
1
answer
119
views
Writing result of a non-expandable command
I have a token list that includes (at least) one non-expandable command (defined by \NewDocumentCommand) and want to write the result to a log file (lets assume the critical command generates ...
0
votes
0
answers
43
views
wrapping a \item inside another command and writing to file has unexpected behavior when input
I am currently trying to write a pair of commands, the first can be used repeatedly (with different arguments) and writes out to a file, the second inputs the file with some custom wrappings. This has ...
0
votes
0
answers
49
views
How to record the location of each rectangle
The following code renders a paper test and attempts to write out an answer file with
the location of each answer, so an autograder can pick out each answer, scan it in and try to grade.
The answer ...
0
votes
0
answers
113
views
Patching \cref and \Cref to write additional information to the .aux file
I need to patch the macros \cref and \Cref so that when used like this:
\cref{label1,label2,label3}
besides generating the normal layout in the document, they write something like this to the .aux (...
2
votes
1
answer
159
views
Export all minted code fragments to files
I would like to export all the code fragments of a lectures book I wrote in a ordered tree structure as <chapter>/<section>/<some name or number>.<ext>. the code is in variuous ...
0
votes
0
answers
60
views
Capture text before my command and write it to an external file
I have some LaTeX that's something like this:
Donec id elit non mi porta gravida at eget metus.
Integer posuere erat a ante venenatis dapibus posuere
velit aliquet. Morbi leo risus, porta ac ...
6
votes
2
answers
623
views
How can I use morewrites and memoize?
Consider the following MNWE, which I'm compiling with pdfTeX:
\documentclass{article}
\usepackage{morewrites}
\usepackage{memoize}
\usepackage{tikz}
\begin{document}
\begin{tikz}
\draw (0,0) -| (1,1)...
-1
votes
1
answer
113
views
How can I write this type of "V" in latex in the image below [closed]
How can I write this type of "V" in latex
0
votes
1
answer
69
views
Prevent active character from being expanded in macro argument
Goal: Have an active character not expanded when writing to file
MWE
\documentclass{article}
\makeatletter
% == Package code -- untouchable
\def\foo{\@ifnextchar[{\@foo}{\@foo[x]}}
\...
0
votes
0
answers
181
views
Best practices for \cite and \citep
Imagine that \cite{webb2004oscillations}) and \citep{webb2004oscillations}) yield, respectively
Webb and Owen, 2004
(Webb and Owen, 2004)
When writing a paper, what is the best practice to cite this ...
1
vote
0
answers
57
views
Incomplete \iffalse when using datetime package and \write
Objective
A function that enables me to write custom log data.
The result is the command \writeToLog (see MWE), which writes its input to the file log.txt.
Issue
In my actual document I'm using the ...
1
vote
2
answers
140
views
Macro to define macros within .aux file is not working
Here are some macros that I am trying to define (based on this question):
\odef{foo}{bar} will define an "object" with name foo and value bar.
\objRef{foo} will insert the value of the foo &...
6
votes
1
answer
307
views
Need macro to \write content into a file as a string from LaTeX
We are writing a cls file that produces a text file as a side effect of running latex. This will be done in a cloud service within a docker container, so security is a serious concern. The output file ...
0
votes
1
answer
151
views
Write the contents of a bibliography from thebibliography environment to a file
I need to write contents from thebibliography environment (BixTeX/BibLaTeX are not used) to an XML file. Each bibliographic source should be in a separate pair of <reference> and </reference&...
0
votes
0
answers
137
views
\pageref{} produce wrong page number when \label{} comes top of the page
I am trying to create a para id with page number as a separate file, through a command
\def\paraopenid#1{\label{#1}\immediate\write\paraID{<ParaID="#1" StartPageNumber="\...
1
vote
1
answer
563
views
How to write and expand \gls command to a text file?
Is it possible to expand the \gls command in order to print it's "output" in a text file?
Here a 'MWE.tex' file content:
\documentclass{article}
\usepackage{glossaries-extra}
\...
4
votes
1
answer
139
views
Using the word "write" as a label makes compilation crash
Took me all night (literally) to figure out.
Compilation was failing one time out of two, with the following original error (line 12) : "Bad space factor (0)".
That was crazy because ...
0
votes
0
answers
168
views
How get the result of a macro that uses xstring functions before writing to a file
I encountered the need to write last name with initials (extracted from the full author's string based on first chars of first and middle name) into an external file. I use the xstring package to ...
3
votes
1
answer
199
views
Use \immediate\write18 with Single Quote
I would like to use \immediate\write18 (encoded in the \OuputToFileA macro) to output a string containing a single quote. If I replace the single quote with another character, such as X
\StrSubstitute{...
1
vote
1
answer
76
views
Using \immediate\write18 when lineno package yields spurious text
I am getting spurious text in the output of \immediate\write18 when the lineno package is used. The MWE below yields the following in the file foo.tex:
If one comments out the line that includes ...
2
votes
1
answer
239
views
merge many txt to one
There are plenty of .txt files and I try to figure a way in Latex to merge all *.txt to one *.txt. I thought about \newread and \newwrite but I don't know if there is a better way or how to start.
the ...
0
votes
0
answers
53
views
Tex adding information to txt
Is there any possibility to add Information to a .txt or other type of document?
For example I have the following .tex
\begin{filecontents*}{Info.tex}
@ P & 1 & 60 & 2 & 77 \\
...
1
vote
1
answer
79
views
tex document creat tex document with special content
I want a *.tex document that create a *.tex that content the following lines:
\newread\NoFile
\newcounter{AME}
\openin\NoFile=V/AME.txt
\read\NoFile to \AME
\closein\NoFile
so I looked up in the ...
1
vote
2
answers
83
views
How to automatically protect all the commands passed in an argument?
I need to write to an auxfile some mathematical formulas.
The following MWE does not work:
\documentclass{article}
\usepackage{amsmath}
\newwrite\filehandle
\newcommand{\addToFile}[1]{\immediate\write\...