General ⇒ Create multiple Output Files
-
- Posts: 4
- Joined: Fri Oct 05, 2012 9:51 pm
Create multiple Output Files
First off: Hello everybody!
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
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
NEW: TikZ book now 40% off at Amazon.com for a short time.

-
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm
Re: Create multiple Output Files
Yes, it's possible---I would use a shell script to do it. Your description isn't specific enough (i.e., it's not clear what you HAVE) for me to process what you have into what you want, otherwise I'd do more.
-
- Posts: 4
- Joined: Fri Oct 05, 2012 9:51 pm
Re: Create multiple Output Files
Hello!!!
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!
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
I'm still not 100% certain what it is you have, but I'll give it a whack:
Suitable modifications of that might do what you want to do (though I'm still not 100% certain exactly what that is...sorry!)
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.
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
Hello!
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!
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
Hi!
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
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
Re: Create multiple Output Files
Yes, that looks like it might work, too. (I know nothing of R; I barely know what it is at all, in fact.) There would also be facilities in Ruby or Python that would make something like this work.