Questions tagged [write-file]
The write-file tag has no usage guidance.
47
questions
0
votes
0
answers
22
views
Write emojis to external file
There's some way to write to external file emojis and accents characters:
%pdflatex or latex compiler
\documentclass{article}
\usepackage[LGR,T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
\...
0
votes
0
answers
29
views
How to write the output in multiple pdf files [duplicate]
Suppose that I want to split the output of my LaTeX document in several .pdf files.
Is there something like:
\fromnowwritetofile{foo.pdf}
some part of my document
\fromnowritetofile{foo2.pdf}
some ...
1
vote
1
answer
37
views
Write page number information to an external text file
Here is page \pageref{here}\label{here}
\pageref{here}\label{here} can get the page number of the current location, I want to write it into a txt file, but writing directly will report an error, I ...
1
vote
1
answer
47
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
1
answer
46
views
Writing properly escaped strings to a file
I have to write a properly (as in JSON or Javascript) escaped string to a file.
My minimal example is
\documentclass{standalone}
\begingroup
\catcode`<=1 \catcode`>=2
\catcode`{=12 \catcode`}=...
1
vote
0
answers
63
views
Automatic creation of caching directories
The following MWE writes a cache file to the tikzcache directory
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize
\tikzsetexternalprefix{tikzcache/}
\begin{...
0
votes
1
answer
177
views
DeclareTCBListing and write percent a file
I don't understand why the environment mytcblisting fails when writing the percentage symbol, I tried with verbatim ignore percent but it didn't work, I get the error:
! Missing \endcsname inserted.
&...
2
votes
2
answers
125
views
How to replace a line in a file written by TeX' \write command
I try to write some content in an external file using TeX' \immediate\write command.
\documentclass{scrartcl}
\begin{document}
\newwrite\tempfile
\immediate\openout\tempfile=lists.tex
\immediate\...
0
votes
1
answer
80
views
create command to write with filecontents
What's the most efficient way to do this?
\begin{filecontents*}{./weekly/week07.tex}
% Week 7
\section{}
\end{filecontents*}
\begin{filecontents*}{./weekly/week08.tex}
% Week 8
\section{}
\end{...
2
votes
1
answer
78
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&...
1
vote
0
answers
6k
views
! File ended while scanning use of \@writefile
I am getting below error when I am running the report to generate the PDF from GUI. I am using Texmaker 4.4.1. I also tried deleting aux files and other unwanted files. but, it is not helping me ...
1
vote
0
answers
70
views
How to store multiple fragile definitions for re-importing later
I'm posting this in case it's useful to anyone; it's not actually a question.
Commands defined inside environments like enumerate are automatically fragile, and are lost outside the environment. ...
3
votes
1
answer
321
views
How to use many \write to write text on just one line?
I have to use many write commands to write to the temporary file as follows
\newwrite\tempfile
\immediate\openout\tempfile=tempt.txt
\immediate\write\tempfile{data 1}
\immediate\write\tempfile{data 2}
...
1
vote
0
answers
431
views
I get this error even for the simplest code: I can't write on file `file.pdf'. \begin{document}
I have Texstudio and MiKTeX. Everything was working fine and suddenly it didn't. I tried undoing the recent changes and compiled it still no luck. Finally, I wrote a "hello world" code. It couldn't ...
3
votes
1
answer
540
views
How to get relative position of text in a latex produced document
I am trying to write a custom command eins such that when you have
\eins{id}{text}
, it outputs the relative box position and depth and height of text in mm (or points) within the printed document ...
2
votes
1
answer
1k
views
\renewenvironment{document}
I would like to use \usepackage{filecontents} to write another version of my document to a file later with \write18 and compile it.
My question is: How do I create a custom \begin{document} to ...
2
votes
1
answer
132
views
Polyglossia's babelshorthands spoils write-to-file command behavior and conflicts with graphviz
Example (run xelatex a.tex -shell-escape twice, or just xelatex a.tex if you don't have dot installed and then explore generated files manually):
\documentclass{article}
\usepackage[pdf]{graphviz}
\...
5
votes
1
answer
458
views
Write special characters to (aux) file
I would like to print a special character to an aux file. In particular, I would like to write the line
\@input{file.aux}
So far, I have achieved the best result with
\write\@auxout{\unexpanded{\@...
0
votes
1
answer
2k
views
Runaway argument after Table error
I'm somewhat of a Tex beginner, but I've been running into this problem a lot lately, so I'm really hoping for some help.
I have a large table in the appendix of my file, and it caused me quite a bit ...
2
votes
2
answers
136
views
PdfLaTeX's \write into file for cyrillic with utf8 gives unwanted \cyr
Thanks to egreg, I have a possibility to write authors names from \authblk to file for the follow usage.
\documentclass[twocolumn, oneside]{article}
\usepackage[utf8]{inputenc}
\usepackage[english, ...
2
votes
1
answer
514
views
How to write authors of an article to the file?
I have a macro \writetitletofile which is write title of the article to the .dat file. How can I do the same with authors of an article. It should be noted that list of authors create with authblk ...
1
vote
0
answers
191
views
Package morewrites kills tikz's opacity/transparancy [closed]
I made the strange observation that including the morewrites package removes opacity colours in tikzpicture.
(The code of this example is given below.)
As opacity problems with tikz package are ...
5
votes
1
answer
396
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. ...
2
votes
1
answer
318
views
Token list with line breaks for writing multiple lines to file
I make use of a package (gnuplottex) that writes contents of an environment to a file, using the \verbatim@start/processline/end commands (by \immediate\write\FileHandle{\the\verbatim@line}). Now I ...
7
votes
2
answers
716
views
Reading number from file into variable -- How to put a number into my document that increments with every compilation?
I am not that much into TeX/LaTex programming ...
but what I want to do is the following:
How to put a number into my document that increments with every compilation
My ideas so far are:
use a ...
6
votes
1
answer
139
views
LuaTeX readline encoding
Must LuaTeX's \readline use latin-1 encoding?
In the example below, I first store é in a file (well, and ^^J) which works well. Then I read it back in, using \readline and get two characters é (and ...
5
votes
2
answers
148
views
add lines into tex file
I have this tex file coming from matlab.
\begin{tikzpicture}
\begin{axis}[%
width=\figurewidth,
height=\figureheight,
scale only axis,
xmin=1,
xmax=5,
ymin=2,
ymax=10
]
\addplot [color=red,line width=...
5
votes
3
answers
1k
views
Creating my own \tableofcontents in plain TeX
I'd like to define my own table of contents in TeX (not LaTeX, so without packages) to have a fine control on what goes there, how the numbers are displayed, etc. Basically what I would like is to ...
2
votes
2
answers
603
views
How to write Russian text in a file?
I am writing Russian text in a file but it gives the error.
\documentclass{article}
\usepackage{amsmath}
\usepackage{amscd}
\usepackage[tableposition=top]{caption}
\usepackage{ifthen}
\usepackage[...
9
votes
1
answer
747
views
Encoding of written out files
I have a tex file with:
\usepackage[utf8]{inputenc}
The file calls a macro that saves the content between and \begin{something} and \end{something} to a file. But the encoding of the file is not ...
13
votes
1
answer
500
views
How to actually close a write-stream
I don't know too much about writing and reading to and from files. But I managed to create a nice command for me where I need to write something into a text-file and later-on read it again.
\...
6
votes
1
answer
135
views
How to output environment content to a file while enclosing content by a box?
This is the source:
\documentclass{article}
\begin{document}
\begin{obj}{name-of-obj}
This is a test code.
\begin{equation}
a < b
\end{equation}
\end{obj}
\end{document}
I want to enclose the ...
8
votes
1
answer
289
views
Writing environment content verbatim to file, calling Graphviz and including source/image
Based on Write environment body verbatim to a file I try to write the content of a environment verbatim to a file, call an external tool (in my case the awesome Graphviz) and include the source code ...
11
votes
3
answers
349
views
How to read a character one by one from an external file, modify it, and save it back to another external file?
The purpose of this question is to learn how to read character by character of a fetched line of characters, modify it and save back to another file.
For the sake of simplicity, let's take a simple ...
5
votes
1
answer
137
views
Listings WriteFile adds additional line if content contains two spaces between words
I use the listings latex package to write/read the environment body to a file. But if in the environment are two spaces between some words, there is an additional linebreak added at the beginning (I ...
11
votes
3
answers
2k
views
Space after command with \write
I did not see this question yet, correct me if there is.
It's not the usual problem of adding a space after a command. It's more specifically when writing to a file. For some reason the same method ...
9
votes
1
answer
4k
views
How to copy contents of one file to another?
So I have a .txt-file and I need to import the data line per line. That works like it should. I need however to adapt the contents loaded into a command an write it to another .txt file that later ...
6
votes
2
answers
1k
views
Accent characters incorrectly written external file
I tried to write some strings in an external file for use in a special type of index, but using utf8 accented characters appear wrong.
In my external file, those characters appear in the same way as ...
4
votes
1
answer
157
views
listing's lst@BeginWrite gobbles '->' and '=>' from input [closed]
I'm trying to write a package that takes verbatim input and appends it to several files. My current approach is based of off an answer by Martin Scharrer to a similar problem. The difficulty arises in ...
8
votes
1
answer
1k
views
Help wanted on \openout, \write and \closeout
Is there a way to test if a token is already associated with a writer? Something like this:
\def\do@write#1{%
\immediate\write\mywriter{something: #1}%
}
\def\@writesomething#1{%
{\if@isopen\...
26
votes
2
answers
2k
views
Write environment body verbatim to a file
How can one write the body of an environment verbatim to an external file. I tried the following but get problems if the body contains undefined macros (error) or e.g. a % (disappears in the output).
...
13
votes
4
answers
1k
views
How can I write % into a file?
How can I write % into an auxiliary file? % will not work, because LaTeX thinks that I start a comment with it (in the main file, not in the auxiliary file!), and \% will write \% into the file. How ...
3
votes
1
answer
2k
views
Is it possible to change jobname from within the input file? [duplicate]
Possible Duplicate:
How to influence the name of the pdf file created with pdfLaTeX (from within the source code)?
I have a template as follows.
% template.tex
\documentclass{article}
\...
6
votes
1
answer
2k
views
How to append data to a temporary file?
I want to create a new temporary file (named main-temp.tex), append data to it multiple times, and import the contents later. I haven't learnt how to use TeX file operation, both reading and writing. ...
2
votes
0
answers
144
views
How to automatically increase the number of \write registers? [duplicate]
Possible Duplicate:
Making efficient use of \writes
I am trying to compile a document that heavily uses PGF/TikZ externalization as well as a table of contents, list of figures, etc. I am ...
6
votes
1
answer
578
views
Could you give me a working, dangerous LaTeX input file to test the vulnerability of my server?
I have an IIS web server on which I installed Miktex distribution.
I host a site that allows users to submit LaTeX input codes. The server then compiles the input using pdflatex.exe to produce a pdf ...
9
votes
1
answer
2k
views
How to write the \columnwidth to an external file
Some figures in my LaTeX document I am generating with Python. Normally I manually check how wide my picture can be with \showthe\columnwidth and adjust the image width accordingly. (This whole is ...