General ⇒ A Routine for producing LaTeX Documents
-
- Posts: 1
- Joined: Tue Sep 25, 2012 2:51 pm
A Routine for producing LaTeX Documents
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
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
A Routine for producing LaTeX Documents
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]
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.
-
- 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.