Questions tagged [filecontents]
This tag should be used for questions about the filecontents or filecontents* environment. If you only want to refer to the content of other files, use the external-files tag instead.
77
questions
1
vote
0
answers
37
views
How to write Python file from LaTeX document (Windows) [duplicate]
The following code works on Linux and MacOS:
\documentclass{article}
\usepackage{listings}
\begin{document}
\begin{filecontents*}[force]{world.pl}
print("Hello World")
\end{filecontents*}
...
0
votes
1
answer
30
views
Problem with csvsimple and csvrerader. Not every Data type gets show
Here is my code:
\begin{filecontents*}{DateTime.csv}
Gruppe;Date;Time
Gruppe 1;27.05.2024;13:00
Gruppe 2;28.05.2024;18:00
Gruppe 3;29.05.2024;21:00
Gruppe 4;30.05.2024;12:00
Gruppe 5;27.09.2024;22:00
\...
6
votes
2
answers
262
views
How to overwrite files generated by filecontents environment
I am using latex to generate figures, here is a simple example.
\documentclass[
border={0mm 0mm 0mm 0mm}, % left bottom right top
]{standalone}
\usepackage{tikz,stackengine}
\usepackage{pgfplotstable}
...
3
votes
1
answer
152
views
Send command output through filecontents
General situation
In a document I have to mention bibliographic line and corresponding BibTeX blockcode of the document itself.
Then, some fields of the BibTeX code, like title author date, should not ...
1
vote
1
answer
37
views
Store + display text in the abstract environment
I am trying to store the text from the abstract environment to a file + display this text as well.
I tried the following:
\documentclass{article}
\makeatletter
\renewenvironment{abstract}{%
\textbf{...
0
votes
0
answers
32
views
Conditionnal CSV prompting
I'm asking for your help for a specific problem I have no clue about.
My goal is to have conditionnal CSV printed in a table (did not include that print part) :
\usepackage{csvsimple}
\usepackage{...
0
votes
0
answers
115
views
Overleaf doesn't create files specified by the filecontents environment
A new Overleaf project titled Test was created. Upon creation it contained a single file called main.tex. The default contents of this file were replaced by the following.
\documentclass{article}
\...
0
votes
1
answer
78
views
CSV generated with filecontents results in empty table rows when parsed with csvsimple
I just stumbled over an unexpected (or maybe actually not so unexpected) behaviour of csvsimple when feeding \csvreader with CSV data generated by filecontents.
It seems that starting with TeX Live ...
2
votes
1
answer
162
views
File `data.csv' already exists on the system
Why does this Warning appear when using filecontents? :
File `data.csv' already exists on the system.
Does anyone know how i can remove this warning?
\begin{filecontents*}{data.csv}
a,b,c,d
1,4,5,1
2,...
1
vote
1
answer
56
views
Why This Code Eliminating Index Commas Works for \jobname.mst and Not for \jobname.ist
This post is an addendum to How to Universally Remove the Comma from Each Index Entry.
In the link, I was looking for a universal way to remove the comma in each index entry.
Werner advised to include ...
3
votes
1
answer
407
views
Difference Between Filecontents and Filecontents* and When to Use One Instead of the Other
I have recently been experimenting with different ways to replace the comma in the Index with a different symbol. The following code replaces the said comma with a blank space.
\begin{filecontents}{\...
1
vote
0
answers
51
views
Inserting Vertical Space Before Index Heading Items with Filecontents
I recently discovered a seemingly simple way to insert vertical space immediately before new index headings using filecontents---
Consider the code
\begin{filecontents*}{\jobname.mst}
item_0 "\n\\...
3
votes
1
answer
264
views
Suppress filecontents warning if the file is defined before documentclass
I would like to define filecontents blocks before documentclass in my LaTeX document. Is there any way to suppress warning Writing or overwriting file ./filename?
My MWE is as follows:
\begin{...
0
votes
0
answers
24
views
Put the content of a binary file within filecontents environment [duplicate]
I would like to include the content of a binary file within filecontents. Is there any way to do so?
My MWE is as follows:
\documentclass{article}
\begin{filecontents}{file.txt}
CPYA 4,3268 195 ...
0
votes
1
answer
290
views
Filecontents is not recognized
I don't know how, but it seems that this file does not want to be compiled. Why? This is my mwe:
\documentclass{beamer}
\usetheme{default}
\usepackage[frenchb]{babel}
\usepackage[T1]{fontenc}
\...
1
vote
1
answer
399
views
filecontents cannot write my text
i want to save a text to a file using the filecontents package. Here is the source code:
\begin{filecontents}[overwrite]{test.lst}
Hello World!
\end{filecontents}
A file "test.lst" is ...
1
vote
2
answers
232
views
Filecontents inside an environment
I'm trying to write in some external files using the filecontents environment of LaTeX. For this purpose, I created an environment which writes the contents and numbers the file with a counter.
...
1
vote
1
answer
313
views
Metadata with more than one language
I want to use more than one language in the creation of my Metadata. I was looking at the pdfx package documentation. And as I understood it, that would be possible. Based on the information in ...
0
votes
1
answer
139
views
How can the filecontents environment be used with a build directory?
Having updated an old template for a paper I wanted also to clean up the way the document gets built by having a dedicated build directory.
Using TexStudio it works (mostly) by changing:
pdflatex.exe -...
2
votes
1
answer
59
views
Looping over table elements with pgfplots (beamer)?
I am working in beamer with pgfplotstable. I want to produce the following:
\documentclass{beamer}
\usepackage{tikz,pgfplots,pgfplotstable,filecontents}
\pgfplotsset{compat=newest}
\...
1
vote
1
answer
400
views
How can I use makefile to run typeset document with bibliorgaphy?
Recently I was introduced to typeset LaTeX documents with makefile, and I liked that idea. However, when come to the case where I have bibliography, things becomes complicated. First of all, I ...
4
votes
1
answer
368
views
macros/commands inside a filecontents* environment does not expand
i would like to seek your help on the following.
Consider the following MWE1:
\documentclass{article}
\usepackage{filecontents}
\begin{document}
Hi
\begin{filecontents*}{dummy.tex}
some text and ...
1
vote
1
answer
1k
views
Set new filecontents-environment to overwrite globally
I recently updated my LaTeX-Distribution and found out afterwards that the filecontents and ltxtable combination was broken. Only one table was loaded multiple times in my document. Afterwards I found ...
1
vote
1
answer
242
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
0
answers
321
views
Attendance list
In my last question, Reading a student class list, I asked how to read a list of students and create a class list. Everything works ok as @egreg had a wonderful answer. I am now attempting to create a ...
5
votes
1
answer
1k
views
Reading a student class list
Whenever I create a class list of my students, I use the format in MWE below. The problem I have is that I normally have to copy and paste a student name at a time and ensure the table is correct ...
6
votes
1
answer
423
views
How to extend filecontents to append and count lines?
Here are two questions about filecontents environment:
is it possible to add content to a preexisting file or, at a minimum, to keep open the external file to append the content of several ...
2
votes
0
answers
42
views
How to fix incompatibilities between etex package and new filecontents? [duplicate]
Since filecontents is usable into document (LaTeX2e <2019-10-01> patch level 3), the etex package breaks the filecontents new \write...
With TeXLive 2018, the following code is ok:
\documentclass{...
12
votes
2
answers
3k
views
\begin{filecontents}{tabelle.tex} will not overwrite existing file
The old environment (before 10/2019)
\usepackage{filecontents}
\begin{filecontents}{tabelle.tex}
... some text ...
\end{filecontents}`
will overwrite an existing file tabelle.tex.
After my ...
38
votes
1
answer
13k
views
filecontents: This package is obsolete
Why does the following warning show up?
Package filecontents Warning: This package is obsolete. Disabling it and
(filecontents) passing control to the filecontents environment
(...
5
votes
1
answer
1k
views
latexmk unhappy with file that only contains filecontents block
Consider the file
\documentclass[12pt]{article}
\usepackage{filecontents}
\begin{filecontents}{stuff.txt}
Some stuff
\end{filecontents}
\begin{document}
\end{document}
latexmk is unhappy with this ...
1
vote
0
answers
90
views
Merge filecontents and call data from only one file
i have 2 filecontent with different structure: test1.tex and test2.tex.
But i want to call data from only one file (ex:test.tex)
How can i build only one file test.tex that includes data of 2 file ...
0
votes
1
answer
172
views
I can't change contentsname [duplicate]
Ths is my whole code
\documentclass[12pt,leqno, style=sailor,
display=slides,
paper=smartboard,
orient=landscape]{article}
% This works well.
\usepackage[utf8]{inputenc}
\...
3
votes
3
answers
171
views
Append unique characters read from filecontents to a string
I have a list of 2-character strings that is read from table, e.g.
\begin{filecontents*}{attributetools.dat}
Attribute
SL
SK
MC
SL
AA
PT
SK
UP
MC
\end{filecontents*}
I want to create a string that ...
1
vote
1
answer
80
views
Creating a unique list from two tables read from filecontents
I have two tables.. one contains attributes with values e.g.
Name percentage
Atr1 80
Atr2 20
Atr3 50
and the other one contains tools for that attribute
Attribute Tool
Atr1 SK
Atr1 SL
...
0
votes
0
answers
93
views
Select page number of print command of DTLforeach, filecontent?
My last post: filecontents: select rows of group to display
And @Werner wrote brilliant solution for me with command : "print"
His MWE code:
\documentclass{article}
\usepackage{filecontents}
\...
5
votes
2
answers
467
views
What is the difference between storing table data by filecontents and pgfplotstableread?
In this MWE, the table data loaded from poles.dat is successfully parsed as shown in the left plot.
However, storing the same data inside a macro using \pgfplotstableread doesn't result in the same ...
1
vote
1
answer
534
views
Pgfplots - Turn off Box when plotting a File
By default, pgfplots will draw a box around my plot. I am plotting a .dat-File with \draw table [...] {data.dat} and i want to turn that box off and just leave the x- and y-lines instead.
In the ...
4
votes
2
answers
119
views
filecontents non repeating execution of commands
As requested by Merging multiple different tables records. // Splitting table records in tables.
I there is a command that I created (a varaint I found here).
\newcounter{magicrownumbers}
\...
4
votes
2
answers
109
views
Not using optional argument makes environment break
I'm defining a wrapper environment for filecontents so that I can modify its behaviour.
Everything works fine for most of the test cases. For example, I define an environment testenv which takes one ...
1
vote
1
answer
669
views
Remove warning "Tab has been converted to Blank Space."
I get this warning "Tab has been converted to Blank Space." how can I remove it, and why do I get it?
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc} % Gjør det mulig å ...
1
vote
1
answer
263
views
Set PDF/A properties using filecontents package
I would like to provide the follwing class:
\ProvidesClass{pdfatest}[2018/04/12 V0.1 PDF/A Test]
\LoadClass[a4paper,11pt]{article}
\newcommand{\cnumber}[1]{\def\@cnumber{#1}}
\newcommand{\cauthor}[1]...
2
votes
1
answer
307
views
filecontents environment cannot change temporary files
\begin{filecontents}{exampleclass.cls}
\ProvidesClass{exampleclass}
\DeclareOption{testoption}{\PassOptionsToClass{a5paper}{article}}
\ProcessOptions\relax
\LoadClass{article}
\end{...
2
votes
1
answer
287
views
How can I create a subfolder with filecontents?
As shown in this MWE
\RequirePackage{snapshot}
\documentclass{scrbook}
\usepackage{filecontents,biblatex}
\begin{filecontents}{bib/\jobname.bib}
@misc{anything,
author={A. Anyone}}
\end{...
2
votes
1
answer
155
views
Missing \endgroup error with ifs nested in foreach and pgf calculations [duplicate]
\documentclass{article}
\usepackage{pgfplots, pgfplotstable}
\usepackage{filecontents}
\usepackage{indentfirst}
\usepackage{amsmath}
\usepackage{float}
\usepackage{hhline}
\usepackage{multirow}
\...
7
votes
1
answer
577
views
Use filecontents environment to write a binary file
In this answer of mine, I was trying to show how to embed an audio file into the pdf with the multimedia package. The resulting MWE does not stand on its own because it requires an example audio file.
...
6
votes
1
answer
2k
views
Overwriting file warning
Is it possible to suppress the warning generated by:
\begin{filecontents*}
Every time it outputs the warning: Overwriting file 'xxxx.xxx'.
Maybe to delete it before it creates a new one or something ...
2
votes
1
answer
334
views
pgfplotstabel - create table with time column
I try to create a table with a column for date and time from a file data.txt. I can create a diagram but when I type \pgfplotstabletypeset for a table following error occurs:
! Package pgfplots ...
4
votes
1
answer
1k
views
Can the pdfx package use the document title and author?
The pdfx package documentation recommends to use a file \jobname.xmpdata to supply PDF metadata. This can be handled by using the filecontents environment. However, that makes macros useless, making ...
2
votes
1
answer
79
views
Help with longtable renders extra field
So I have a problem because my longtable seems always render one extra field in my table.
Depending on where I put my \ it renders after it goes through the csv or before.
My code is:
\documentclass{...