[l2h] textrm{} does not work -- and \texttt problems
Ross Moore
ross@ics.mq.edu.au
Fri, 4 May 2001 20:37:51 +1000 (EST)
Robin wrote:
> my own problem with expansion is that it doesn't distinguish between
> the arguments of \texttt and \textrm (and the rest), and solemnly
> enforces ligaturing of letters in the typewriter font that only exist
> in the roman and sans fonts.
Yes, there are some things like this that are annoying when you first
meet them unexpectedly. But these can usually be solved by judicious
use of macros, following the (unwritten) principles of logical markup. :-)
> .... this arose because one of our people
> wanted to write
>
> \subsection{\texttt{ls --colour=tty}}
>
> and was getting latex2html output that had a single hyphen in it.
>
> the solution is to separate the latex and the html version, and to
> write
>
> \subsection{\verb+ls --colour=tty+}
I don't think that that is a particularly good solution for the
immediate problem. Separating the LaTeX and HTML versions should take place
within the macro definitions (i.e. preamble) and/or packages. It should not
be done in the main body of the LaTeX source.
Try the following, for a solution that better encodes
the logical structure of the character strings being used:
\documentclass{article}
\usepackage{html}
\newcommand{\flag}[1]{\latexhtml{--}{---}#1}
\newcommand{\flagcode}[2]{\texttt{#1 \flag{#2}}}
\begin{document}
\tableofcontents
\section{\flagcode{ls}{colour=tty}}
\end{document}
It works with both output forms.
Using macros here allows for easy extensions, such as adding \index
or \label commands for (hyperlinked) cross-references, based on either
the particular flag, or just the command (no flag), or the command and flag
taken together, or any combination of these.
>
> for the html. this offends my sensibilities (since it's not allowable
> in latex). fortunately the \verb form works equally well in either
> output mode in running text; \texttt works nowhere in latex2html, for
> this text.
Surely the cases when '--' is *not* a ligature are when it has some
special meaning; certainly it isn't part of a word in any spoken language.
So a purist for logical markup would insist that a macro be used to generate it.
Then coping with the different expansion models is simply a matter of having
different macro-expansions for the different processors; and there is nothing
unusual in that.
Hope this helps,
Ross
> _______________________________________________
> latex2html mailing list
> latex2html@tug.org
> http://tug.org/mailman/listinfo/latex2html