[Main] [Academic] [LaTeX] [Wishes] LaTeX Tricks Page

Tricks for TeX and LaTeX - primarily taken from comp.text.tex and The EmTeX mailing list

Collected by Daniel Doro Ferrante

This page contains various questions and answers about TeX and LaTeX, which I have collected over the time. The only reason, that I have saved them, is that I found them interessting. They are presented here because you might also find them interessting - if not, don't blame me.

When preparring this page I have done a minimum of editing: Of course I have inserted the HTML-codes and then I have tried only to take the parts of the question and answers, that where interessting (some times even omitting the question). There is therefore no gaurantee that the suggested solutions a suitable or even work, but in the last case, they might inspire you to find the right solution.

Any comments or suggestions, please mail me!

Key Resource
Links2Go Key Resource
TeX and LaTeX Topic


Local stuff (in danish - it aplies only at DIKU anyway:)

Degree sign


ernst wallenborn (wall@phys.chem.ethz.ch)

Bras and Kets

Use \langle and \rangle. For a bit more quality, use the set of macros I made. The lowercase versions are regular size and the capitalized versions are variable size (depending on the size of the arguments).
% Use $$\Braket{\phi | {\partial^2}\over {\partial t^2} | \psi}$$

  \gdef\Braket#1{\left<\mathcode`\|"8000\let|\bravert {#1}\right>}}
Donald Arseneau (asnd@reg.triumf.ca)
Here's one that does the sizing for you automatically.


  \setbox0 = \mathbox{#1} \@tempdima=\ht0 \@tempdimb=\dp0
  \setbox0 = \mathbox{#2} \@tempdimc=\ht0 \@tempdimd=\dp0
  \ifdim \@tempdimc > \@tempdima
    \@tempdima = \@tempdimc
  \ifdim \@tempdimd > \@tempdimc
    \@tempdimb = \@tempdimd
  \def\@tempa{\vrule width0pt height\@tempdima depth\@tempdimb}
Colin James Wynne

Four dot ellipses

A few days ago somebody was asking how to achieve a good-looking four-dot ellipsis, for use when a quoted sentence is truncated (as opposed to the three-dot ellipsis when material is left out of the middle of a sentence).

I too have noticed that \dots plus a period produces irregular and unsightly spacing. Here's a solution: define a four-dot ellipsis on the same pattern as \dots, thus --

\def\fourdots{\relax\ifmmode\ldotsplus\else$\m@th \ldotsplus\,$\fi}
Then you can type \fourdots\ That made a proper sentence-ending ellipsis. (Or you could type $\ldotsplus$ for the same effect.) Just stick the above two definitions into the style file you are using, or make a separate style file of them.

Allin Cottrell (cottrell@wfu.edu)

Larger Parenthesis

I want the outer parenthesis larger than the inner parenthesis.


Most people who ask for this are trying to use \left and \right.

First, the problem with \bigl and \bigr is (or was) that they just copy the plain TeX definition, for 10pt, and don't change size to match the document. Moreover, LaTeX, by default, uses the same font for big parentheses at all sizes. The upshot is that in a 12pt document, \big is the same size as an ordinary parenthesis!

The solution; \usepackage{exscale} to scale the math extensions properly, and get a sty file that redefines \big etc to be sensitive to the font size. I forget which package does this...but it should probably go into exscale.

Alternatively, use exscale, but set \delimitershortfall=-2pt and then type $\left((x+b)\right)$

Donald Arseneau (asnd@reg.triumf.ca)

Building a set with scaling symbols

Ilya Beylin (ilya@cs.chalmers.se)
Is there a way to convince the vertical bar in notation, like
\left\{ x | x^x=2x \right\}
to scale together with braces?
Yes. For any other middle character, you must do some fancy and slow \vphantom hacking and two sets of \left and \right.

For the vertical line, just use \vrule!

 \left\{  x  \vrule  x^x=2x  \right\}
Donald Arseneau (asnd@reg.triumf.ca)
\left\{ x \left| \vphantom{x} x^x=2x \right. \right\}
\vphantom{x} puts in an invisible line the height of x. It's probably easier to use a macro:
Then your example is \bracketline{x}{x^x=2x}

Kevin Campbell (kevin@cindy.cee.ucl.ac.uk)

Setting Margins

I find the LaTeX method of setting margins/textwidth somewhat counter-intuitive. Perhaps I this is because I was corrupted by Microsoft Word at a young age. The following lines allow the user to specify the top/left/top/bottom margins and LaTeX calculates the rest. Note that it requires the calc package.
 %%% Begin Example


% Change these settings to change the margins
\setlength{\oddsidemargin}{0.0in}   % extra room on inside side

%%% use margin settings to set width variables
\setlength{\evensidemargin}{0 in}
\setlength{\marginparsep}{0 in}
\setlength{\marginparwidth}{0 in}
\setlength{\hoffset}{\myleftmargin - 1.0in}
  {8.5in -\myleftmargin -\myrightmargin -\oddsidemargin}

%%% use margin settings to set height variables
\setlength{\voffset}{\mytopmargin -1.0in}
\setlength{\topmargin}{0 in}
\setlength{\headheight}{12 pt}
\setlength{\headsep}{20 pt}
\setlength{\footskip}{36 pt}
Hope this helps,

Keith Reckdahl (reckdahl@leland.stanford.edu)

Ragrighting a hole document

I have a document that I want to format entirely with a ragged right margin. My first attempt was to include \raggedright at the top of the document, however with \raggedright LaTeX does not hyphenate at all and the lines come out much too ragged.

A full solution is the following LaTeX2e-style file:


% LaTeX \raggedright turns off hyphenation somehow.

\rightskip=0pt plus2em
\spaceskip=.3333em plus.03em minus .02em
\xspaceskip=.5em plus.08em minus.02em
\@rightskip=\rightskip % for LaTeX


% This is supposed to prevent very long words from sticking out into the
% right margin.  Instead they will be moved into the next line.

  \parindent\z@ \parskip\z@skip
  \leftskip\z@skip \rightskip\@rightskip
  \parfillskip\@flushglue \lineskip\normallineskip
David Hull (hull@cs.uiuc.edu) (Changed on advise from David Hull, ed.)

More than nine marginal notes on a page

John McMillan (phy6jem@sun.leeds.ac.uk) wrote:
David Gast (gast@twinsun.com)wrote:
If I ever try to put more than 9 marginal notes on a page, I get an error message like
   ! LaTeX Error: Too many unprocessed floats.
I was unsuccessful in avoiding this problem by setting values like \totalnumber.

Is there some way to permit more than nine marginal notes?

Indeed; the limit is indeed that of the number of unprocessed floats (instantaneously) permitted. Maybe David already has unprocessed floats lying around.

While searching for something else recently, I came across a reference to a package called morefloats.sty which claims to address this problem. I haven't found it yet let alone downloaded it and tested it. I guess its in CTAN somewhere and may or may not work with LaTeX2e.
It's in macros/latex209/contrib/misc/morefloats.sty and it does work with 2e. It's kind of sledgehammer code, but it does the job.

Robin Fairbairns (rf@cl.cam.ac.uk)

How to Put Float And Caption on a Separate Page

text text text ...
\begin{figure}[p] ... \caption{...}\end{figure}
Guido Sawade (sawade@physik.tu-berlin.de)

Using ASCII 0-31 in LaTeX

I have a LaTeX2.09 compatible style file which uses the ``^^'' symbol. This is not understood by LaTeX2e at all (illegal character), and I don't know how it worked or what it was meant to do originally.
In fact you missed out the important bit (which the charcter was) the usage of ^^ (a primitive TeX feature, not a LaTeX feature) is either folled by a single character eg ^^A this means control-A ie a character 64 away from A in the ASCII table or two lower case hex digits 0-91-f ^^ab The character of code hex ab (ie 16*10+11)

Most likely the ^^ notation was refering to a chaacter of code less than 32, which are `illegal' in LaTeX as they do not work on all TeX systems. However if you just want to make them legal again to get your package working go

(with whatever characters you need instead of ^^A, ^^B) before loading in the package.

David Carlisle (carlisle@ma.man.ac.uk)

Protected commands in LaTeX2e

Roozbeh Pournader (rpnader@ROSE.IPM.AC.IR) wrote:
I have a problem with LaTeX's show: When I try something like `\show\LaTeX' it answers with
which is very interesting! How can I get the real definition?
Actually, you're missing something rather important.


  > \LaTeX=macro:
  ->\protect \LaTeX  .
  <*> \show\LaTeX
There are *two* spaces after ``\protect \LaTeX''.

However, if I say:

  > \x=macro:
  ->\protect \x .
  <*> \show\x
There's only *one* space. The thing that's being protected is a control sequence that has a space in it; this has some rather useful effects in the rate of consumption of the name space for robust commands.

To find out what the object actually is, type:

  *\expandafter\show\csname LaTeX \endcsname
Robin Fairbairns (rf@cl.cam.ac.uk)

Non italicised Greek characters

M.Simpson (byx015@coventry.ac.uk) wrote:
How do you get non-italicised Greek lower case characters in LaTeX? Using \mathrm seems only to change capitals. I particularly need to get \mu for units such as microamps.
Here is a short example, assuming you have fetched and installed the greek fonts in ftp://ftp.tex.ac.uk/tex-archive/fonts/greek/kelly
\DeclareFontShape{OT1}{cmg}{m}{n}{<-> cmg10}{}
   \fontshape{n}\selectfont m}}
Mike Piff (M.Piff@shef.ac.uk)

Upright Letters in Math

Maarten D de Jong (dejong@cpt6.stm.tudelft.nl) wrote:
I am trying to substitute the italics in formulas for upright letters, but without the need for typing \mathrm{. . .} inside the formula all the time. In other words, I want to change the default font from italic to normal.

The only thing that worked sofar was

As it is the wrong encoding, you will run into trouble (greek letters and other symbols). I would suggest to change only the letters you want to change.


Vincent Zoonekynd (zoonek@DPTMaths.ENS-Cachan.Fr)

What are the TC fonts?

They are Text Companion fonts. They are supposed to contain non-mathematical symbols for use in text. They are inside fontdc.zip because they are part or the dc fonts distribution.

Dan Luecking (luecking@comp.uark.edu)

Fonts at Great Magsteps

I am having trouble using cmb10 scaled at magstep8. Can anyone help? When I access it in Plain TeX however:
\font\bigfont= cmb10 scaled \magstep8
\bigfont{test of Bigfont}
TeX complains:
! Missing number, treated as zero0.

l.5 \font\bigfont= cmb10 scaled \magstep8
Try `MagSteps.TeX': It allows dynamic re-creation of the \magstep macro for any number of magsteps limited only by TeX's integer capabilities. Usage is `\magsteps n', for integer n, followed by (optional) usage of the so-created \magstep command.
\catcode `\@ = 11

\newcount \r@mainder
\newcount \m@gstepcount
\newcount \m@gsteplimit
\newcount \m@gstepvalue
\newdimen \m@gstepdimen

\def \magsteps {\afterassignment \m@gsteps \m@gsteplimit = }

\def \m@gsteps
    {\let \@r = \or
     \def \or {\noexpand \or}%
     \m@gstepdimen = 0.166667 \maxdimen
     \m@gstepvalue = 1000 
     \m@gstepcount = 0
     \def \magstep {}%
     \ifnum \m@gstepcount < \m@gsteplimit
            \advance \m@gstepcount by 1
            \ifnum \m@gstepvalue > \m@gstepdimen
                   \advance \m@gstepcount by -1
                   \message {Sorry --- integer overflow would occur if
                             I went any further; stopped at 
                             \the \m@gstepcount.}
                   \m@gsteplimit = \m@gstepcount 
                   \multiply \m@gstepvalue by 12
                   \multiply \r@mainder by 12
                   \divide \r@mainder by 10
                   \advance \m@gstepvalue by \r@mainder
                   \r@mainder = \m@gstepvalue
                   \divide \m@gstepvalue by 10
                   \multiply \m@gstepvalue by 10
                   \advance \r@mainder by -\m@gstepvalue
                   \divide \m@gstepvalue by 10
                   \ifnum \r@mainder < 5
                     \edef \magstep {\magstep \or \the \m@gstepvalue}%
                     \advance \m@gstepvalue by 1
                     \edef \magstep {\magstep \or \the \m@gstepvalue}%
                     \advance \m@gstepvalue by -1
     \edef \magstep ##1%
          {\noexpand \ifcase ##1
           \noexpand \else 0%
           \noexpand \message 
                {Sorry --- \string \magstep \space ##1
                 is not in range 0 .. \the \m@gsteplimit}%
           \noexpand \fi
           \noexpand \relax
     \let \or = \@r

\catcode `\@ = 12
Philip Taylor (CHAA006@alpha1.rhbnc.ac.uk)

Real HUGE fonts

Wonkoo Kim (wkim+@pitt.edu) writes:
This gave me a problem. cm fonts are substuted by 24.88pt if I tried any bigger fonts, and it didn't work with some other fonts. Any further help? (I'm using emTeX under OS/2.)
The fonts you use must be specified in OT1cmr.fd. This is presumably to stop an inordinately large collection of fonts being made.

Note that you can overrule the command in your own file, as eg by copying this from OT1cmr.fd to your LaTeX file

   {  <5> <6> <7> <8> <9> <10> <12> gen * cmr
      <10.95> cmr10
      <14.4>  cmr12
and changing the last line (in your file) to
or to
(This allows any size larger than 24.88).

Timothy Murphy (tim@maths.tcd.ie)

Where to ask questions about METAFONT

In principle, this group (comp.text.tex, ed.) is supposed to cover metafont, but I know that a lot of high-power metafonters don't read it.

Try subscribing to the metafont list. I wrote in the UKTUG FAQ:

Issues related to Metafont (and, increasingly, MetaPost) are discussed on the metafont mailing list; subscribe by sending a message `subscribe metafont your name' to listserv@ens.fr
Robin Fairbairns (rf@cl.cam.ac.uk)

Detecting two following tokens

Young U . Ryu (ryoung@utdallas.edu) writes
Then, is there any way that achieves the following imaginary command: \futurefutureletCS-a CS-b TK1 TK2 TK3 performs \letCS-a=TK2, performs \letCS-b=TK3, processes TK1, processes TK2, and then processes TK3.
In the special case where TK1 is a CS (more generally, whenever the token can act as a parameter), the solution is easy:

I haven't actually checked this, but barring typos it should work (unless CS-a is the name \tempmacro, or TK1 is the name \tempmacro and CS-b is not :-)

Tanmoy Bhattacharya (tanmoy@qcd.lanl.gov)

One of the main uses for \futurelet is to detect a following "{". In many contexts, reading in a brace and putting it back is not going to work. \futurelet can also be used at the end of a macro (without knowing what either TK1 or TK2 is), but this use seems to be rare. Therefore the following can frequently replace \futurelet, but will not be applicable in all cases.

One can emulate \futurelet, when TK1 is a command, by the following: \afterassignmentTK1\letCS TK2 , provided TK1 does the job of processing TK2 (or rather, the CS that has been \let equal to TK2.

This type of thing can be extended to more than one following token by having TK1 perform another such operation or a \futurelet:

     ...             % code to examine \first and \second,
     ...             % perform some actions and then...
     \first          % put \first back
This would be used like \XTK2 TK3 and produces the following order of execution:

This fails to work in those contexts where a control sequence \let equal to a token is different than the token itself. For instance, if one wishes to check some following token to see if a brace delimited macro parameter follows. \let-ing some CS equal to that brace and then putting the CS back will not work because TeX requires an explicit "{" (otherwise the single CS is interpreted as the entire parameter, without braces).

Dan Luecking (luecking@comp.uark.edu)

How to write commands to a file

A verbatim environment could be tricky (though not entirely impossible). However, if all you're ever doing is to transmit robust commands such as \bf, you can achieve the required effect by

\test{Hi \bf World}   =>   \let\protect\noexpand
This is easy enough, but note that if you're using 2.09, \bf will then get transmuted to \pbf, which may or may not be acceptable.

Robin Fairbairns (rf@cl.cam.ac.uk)

Nothing LaTeX specific about this solution, but how about placing your information in a token register and then writing the contents of the register.

The \immediate here is necessary lest the contents of \argtoks change before the \write occurs.

Anders Svensson (svensson@math.ubc.ca)

Extending a definition using parameters

If you know how the parameter list looks like, you can do it as shown below for just one (undelimited) parameter. (Of course, doing it without knowing the parameter list is quite complicated.)

%%% \extend \cs {prepend} {append}
%%%         pre- and appends to \cs
%%%         where \cs takes one undelimited argument

\def\extend #1{\expandafter\Extend #1{##1}\endextend#1}
\def\Extend #1\endextend#2#3#4{\def#2##1{#3#1#4}}
Peter Schmitt (schmitt@awirap.bitnet)
And a more complicated version due to some criticism

Donald Arseneau (asnd@erich.triumf.ca) writes:

And \Extend is a perfect example of a macro that can't be extended because ## gets changed to #.
I did not really claim that it is a complete solution. However, though the design of perfectly robust macros - or at least macros which are as robust as possible - is TeXnically interesting and pleasing, it is often not necessary for a real situation (it might even be unnecessarily complicated and inefficient). In a case like this one, the macro writer certainly has some knowledge of the circumstances under which the macro will be `legally' used and can judge if a partial solution will suffice or not. There is no harm done, if an improper use will cause an error message. (Moreover, in this case TeX will insert a missing # as a means of error recovery, so the result (in batchmode) will be correct in even more cases!)

But, if one needs to extend definitions which contain paramater characters, then I can propose another solution which also is not completely general, but will usually work. Moreover, it does not depend on a knowledge of the parameter text:

\def\extend #1{\immediate\openout1 tmptmptx.tmp  
  % add a test if file present to be absolutely safe
               \immediate\openin1 tmptmptx.tmp
               \global\read1 to\macrotext
               \expandafter\Extend\macrotext\endmacro #1
\def\Extend macro:#1->#2\endmacro#3#4{\def#3#1{#2#4}}

\def \a #1{Test##}
\extend \a {TEST}   \show \a
This will work as long as it is not influenced by \catcode changes. Since the macro writer should know the conditions under which the macro to be extended is to be used it should be possible to adapt the environment accordingly - at least, for the parameter text. (Refinements in order to cover more (or even all) cases are certainly possible.)

One final remark: If a complication like this one arises in a practical situation, one should also check if the correct approach has been used. In this case, it might be better (or even more efficient) to store the values of the arguments in control sequences, and let the macros access them via these - avoiding the problem altogether.

Peter Schmitt (schmitt@awirap.bitnet)

Different paragraph forms

Setting a paragraph with the last line centered
While I can conceive of situations where manual box processing is necessary, this and many other fancy paragraphs can be achieved with careful settings of TeX's paragraph glue (\rightskip, \leftskip, \parfillskip) and sometimes by using \everypar to insert glue. The centered-last-line is the most famous:
\leftskip=0pt plus 1fil  % use \setlength in LaTeX
\parfillskip=0pt plus 2fil
That's it; all paragraphs come out right.

I know I had worked out a bunch of such paragraph manoevres, but can't seem to find them, save this:

The first n lines are set raggedright, and the last line is set raggedleft. If the paragraph has only one line, it is set raggedright.
\def\par{\ifhmode \unskip \nobreak \hskip 0pt plus-1fill% 
         \nobreak \fi \endgraf}
\everypar{\nobreak\hskip 0pt plus-1fil}
\leftskip=0pt plus 1fil
\rightskip=0ptplus 1fill
\parfillskip=0pt plus 1000pt 
Donald Arseneau (asnd@reg.triumf.ca)

Using \jobname

Rob van Dijk writes:
I would like to include some conditional text, based on the name of the file that's being `TeXed'. I have tried the following:
However, the if-test is always false, even when the filename is `somename.tex'. ...
\if ....
expands the following tokens and tests the first two non-expandable tokens it finds, so it would return true if the first two letters of the filename were the same.

So you probably meant \ifx rather than \if \def\x{abc} \def\y{abc} then \ifx\x\y will be true.

However \jobname is a strange beast. It returns the letters with catcode 12 and as it is not a macro it is not \ifx equivalent to any macro. Thus you first have to make a macro with the letters you want to test all set to catcode 12 (I use \meaning and the LaTeX command \stip@prefix to generate this below) and then you need a second macro with the contents of \jobname. Then you can compare them with \ifx.


this will show \yes if the file name is xx and \no otherwise.

David Carlisle (carlisle@ma.man.ac.uk)

Michael Rolfe (mumble@maths.uct.ac.za) writes:
where \filename returns the name of the file containing the \if statement.
You will have to redefine \input:
\def\input#1 {\edef\Temporary{\noexpand\TeXinput#1 
This restricts the \input syntax to ending filenames with a space; \relax or some such isn't allowed.

(I hope it works as typed.)

Donald Arseneau (asnd@reg.triumf.ca)

Roger de Reus (reus@PC2.MIC.DTU.DK) writes:
: \jobname returns the name of the file being processed,

This will give you the `name' part of the file (without path or extension). What is the hook for the full qualified file name?

I posted something like this to c.t.t some time back, I am not sure anyone would really want to use this (especially if they have a small disk quota:-)

but (if you know you are on a TeX that uses \jobname.log as the log file (ie not on VMS, where you have to make obvious change to .lis) you can get the full path from the log file. Unfortunately on Unix and presumably other systems writing to the file is buffered, so you have to write an awful lot of rubbish to flush out the buffer so the log really appears in the file, then you can read in the file and look at the first lines...

The code below sets the path to the path reported by TeX. If the file is in the current directory this may end up being just the filename like \jobname. On web2c unix TeX at least you can force TeX to give the full path in the log file by explicitly putting the current directory at the front of the TeX input path.

Thus if you save the code below as jobpath.tex this seems to work on my machine at least...

vummath> TEXINPUTS=$PWD: tex jobpath
This is TeX, Version 3.14159 (C version 6.1)
Hyphenation patterns for english, german, loaded.
!!! Full path is /home/carlisle/jobpath.tex  !!!
No pages of output.
Transcript written on jobpath.log.

\wlog{just to get started}

   \read\logfile to \rubbish % get rid of a \par

   {\newlinechar`\ \wlog{\xx\xx\xx\xx}}}

\def\xxx{a b c }

  \read\logfile to \jobpathname


% get the log file started
% now read it

% see what happened

\immediate\write17{!!! Full path is \jobpathname\space!!!}

David Carlisle (carlisle@ma.man.ac.uk)
There is a litte package ``filename.sty'' by Bernd Raichle which seems to do that:
% filename.sty  \filename records the current filename
% first version: 1 Mar 91 (br)
% last change  : 5 Mar 91 (br)
\typeout{Style option `filename' <5 Mar 91> (br)}

\def\@@input#1 {\def\file@name{#1}%

% -- end of `filename.sty'
%From: raichle@azu.informatik.uni-stuttgart.de (Bernd Raichle)
but I have not tested it (it is rather old).

Jean-Pierre Drucbert

\csname\uppercase{#1}\endcsname replacement

Peter Galk (galko@trix.genie.uottawa.ca) wrote:
This of course fails due to the fact that \uppercase doe not work in TeX's mouth. Anybody know how to get the required effect? Well, the following should do just fine:
I have removed #2 from the macro arguments so that you might specify arguments yourself, like in
If you wonder why this should work, read the TeXbook concerning \uppercase.

David Kastrup (dak@pool.informatik.rwth-aachen.de)

Dropping a capital a the start of a paragraf

Here is the style file I have used to typeset fairy tales for my little daughter sometime ago :-) :-)

It is an adaptation from drop.sty targeted to the use with the yinit fonts (in CTAN) and Times-Roman on a PostScript printer. Your mileage may vary...

% From "drop.sty", written by David G. Cantor and published 
% Fri, 12 Feb 88, in TeXhax, 1988 #16; then modified for use with LaTeX by 
% Dominik Wujastyk, February 17, 1988.
% Modified MLO 1994-12-05 :
% - advanced \dimen0 by 0.5em, for use with yinit fonts;
% - the largest declared size for yinit fonts is 24.88; here I define a
%   font"myinit", based on yinit.mf and having all sizes.  The actual 
%   size used is \dropcapsheight: the default (40pt) corresponds to 4 
%   lines of text with 10pt fonts, and generates a file yinit.310pk 
%   through METAFONT. \dropcapsheight can be redefined by the user: e.g.
%   with a command \renewcommand{\dropcapsheight}{48pt} before 
%   \begin{document}.

  [1994/12/05 - Dropped capitals for the 'yinit' fonts]
\DeclareFontShape{U}{myinit}{m}{n}{ <-> yinit }{}
\newdimen\dropcapsheight  \dropcapsheight=40pt
    \setbox0\hbox{\dropinitialfont #1}\setbox1\hbox{#2}\setbox2\hbox{(}%
    \count0=\ht0\advance\count0 by\dp0\count1\baselineskip
    \advance\count0 by-\ht1\advance\count0by\ht2
    \dimen1=.5ex\advance\count0by\dimen1\divide\count0 by\count1
   \advance\count0 by1\dimen0\wd0
    \advance\dimen0 by.75em\dimen1=\ht0\advance\dimen1 by-\ht1
   \hskip-\dimen0\setbox0\hbox to\dimen0{\raise-\dimen1\box0\hss}%
Maurizio Loreti (loreti@padova.infn.it)

Paragraphs in multiple columns

I want to typeset the same text in two languages side by side, and I thought that I had devised a suitable environment (using the tabularx and array packages):
"! Argument of \TX@get@body has an extra }".
You may be better using the `parallel' package from ctan, but if you want to use tabularx for this then note the following text from tabularx.dtx:
This mechanism of grabbing an environment body does have the disadvantage (shared with the AMS alignment environments) that you can not make extension environments by code such as
as the code is looking for a literal string \end{tabularx} to stop scanning. Since version 2.02, one may avoid this problem by using \tabularx and \endtabularx directly in the definition:
The scanner now looks for the end of the current environment (foo in this example.) There are some restrictions on this usage, the principal one being that \endtabularx is the first token of the `end code' of the environment.
David Carlisle (carlisle@ma.man.ac.uk)
There is an environment for your purposes. Since it is a short style file (for LaTeX2.09) I am sending it in this mail. I think you will find it very easy to adapt for your own purposes.
%% Save file as: MULTICOLPAR.STY        Source: FILESERV@SHSU.BITNET  
%  File multicolpar.sty
% by
% Mauro Orlandini <orlandini@tesre.bo.cnr.it>
% Modified by Max Hailperin <max@nic.gac.edu>
%   This LaTeX style, writes different paragraphs in different columns
% the number of columns is free), as
%   This is the first paragraph  |  This is the second paragraph and its
%   and text follows...          |  own text follows...
%   This is the third paragraph  |  This is the fourth paragraph...
%   and text follows...          |
% This format is useful for translated articles, in which there is the
% original language in the first column and the translated version in
% the second.
% Usage: \begin{multicolpar}{N}
%         ... text ...
%        \end{multicolpar}
% where N is the number of columns in which the text will be displayed.
% Warning: Inside the environment, each blank line (ie a \par) will 
%          correspond to a paragraph, therefore do not leave blank lines 
%          soon after the \begin{multicolpar}{N} command and soon before 
%          the \end{multicolpar} command (unless you want so).

\newcount\columnsleft   \newcount\totalcolumns   \newdimen\separation

    \hbadness5000 \vbadness9999 \tolerance9999
    \totalcolumns=#1   \separation=#2   \let\xpar=\par
    \hbox to\hsize\bgroup
    \dimen0=#2\advance\hsize-\columnsleft\dimen0 \advance\hsize\dimen0

        \hfil\vtop\bgroup\hbox to \hsize{}
Alex Schoenmakers (Alex.Schoenmakers@lhs.be)

How to Put Something on a Fixed Placed on the Page

Have a look at the fancyheadings package. The koma-script package allows custom page-headers, too. In these you could put objects into arbitrary positions on the page via (0,0)-dimensioned picture environments using vertical and horizontal offsets. You can even decide which go on odd or even numbered pages...

Hans-Juergen Godau (godau@dec2.wi-inf.uni-essen.de)

I tend to use a (LaTeX) picture environment (with size 0) at the start of a page. This will give you a defined origin (determine by the offset and margins etc.) from which you can include graphics etc. at arbitrary positions using the \put command.

It seems wisest to put the picture in a header as the top of page could vary from page to page (eg. in the letter-class). (Added by editor after advise from Roger de Reus).

Roger de Reus (REUS@MIC.DTU.DK)

Printing Many pages on one

Anyway, for a much more general solution, you should look at Marcel van der Groot's 'quire' macros (a quire is a small booklet), which are TeX macros to arrange arbitrary numbers of pages in the right order for printing. They're part of his Midnight Macros collection, available from CTAN or our FTP server.

Barry Smith, Blue Sky Research (barry@bluesky.com)

Tricky Leaders

David Carlisle (carlisle@ma.man.ac.uk) wrote:
I'm trying to format an index, where the subject can sometimes be fairly long. I'd like to force the text into the first 3 or 4 inches, with at least an inch where there is nothing but leader. An example will clarify:
What I have now:
Here is a short title .................... 24

Here  is  a  long  and  annoying  title  that
won't fit onto one line .................. 25

This is a very bad case. No leaders at all 26
What I want:
Here is a short title .................... 24

Here is a long  and annoying
title that won't fit onto one
line ..................................... 25

This is a very bad case. No 
leaders at all ........................... 26
A paragraph has glue stuck into all sorts of places, and by redefining that gluet we can change the shape of the paragraph. \leftskip is inserted at the beginning of every line; \rightskip at the end; and \parfillskip is put at the end of each paragraph. We normally start with \parfillskip=0pt plus 1fil, to left justify the last line.

So the solution to my problem is to add an inch to my \rightskip, which forces the right edge over 1 inch. And to get my page numbers all the way over to the right, we set \parfillskip to -\rightskip to counteract the \rightskip. Lastly, to make sure the very last line doesn't take advantage of the extended room made available by the \parfillskip, we give the leader a minimum size of \rightskip.

I've put all this stuff together into a parameterized environment and played with \textwidth to stress the example I'm working from.

  % This will get redefined below

% #1 is the title, #2 the page number,
% and #3 and optional subtitle or author
  {#1 \leaderfill #2 \par\emph{#3} \hfill\hfill\par\smallskip}

     {\cleaders \hbox to 4pt {\hss.\hss}
                \hskip #1 plus1fil\relax}}
(This used like, collectors note)
\IndexPaper{The Phenomenon}{3}{We can put a Subtitle here}
\IndexPaper{The Phenomenon of Being and the Being of 
            the Phenomenon}{7}{Or maybe an author}
\IndexPaper{The Pre-reflective \emph{Cogito} and the
            Being of the \emph{Percipere}}{9}{}
\IndexPaper{The Being of the \emph{Percipi}}{9}{}
\IndexPaper{The Ontological Proof}{21}{}
With these definitions, the basic shape of the paragraph seems right, but the "at least 1 inch leader" rule can get broken. For example, if I typeset the above example with \begin{MyIndex}{1in}, I get listings like:
The Phenomenon
We can put a Sub-
title here
Instead of:
The Phenomenon ............... 3
We can put a Sub-
title here
Todd Hivnor (hivnot@rpi.edu)

Format with preloaded packages

Bob Gordon (gordon@euclid.math.temple.edu) writes:
I use the xy-pic drawing package with emTeX. I am able to mage e.g. a format file XYPLAIN.FMT with xy-pic preloaded by saing `tex386 -i xyplain.ini', where the contents of XYPLAIN.INI is:
The same trick used to work with the old ``inferior'' LaTeX. I cannot get it to work with LaTeX2e. I tried ini-files such as:
\input latex.ltx
\input xy
latex.ltx has the command \dump at the end of the file. Thus everything after that gets ignored. There are various ways by which you can get around this, but they all lead to non-portability of documents, and are not to be recommended.

One way is to copy latex.ltx to (say) mylatex.ltx, edit this file to remove \dump near the end, and use mylatex.ltx in your file XYLATEX.INI or whatever you decide to call it. You will then have to modify your batch files, etc. And you won't be able to send your source file to anyone else and have them process it.

Ken Smith (kgs@maths.uq.oz.au)

A better way IMHO is to first make a ``normal'' LaTeX format, and then to load it again with initex, together with the required classes, pacakges etc., and dump again. I don't know about xy, but to take a different example, suppose you ``standard'' documents start off with something like:
then it is rather tedious watching dozens of files being loaded every time you write a letter. So you make a format ``latex'' with (say)
tex386 -i -8 latex.ltx 
(this is for emTeX and should also install hyphenation paterns for babel (see the documentation for babel), editors note)

and then a format ``my_latex'' with tex386 -i &latex my_latex.tex where my_latex.tex contains the above line plus \dump. Then you can comment out these lines and load my_latex.fmt instead. Portability is no problem: Just uncomment the lines and the file is as portable as any other LaTeX file (which is admittedly not very portable in view of the various font, packages, encoding etc. which are meanwhile in use).

Peter Ryder (ryder@theo.physik.uni-bremen.de)

Side by side figures

Bruce Wilson wrote:
Can anyone suggest a simple means of placing two figures side by side?
I dont't know, if you consider this as a simple means, but it does work...

the width of the two minipages plus the \hspace should not be more than \textwidth. this assumes you're using graphicx. if not, simply replace \includegraphics[...] by your favorite command to include pictures.

%       bb=llx lly urx ury,
%        angle=270,
%       height=v_length,
%       scale=factor,
%       clip=true/false,
%       bb=llx lly urx ury,
%        angle=270,
%       height=v_length,
%       scale=factor,
%       clip=true/false,

Source code for the TeX-book

OK, here is the instruction for reproducing the TeXBook using the TeX system that you spent two weeks to install. Be advised that the source of the book is provided by Professor Knuth for EDUCATION purposes only. (But an accidental click on the wrong button inside a GUI environment that fires off a process that you cannot kill, or a print job that ties up the printer for several hours can happen, especially if you are in the early stages of learning. :) )
  1. You need the manmac.tex file (which is usually distributed with TeX.)
  2. You need all the *.tfm files called for by texman.tex (this includes some fonts that are distributed with Metafont only in *.mf source form. But all the font sources are in the typical Metafont distribution.)
  3. TeX the texman.tex and read the Warning Message carefully.
  4. Realize that you have to edit the source and that you need to run TeX in debug mode to figure out what's going on.
  5. Break out the warning loop by changing one boolean variable's value.
  6. TeX again to get the texman.dvi file.
  7. Call 1-800-321-4AMS to order the TeXBook from the AMS.
Weiqi Gao (weiqigao@crl.com) Tim Murphy asks if there is any restriction on TeXing the TeXbook.

Here is the relevant statement from the latest texbook.tex:

  \errmessage{This manual is copyrighted and should not be TeXed}\repeat
I think that's pretty clear.

There are a few specific conditions under which knuth has given explicit permission for the TeXbook to be TeXed:

in neither case is it necessary to print, or even to preview, the resulting dvi file. (validation of a new or updated implementation can be done by comparing the dvi file with another known to be valid.) For any other use, permission should be requested in writing from knuth, addison-wesley, and the american mathematical society.

bbeeton (BNB@MATH.AMS.ORG)

Simple Guide to MetaFont

Donald Knuth, the author of Metafont, has written a nice (bright orange) book called "The METAFONT Book", published by Addison-Wesley.

Laurence Penney (Lorp@truetype.demon.co.uk)

On the other hand, it's difficult to use this book as a guide to so much as generate PK files for the CM fonts. There is at least one brief guide to MF on the net whose location has escaped me, but it's GOT to be on CTAN, at least.

Donald A. Hosek (quixote@Primenet.Com)

CTAN tex-archive/info/metafont-for-beginners.tex

Robin Fairbairns (rf@cl.cam.ac.uk)

Uploading to CTAN

To sumbmit something for installation on CTAN, you should ftp it (preferably as a .tar.gz or .zip file) to a CTAN /incoming directory, and send mail to ctan@shsu.edu saying:

One of us will do the rest...

Robin Fairbairns (rf@cl.cam.ac.uk)

Local stuff

The following articles appear only in danish. Anyway they are local to the Department of Computer Science at The University of Copenhagen (DIKU), so it will be of interest only for people understanding danish.

Sådan genereres fonte

Fonte genereres vha. MakeTeXPK, der har følgende syntaks:
MakeTeXPK navn dpi bdpi skalering [mode [destdir]] 
hvor parametrene er følgende: Eksempelvis genererer
MakeTeXPK bbding10 300 300 1 cx ~/LaTeX/MFinput
fonten bbding10 (en symbolfont) til en udskriftsenhed med 300 DPI i en opløsning på 300DPI uden skalering. Fontene placeres i standardkatalogerne, hvilket er i orden for EDB-afdelingen. De kan dog gemmes andre steder vha. forskellige omgivelsesvariable.

Egen sammenfatning

Det meste af det følgende er for tiden totalt udokumenteret. Noget af det vil til sin tid komme til at stå i vores Local Guide til LaTeX.

Men dette er ikke noget som man behøver at lære, hvis man ikke synes det er sjovt. Den grundlæggende antagelse, at man ikke må lægge uddata fra egne MF-filer op i /usr/local/lib/texmf/fonts/tmp, er nemlig ikke korrekt. Vi regner ikke med at folk kan bruge så mange forskellige skrifter og størrelser at der bliver problemer med pladsen, og hvis de gør, så laver vi et script til at fjerne filer der ikke bliver brugt.

Lars Mathiesen(thorinn@diku.dk)

danieldf@latt.if.usp.br, June 25, 1999.
You're not the only one visiting this page. There has been since June 25, 1999.