Dear all,
I was wondering whether it is possible to automatically write LaTeX code using the shell. Let me explain.
I have a statistical program, which creates a couple of hundred graphs using an algorithm. I would now like to put all these graphs together, say each on one A4 page, giving it a title and maybe a short (automated) description. From my statistics program, I can enter the shell and execute commands. I could thus, in my loop, compile a pre-defined latex-file to PDF. What I still need to find out is whether at each iteration of the loop, I could somehow change the file path of the picture that is to be included in the latex file, or set up a new automated latex file altogether.
I would be glad for any suggestions! And please be gentle, I'm not an absolute crack in computer science.
Cheers,
Hanno
General ⇒ A Routine for producing LaTeX Documents
NEW: TikZ book now 40% off at Amazon.com for a short time.

-
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm
A Routine for producing LaTeX Documents
Here's a shell script I tossed together; without knowing more specifics, I can't help much more than that.
Sorry that the syntax highlighting is messed up; there isn't an environment for shell scripts.
Code: Select all
#! /bin/bash
# Print header
echo > thedoc.tex '
\documentclass[a4paper]{article}
\usepackage{graphicx}
\begin{document}
'
# Write the images (all PNG files in the "images" subdirectory)
for img in images/*.png
do
echo "\\includegraphics[height=0.8\textheight]{$img}" >> thedoc.tex
echo '\clearpage' >> thedoc.tex
done
# Write footer
echo '\end{document}' >> thedoc.tex
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
A Routine for producing LaTeX Documents
The GeSHi plug-in also supports bash scripts. I edited your post correspondingly. Just usekaiserkarl13 wrote:[…] Sorry that the syntax highlighting is messed up; there isn't an environment for shell scripts....
Code: Select all
in the BBCode tag for the correct highlighting of bash scripts. Of course LaTeX is the default setting*. Other supported languages are listed on the project page (column on the lower left side).
Thorsten
____________
[size=85]* It even supports BibTeX syntax, though this is not in the official list of supported languages.[/size]
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
A Routine for producing LaTeX Documents
Neat! I didn't know that.localghost wrote:The GeSHi plug-in also supports bash scripts. I edited your post correspondingly. Just use »code=bash« in the BBCode tag for the correct highlighting of bash scripts. Of course LaTeX is the default setting*. Other supported languages are listed on the project page (column on the lower left side).[…]
* It even supports BibTeX, though this is not in the official list of supported languages.
site moderator & package author
-
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm
A Routine for producing LaTeX Documents
Neither did I! I triedcgnieder wrote:Neat! I didn't know that.localghost wrote:The GeSHi plug-in also supports bash scripts. I edited your post correspondingly. Just use »code=bash« in the BBCode tag for the correct highlighting of bash scripts. Of course LaTeX is the default setting*. Other supported languages are listed on the project page (column on the lower left side).[…]
* It even supports BibTeX, though this is not in the official list of supported languages.
Code: Select all
but that didn't work, so I bailed. Good to know.