Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

3
votes
3answers
80 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
1answer
34 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
0answers
30 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
2answers
97 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
1answer
39 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
2answers
73 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
2answers
64 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
1answer
87 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]...
1
vote
1answer
76 views

filecontents environment cannot change temporary files

\begin{filecontents}{exampleclass.cls} \ProvidesClass{exampleclass} \DeclareOption{testoption}{\PassOptionsToClass{a5paper}{article}} \ProcessOptions\relax \LoadClass{article} \end{...
1
vote
1answer
84 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
1answer
59 views

Missing \endgroup error with ifs nested in foreach and pgf calculations

\documentclass{article} \usepackage{pgfplots, pgfplotstable} \usepackage{filecontents} \usepackage{indentfirst} \usepackage{amsmath} \usepackage{float} \usepackage{hhline} \usepackage{multirow} \...
5
votes
0answers
172 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. ...
5
votes
1answer
566 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
1answer
116 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 ...
3
votes
1answer
381 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
1answer
69 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{...
5
votes
2answers
445 views

foreach LaTeX input file, output a PDF file

I have a bunch of tables saved in separate files and folders which I have compiled with a master file, commenting the name of each file in the master file one by one and tediously renaming the ...
0
votes
1answer
280 views

Identifying files that contain graphics

I have following code in my article for identifying files that contain graphics. ‎\begin{filecontents*}{example.eps}‎ How should I identify graphic files, if I have more than one of such files? ...
2
votes
1answer
237 views

lstlisting : how to remove unwanted header?

I have a listing that I use to display some code. I use filecontents to specify the content and lstinputlisting to display it. The resulting pdf looks ok (used PDFLaTex), but above my code I get: %% ...
2
votes
2answers
198 views

Longtable with file contents not compiling

I am trying get a simple table like this: I am using longtable as I have data in a .dat files. Can you help me successfully generate the table using the importation of data from a file? Here is ...
1
vote
0answers
106 views

Tikz plot divide by minimun

I want to normalize my plot by the y minimal value. So I want to divide y by y max. I have already done before in Gnuplot with a Perl sentence : ymin1 = `perl -e 'print sort { $a<=>$b } <&...
5
votes
2answers
199 views

Using \input inside environment fails

I'm trying to use the filecontents package in combination with listings as suggested in How to define macro that only makes argument substitution? in order to produce a side-by-side view of LaTeX code ...
1
vote
1answer
312 views

longtable and filecontents inside a newenvironment

I'm trying to create a new environment for longtable enclosed by a filecontents environment. But I'm stuck and don't know exactly how to solve my problem. \documentclass[a4paper,parskip]{scrartcl} \...
3
votes
1answer
95 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 ...
0
votes
0answers
49 views

\addbibresource doesn't work with file contents [duplicate]

I want to cite using the \filecontents command for the books. But it doesn't recognize the books. It only shows the keyword in bold. It says citation "elch" is undefined \documentclass[12pt]{...
1
vote
1answer
62 views

A standard UN*X tool to pack a bunch of files in filecontents environment?

I was looking for something like: filecontents *.sty | cat - main.tex > newmain.tex It should be easy to write a script that iterating over its arguments, would wrap each in a filecontents ...
14
votes
2answers
433 views

Why can't filecontents work in a macro

I am trying to output some text in a file. I use filecontents and it works nicely. However, if I put the filecontents environment inside a macro, it only ouputs the comments but not the text when the ...
7
votes
2answers
164 views

Applying and doing math on two functions read from a file using pgf

I'm trying to read two functions of x from a file, and then get the result of f(8) / g(8) using pgfmathparse. Here is a minimal (not) working example: \begin{filecontents}{data.dat} f(x) g(x) x ...
1
vote
1answer
128 views

Help LaTeX with Windows not flushing file cache in time when using filecontents.sty

Casually, I run into trouble while using the filecontents package: LaTeX complains that the data file created by the filecontents environment is not writeable: LaTeX Warning: Overwriting file `./data....
6
votes
1answer
559 views

Generate Tikz tree from filecontents

Is there an easy way to create tree nodes from data in a file? I need the tree to have nodes in the format 1,2,3,4 rather than 1,2,4,8 etc. I can't create the nodes in a loop as there would be two ...
4
votes
1answer
186 views

Concatenating files created with filecontents

I am creating a large number of data files "on the fly" using the filecontents package. I need to be able to concatenate these files in various permutations For example in the MWE below, I would ...
4
votes
1answer
972 views

filecontents can't update my bibliography database

It seems that when I modify the content of filecontents, it will not update the corresponding files auotmatically by compiling. Here is an simplified example: \documentclass{amsart} \usepackage{...
1
vote
0answers
116 views

Deleted Main.bib using filecontents while trying to enter citation involving mathematical treatment [closed]

Ok. I feel pretty stupid but I was trying to find a solution to using mathematics in bibliography. I ended up using the following example in this forum that used filecontents. Help with math symbols ...
1
vote
1answer
714 views

Enumerate pattern: 1, 1, 2, 2, 3, 3, … , etc

This is a follow-up question to answers sometimes in test, sometimes in answer file. I went with what the best answer suggested and surrounded each question and answer by \begin{filecontents}{some ...
11
votes
2answers
221 views

filecontents replaces tabs with spaces

filecontents package replaces tabs with spaces. Is there any solution to preserve tabs in the generated file without changing the following code? \begin{filecontents*}{textWithTabs.txt} Aa Bb ...
10
votes
1answer
988 views

Make a “standalone” version of multiple files: all document in one .tex file

Disclaimer: this question is not related to the standalone package. When writing an article, I split the content between several files, to ease the versionning notably. At the time of writing, most ...
6
votes
1answer
219 views

\end{filecontents} and \input{} on the same line

This code generates output that shows contents of excerpt1.tex \documentclass{article} \usepackage{filecontents} \begin{document} Pragraph is starting. \begin{filecontents}{excerpt1.tex} Part that ...
0
votes
0answers
814 views

Biber, TeX Live 2013, and OS X 10.9 [duplicate]

This question is related to the question Tufte-Style Asides. I downloaded caesar_example.tex from Github sources and complied it from TeXShop. The output file caesar_example.pdf does not contain the ...
9
votes
1answer
12k views

Inline Bibliography [duplicate]

I know how to use a .bib file to add BibTex and use that in the main document. Is there a way I can include the bib-file in my latex document and not use an external bib-file?
5
votes
1answer
193 views

Using filecontents inside of xparse

I'm trying to reproduce this using xparse: \begin{filecontents}{sections/autogen/somefile.tex} % Line to auto-produce \begin{myotherenvironment} Do lots of stuff \end{myotherenvironment} ...
14
votes
2answers
369 views

Filecontents and newenvironment issue

I need to write some inlined code on an external file, then load it with listings. I would like to define a new environment, but if I do, filecontents does not save the first line of code (see MWE): \...
7
votes
1answer
530 views

filecontents* cannot write to file in Windows

With the following MWE: \documentclass{article} \usepackage{filecontents,hyperref,listings} \begin{filecontents*}{script.bat} @echo off echo "Hello, World!" pause \end{filecontents*} \begin{...
11
votes
1answer
1k views

Can filecontents write an external file in a parent directory?

Reading Are there any disadvantages of TeX being Turing complete? got me thinking about the potential of .tex files for harbouring malicious code. The filecontents package is used to write external ...