Questions tagged [write]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
56 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
16 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
33 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
71 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
112 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
52 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
51 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
67 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
42 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
55 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
41 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
35 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
69 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
741 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
39 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
68 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
82 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
58 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
91 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
95 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
108 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
56 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
53 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
197 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
147 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
43 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
669 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
199 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
37 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
81 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
540 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
218 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
199 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
370 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 ...
2
votes
1answer
132 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
47 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
248 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
96 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
153 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
369 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
183 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}} ...
4
votes
1answer
635 views

bidi, RTL and \write

In order to solve one issue with reledmac in RTL, I made some test with \write and bidi. In the following MWE, only the first \write works. It I delete the \RTL, all the \write work. \documentclass{...
1
vote
0answers
49 views

How to avoid log messages which accidentally look like errors?

TeX errors are conventionally marked by the sequence <LF>!<SPACE>… in log files. However, sometimes one can accidentally get this sequence of characters in a log file even if no error ...
2
votes
1answer
296 views

How does adjustwidth affect \par and \write?

With the following code: \documentclass{article} \usepackage{newfile} \usepackage{changepage} \begin{document} \newoutputstream{info} \openoutputfile{\jobname.info}{info} \section{First} Here's some ...
0
votes
1answer
138 views

Write out # to a file [duplicate]

I'm writing to a file from within my document. At a certain location, I would like to actually write out the character #. I tried something like this: \newwrite\tempo \immediate\openout\tempo=outputo....
0
votes
0answers
92 views

Writing files to another directories [duplicate]

I need to write files in a specific directory on the file system where I have access to. But even if I can write files in the current working directory or any sub-directories, it seems that I am stock ...
3
votes
1answer
84 views

Generating a table with all entries from all over the document

We're working on a technical document where we define messages in different chapter/section all over the document. All messages have the same structure and are displayed in a table. We thought that it ...
7
votes
1answer
258 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
105 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 ...
7
votes
1answer
118 views

\write or \index 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 (for example because it starts with \index), this inserts some vertical space. MWE: \documentclass{article} %\...