General ⇒ Create multiple Output Files
-
- Posts: 4
- Joined: Fri Oct 05, 2012 9:51 pm
Create multiple Output Files
I have a problem and I hope someone can help me.
Imagine I have created a standard document with a line that says something like "The index is: " and connected LaTeX with another program that puts different index figures depending on a dataset. Now I want to compile a PDF for every figure. Is it possible to write such a routine and if so, how?
Thank you very much!
Ruediger
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
-
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm
Re: Create multiple Output Files
-
- Posts: 4
- Joined: Fri Oct 05, 2012 9:51 pm
Re: Create multiple Output Files
First of all: That is good news!
I use the sweave package in R and want to generate mass reports with latex. This combination works as follows: I have a database in R and calculate Correlations and so on. The sweave package makes it possible to execute R Code in Latex so u have a dynamic (if the database changes the figures and tables and graphs adjust automatically) document.
What i want to do is creating an loop like
i = 1 to 6
Index(i)
next i
create document 1 with index 1 at position a
create document 2 with index 2 at position a
...
that generates me a pdf document für all 6 different index figures.
i hope i could make myself clear!
cheers!
-
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm
Create multiple Output Files
Code: Select all
#! /bin/bash
for i in {1..6}
do
echo > document_${i}.tex "\\documentclass{article}
\\usepackage{graphicx}
\\begin{document}
\\includegraphics[width=1in]{image_$i}
\\end{document}"
done
Note that it might work to use single backslashes in the above; I escaped them just in case, as I know that some shells will expand, say \n or \b into a special character, and my version of bash expands both options the same way.
-
- Posts: 4
- Joined: Fri Oct 05, 2012 9:51 pm
Re: Create multiple Output Files
thank you! this is a good start.
Since i am a bit disappointed that i could not make myself clear i try it again!
I have a dataset say with 200 different companies.
I create a latex template file like:
"Hello, this is your report!"
"Your company has an Index of [blank]" and
"The correlation is [blank]."
Instead of [blank] i insert "R" code. With this code i go into the datasete and look for the appropriate company-subdataset and calculate the [blank]-Values. I do that for, let us say, 200 companies.
What i want to achieve is to get 200 Reports saved in 200 pdfs automatically.
My R code has the structure like:
select company(i) in the dataset
apply indexfunction
(this is not real r code just to explain what it does).
thank you very very much for helping me!
ruediger!
-
- Posts: 4
- Joined: Fri Oct 05, 2012 9:51 pm
Create multiple Output Files
For all who are interested in this topic.
I just found this: http://learnr.wordpress.com/2009/09/09/ ... e-reports/
Since there is a way to compile Latex documents out of R it should not be difficult to build a loop around it.
I will be back as soon as problems occure!
ruediger
-
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm