[texhax] Repeating blocks of LaTeX code -- can it be done?

Torsten Wagner tottiwagner at yahoo.de
Fri Jul 11 13:59:50 CEST 2008

Am Donnerstag, 10. Juli 2008 09:03:37 schrieb Don Gingrich:
> What I'm trying to do is simple conceptually, I've got a LaTeX
> template for final examinations and I want to put space on the
> exam paper for the students to answer. I may not be doing this
> the best way presently, and I'm sure I'll hear if there's a better
> way to do it. But what I'd also like to do (and I had a look at
> _The_LaTeX_Companion_ and didn't find any suggestions) is
> to be able to have the code for a vertical space and a horizontal
> line and put it in a block with a multiplier to get n lines for some
> value of n. Given that TeX and LaTeX behave like a programming
> language, I would have thought this was possible.

You might like to try pgf resp. tikz [1,2]. It integrates perfect in LaTeX and 
allows to "program" pictures. A box with lines would be easily to create 
within a few lines of code.
Furthermore, I guess you will quickly like it to create pictures for exams and 
course material in addition.
The benefits are easily modifying of pictures within the LaTeX-File, a clear 
uniform look of text an pictures, no compression artefacts of pictures and 
small file size.

However, it has a similar learning curve to LaTeX.  

For your initial problem. Tikz provide loop-structures as well as mathematical 
calculation in a (imho) "more easy way" compared to TeX. I would suggest to 
create a new command which takes the height of the desired box as the 

Just my two cents...


CC. If you require some help with tikz code please contact me I will try to 
give some "start-up".

[1] http://sourceforge.net/projects/pgf/
[2] http://www.fauskes.net/pgftikzexamples/
Torsten Wagner
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

More information about the texhax mailing list