Questions tagged [write]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
27 views

How can I use \iow_now:Nx with umlauts/unicode?

I do some file writing with expl3 but also need the Nx version, which collides with the usage of umlauts. The Nn version handles the umlauts correctly but doesn’t expand the token list for writing it ...
0
votes
2answers
23 views

Show reference at begin of document with conditions

I'd like to show some reference at begin of document with some conditions. Here is the example code \documentclass{article} \usepackage{hyperref} \newcounter{ctest} \setcounter{ctest}{0} \...
0
votes
1answer
29 views

Biblatex: Writing the output of \thefield{…} to a file

Short question: in Biblatex, how do I print the (string) field contents to a file? When processing an entry I would like to do something like this: \write\file{\thefield{userc}}% the file contents ...
0
votes
1answer
26 views

Table with foreachloop as writeout in a external textfile

I create a table with 2 foreach-loops. Now I would like to have that as a textfile too. But there are some if-decision. How to use newwrite correctly here? \documentclass[]{article} \usepackage{tikz} ...
2
votes
2answers
35 views

How to use % inside \write18 command?

I'm doing this: \documentclass{article} \begin{document} \write18{echo '100%' > hash.tex} \input{hash.tex} \end{document} However, this doesn't work (doesn't compile). What is the workaround?
0
votes
1answer
30 views

newwrite: Adding text to a existing outfile

I have \documentclass[a4paper]{article} \begin{document} \newwrite\myoutfile \immediate\openout\myoutfile=\jobname-myoutfile.txt \immediate\write\myoutfile{ aaa } \immediate\closeout\myoutfile \...
0
votes
0answers
30 views

Using l3file to append to a file

The code below overwrites erwlog.tex with %pdfdate:202004[more digits] Hello, world! How can I make it append instead? PS: What's wrong with 1.a? How to meet the requirement of 2.a? \documentclass{...
0
votes
0answers
52 views

Writing to custom ouput file with lualatex: Hook to start of the writing process and substitute not-fully expandable macros

I am working on writing document with informations, that are at the end of each part summarized in summary. To prevent writing them twice, I am using datatool to create "buffers" in runtime, from ...
-1
votes
1answer
25 views

Failing to write to file and input the same

\documentclass{minimal} \usepackage{etoolbox} \newwrite\tempfile \makeatletter \let\features\@gobble \makeatother \newcommand{\feature}[1]{% \expandafter\def\expandafter\features\expandafter{\...
2
votes
1answer
147 views

Verbatim write in Plain TeX

I am trying to write verbatim text into a file in Plain TeX. In LaTeX I could use the verbatim package. My goal is using Asymptote in Plain TeX. So I need something that works like \verbatim@start ...
0
votes
1answer
18 views

\newwrite, pgfplotstable: Put generated rows together to one pgfplotstable (follow-up question)

I get a Code from @egreg that create rows in outwritten textfiles in a loop. I need to put all these rows together in 1 pgfplotstable, that means something like \ifnum\the\filecount=1 \...
1
vote
2answers
39 views

\write and pgfplotstable: Adding \pgfplotstableread into \loop goes wrong

I get a code from @DavidCarlisle, that generate output-txt-files, and I want to put all the outputfiles in a pgfplotstable together. So I try adding \ifnum\the\filecount=1 \pgfplotstableread[col sep=...
1
vote
1answer
83 views

Writing expanded macro with space to file

I'm trying to write an expanded macro to a file without the expansion eating the space after it. I could replace the {} empty group with an explicit \space, but I want this to be fairly robust. Is ...
2
votes
1answer
157 views

Verbatim LaTeX content of an environment exported to an external file

Is there a way to export the content of an environment to an external file without blocking the action of the environment ? Typically in the following example, I would like to keep the content of the ...
1
vote
1answer
53 views

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 \...
1
vote
2answers
56 views

Writing into a file, strange behavior with expansion

I want to write some data into a file, but I need to replace a subtring in these data beforehand. For some reason, the expansion through the \write macro does not give the expected result. Instead, a ...
1
vote
1answer
73 views

writing functions and wrapping commands for abstraction

Can i write a little function (or macro or whatever) that wraps two commands (functions?) into one; united under a single alias? Specifically I want to wrap \input{} and \includegraphics{} into a ...
0
votes
1answer
70 views

Directly input a sage file in a sagetex block

Is there a command similar to \lstinputlisting with sagetex, which would import directly a .sage file in the relevant block, and have it evaluated by sagetex? If not, how would one write such a ...
0
votes
1answer
62 views

Add created parameters in child file to main.tex

My code/idea from 2 topics: Input a parameter from another file filecontents: select rows of group to display File parameters.tex: \documentclass{article} \usepackage[utf8]{vietnam} \usepackage{...
2
votes
1answer
52 views

`\unexpand\expandafter` add spaces : how to append a text at the end of a file

I'd like to append code to a file containing latex code... So I tried the solution proposed here, but unfortunately it fails when there are backslash in the file: How can I open a file in "append&...
0
votes
0answers
43 views

Tutorial: Low-Level Basic Implementation of an Asynchronous Table of Contents?

Closely Related: - Mimicking LaTeX's "table of contents" functionality Using documentclass{minimal}, what is the shortest way to write a low-level asynchronous Table of Contents, (...
2
votes
1answer
79 views

Write file content obeying whitespace using expl3

I want to create a control sequence using expl3 to write file content while obeying whitespace. So far I have the following MWE which does write to file, but ignores whitespace. \documentclass[]{...
5
votes
2answers
1k views

\immediate\write with plain text

I have read the question in TeX.SE, but I don't want user to add ^^J manually. That is, I want writer to output content originally. \documentclass{article} \begin{document} \newwrite\file \immediate\...
0
votes
1answer
70 views

remove space after writing a command when using \write

I'm writing a macro to write commands to a file. These commands are supposed to be read when building my document. The lines I use to write to the file is : \newwrite\outtest \immediate\openout\...
1
vote
1answer
70 views

Is this possible to fix this requirement (explain briefly in this question)?

My code is as follows: \documentclass{book} \usepackage{lipsum} \begin{document} blah blah blah blah blah blah \lipsum[1-2] \begin{figure} \includegraphics{...eps} \caption{caption text} \end{...
0
votes
0answers
101 views

Get path of (custom) auxiliary file when `-output-directory` flag is given to pdflatex

In short: Say the following is built using pdflatex -output-directory=tmp: \documentclass{article} \newwrite\fileHandle \immediate\openout\fileHandle=outfile.csv \immediate\write\fileHandle{hello ...
2
votes
2answers
65 views

kpfonts error with environ package and \write

Minimum Working Example \documentclass{article} \usepackage{kpfonts} \usepackage{environ} \makeatletter \AtBeginDocument{% \begingroup \newwrite\@bibmeta \immediate\openout\@...
0
votes
2answers
111 views

using \newcommand with \immediate\write inside beamer

I'm trying to write some strings to an external file using the \immediate\write as in the MWE below \documentclass[a4paper,9pt]{beamer} \begin{document} \begin{frame}[plain] %< comment out for ...
-1
votes
2answers
98 views

Re: Lack Of Optional Argument Makes 1st Item Of Environment Get Executed As If It Were Optional Argument

\documentclass{article} \usepackage{verbatim} %\usepackage{fancyvrb} \usepackage{xcolor} \usepackage{xkeyval} %RE: LACK OF OPTIONAL ARGUMENT MAKES 1ST ITEM OF ENVIRONMENT GET EXECUTED AS IF IT WERE ...
2
votes
1answer
141 views

Why does \openout produce output in plain tex when it does not in latex?

This is a follow up question of this question. Why this plain code (from shreevatsar's answer) \newwrite\outfile \openout\outfile\jobname.out \end produce a page but this (equivalent) latex code ...
1
vote
0answers
57 views

\write : maximum lines'

In the ledmac documentation, Peter Wilson wrote that, when writing to the .end file (which stores the endnote), it transforms all spaces to line breaks. We change \newlinechar so that in the ...
2
votes
1answer
60 views

Missing } error from multiple “\immedite\write”s within a foreach loop; the current plot has no coordinates error with gnuplot

I suspect that these errors are coming from a section of code in which I loop through a master data file and restructure it so that I can give the newly made file as an argument to pgfplots. If I ...
2
votes
2answers
212 views

How to perform a replacement on a string before doing a \write?

I'd like to output LaTeX code to a file, with the caveat that all backslashes are doubled (ie, \ is replaced with \\). This output will be consumed by another program. I've adapted egreg's answer ...
2
votes
0answers
164 views

Write fully expanded macros to auxiliary files

Considering the following code snippet: \documentclass{article} \usepackage{xparse} % \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \NewDocumentCommand{\edeftest}{m}{\edef\test{#1}#1} \...
0
votes
0answers
59 views

Write out an unbalanced brace to a file [duplicate]

I want to know if it's possible to write out the line \def\TEMP{ to a file, and then later write } to close the brace-pair in the written file? Essentially I'd like to do; \documentclass{article} \...
3
votes
3answers
811 views

Write accented characters to file using \write

I am trying to output some information to an auxiliary file using \write and among other things I have authors names that often include accented letters. If I use the string explicitly, the accented ...
1
vote
1answer
225 views

How to check if the footnote mark appears on the same page of the footonote text?

For my typesetting purposes I need to check if the "footnote tag" appears in the same page of (the beginning of) the "footnote text". Sometimes indeed, it happens that, e.g., I have the footnote tag ...
2
votes
1answer
39 views

Layout and export URLs

I use LaTeX for technical documentation of test-scenarios of a software system. The idea is as follows: I write a test scenario in LaTeX. In this test-scenario, I use pieces of data that are ...
0
votes
1answer
94 views

\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 ...
1
vote
4answers
686 views

How to use color and symbol at the same time?

How can I write in LaTeX, for example: \sanela{} but in red color? I typed \verb|\sanela|\{\} but it seems like a lot to type? How to add color red here?
8
votes
1answer
229 views

Write dynamic command name to an auxiliary file

I have a collection of latex documents. I want to output some latex commands to an auxiliary file corresponding to each document. All these aux files will be later used (along with their TOCs) to ...
9
votes
1answer
210 views

TeX's \write command sometimes induces a spurious vertical space

in the process of debugging a problem with FiXme (reported by Lars Madsen), I fell on this issue which I'm afraid is beyond my expertise. Consider the following MWE: \documentclass{memoir} \...
2
votes
2answers
459 views

How to escape a list of underscored filenames efficiently?

I am thinking how to read a CSV file which has filenames which have underscores efficiently into a LaTeX variable. I think reading the raw variables into a variable by input and then manipulating ...
3
votes
1answer
156 views

Writing a % to a file [duplicate]

I'm writing a macro to write some commands into a text file. This text file is supposed to be read later to execute some macros. The macro : \documentclass{article} \begin{document}% \newwrite\...
0
votes
0answers
49 views

How to modify the environment and command possible write the content in a file through the \write command?

I want to "generate/convert" my .tex files into xml format while compiling LaTeX. I don't want to modify the tex files, I want to generate the xml file trough the \write command based on the DTD while ...
6
votes
2answers
266 views

Size limit of an output file

I am designing a set of macros to have exercises in a book and write the answers at the end while typesetting the answers just after the questions in the exercise file. (See MWE for an example). (The ...
7
votes
2answers
97 views

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. \documentclass{...
2
votes
1answer
168 views

Set up dynamic footnote margin (based on footnote numbers on page)

This is a follow up question of Is it possible to declare that the footnote number is right aligned but uses a dynamic width?. I tried to implement the solution given by @wipet on the original ...
5
votes
1answer
413 views

How to \immediate\write with multiple lines?

Using LuaLaTeX with TeXlive 2016, although I imagine that this question applies to nearly anything: I know how to create a file using \immediate\write on a line-by-line basis. But I would like to do ...
2
votes
2answers
227 views

Add line to index file to avoid page number

Is it possible to write custom lines into the index-file? Consider this: \documentclass{scrbook} \usepackage[splitindex]{imakeidx} \makeindex[name=date] \newcommand\dateindex[1]{\index[date]{#1}} ...