[texhax] Plain TeX for graphic layout

Reinhard Kotucha reinhard.kotucha at web.de
Sun Sep 28 23:41:33 CEST 2008


jw writes:
 > Hello,
 > I'm a bit of a TeX newbie.
 > I'm working on a project where I want to layout images and text in
 > rectangles. This is for creating playing cards (kinda like those for a
 > CCG) for games I design.
 > Basically I want to specify some rectangles, put images in some,
 > wrapped text in others. Might want to embed some icons in the text, as
 > well.
 > 
 > It seems like TeX might fit the bill for this, but what flavor should
 > I be looking at? LaTeX and most other macro packages seem to be
 > document-oriented (tracking table of contents and soforth).
 > Or maybe I should create my own set of macros, using plain TeX?
 > I'm a programmer; I don't mind if it gets technical, just don't want
 > to re-invent perfectly good wheels.
 > 
 > And, slightly off-topic, anyone have any pointers to other solutions
 > that might work for me?
 > I was also considering straight PostScript, since my needs are really
 > quite simple.
 > I initially was just going to use ImageMagick, but the text support is
 > not great, and I would have to do a lot of fiddling with font metrics
 > and such.

Hi John,
straight PostScript is certainly simple but there are a few drawbacks:
PS doesn't insert kerning automatically.  The other problem is that it
doesn't break lines automatically and doesn't hyphenate words.
On the other hand, drawing icons is quite easy in PS.

I would look into the latex picture environment. It allows you to
position objects easily.  Don't know whether you can use \parbox'es
(boxes containing aligned paragraphs) inside a picture environment.
This is not documented in the manual, but it's quite likely that it
works.

You can also use plain tex.  In this case I recommend eplain, an
extended version of plain tex.

  http://www.tug.org/eplain/doc/eplain/index.html

The advantage of eplain is that you can use the latex graphics package
in order to include external graphics. 

Whether latex or plain/eplain is better for you depends on what you
want to do exactly.  Since there is probably no latex package which
exactly does what you need, it's not easy to make a suggestion.

But here are a few hints at least:

Avoid to extend latex by plain tex code.  It's possible but requires
detailed knowledge about latex internals.  If things are not done the
latex way, there is no chance that latex issues a proper error message.

The icons are not a problem at all.  You can insert them everywhere in
your text.  You can load external graphic files or draw them directly
in the *tex sources.  There is a wonderful drawing tool called
TikZ/pgf

   http://ctan.org/tex-archive/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf

which supports latex and *plain.

I don't know whether eplain supports placing objects relative to a
particular origin.  This is what the latex picture environment does.
If it's not supported by eplain, consult "The TeXbook", there is an
example on page 389.

Sorry that I can't tell you exactly which approach is the best.  But
since you said that you are a programmer and even considered
PostScript already, I'm inclined to propose to look into eplain first.

Regards,
  Reinhard

-- 
----------------------------------------------------------------------------
Reinhard Kotucha			              Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover	                      mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------


More information about the texhax mailing list