texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Texmacs-dev] Small figures


From: Nix N. Nix
Subject: [Texmacs-dev] Small figures
Date: 23 Apr 2003 20:52:42 -0600

The Good News:
I have found a way to limit the width of small figures as we do in
TeXmacs.  The final LaTeX code is:

\renewcommand{\tmfloatcontents}{\epsfig{file=one.eps}}
\setlength{\tmfloatwidth}{\widthof{\tmfloatcontents}+1in}
\ifthenelse{\lengthtest{\tmfloatwidth >
\linewidth}}{\setlength{\tmfloatwidth}{\linewidth}}{}
\begin{minipage}[h]{\tmfloatwidth}
  \begin{center}
    \tmfloatcontents
    \captionof{figure}{This is a rather oversized picture of the symbol 
    for ``one'' as created using the Courier font.}
  \end{center}
\end{minipage}

... and (tmtex-float-make ...) is (not surprisingly):

(define (tmtex-float-make type position x caption)
  (list '!paragraph
    (list 'renewcommand (list 'tmfloatcontents) (tmtex x))
    (list 'setlength (list 'tmfloatwidth)
          (list '!concat (list 'widthof (list 'tmfloatcontents))
                "+1in"))
    (list 'ifthenelse
          (list 'lengthtest
                (list '!concat (list 'tmfloatwidth) " > " 
                      (list 'linewidth)))
          (list 'setlength (list 'tmfloatwidth) (list 'linewidth))
          (list '!concat))
    (list (list '!begin "minipage" 
                (list '!option position) (list 'tmfloatwidth))
          (list (list '!begin "center")
          (list '!paragraph
                (list 'tmfloatcontents)
                (list 'captionof type (tmtex caption)))))))

The "+1in" is rather arbitrary, I know, but TeXmacs too leaves some
amount of room around a figure, so the caption underneath it is not
strictly confined to the width of the figure.  Also, I don't know any
way of producing {} other than (list '!concat).

The Bad News:
As I'm sure you've surmised from the above, doing floats this way
requires two pieces of preamble:

\newcommand{\tmfloatcontents}{}
\newlength{\tmfloatwidth}

I don't know how to implement these.  The reason is that, the way it
looks to me, tmtex-preamble.scm expects a TeXmacs construct and assigns
to it a LaTeX command.  So, I can only control the right-hand-side of
the association between the TeXmacs constructs and the LaTeX constructs.
We also have no means of adding "\newlength" commands, AFAI could see.

Oh, more bad news:  Yet another package: ifthen. It's required for the
ifthenelse decision.  We must make sure that the width of floating stuff
does not exceed the line width.

Despite all the bad news, all-in-all the result looks amazing !  It even
works well with figures containing text !

If you can help me with the preamble, and assuming you want any of this,
I can have a follow-up to the savannah patch in no time.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]