[Omake] Re: Hevea 1.08: \@style{CODE}...\@clearstyle forgets
closing quote in text mode.
Luc Maranget
luc.maranget at inria.fr
Thu Feb 15 09:53:38 PST 2007
> Dear Luc,
>
> In our documentation aimed at being processed with your extremely useful
> Hevea package, we heavily use the \verb+foo+ form that produces
> <CODE>foo</CODE> in .html and a nicely quoted `foo' in text mode. I
> wanted to be able to get the same thing inside a macro, where I could
> not use \verb, so I tried defining
>
> \newcommand\code[1]{\ifhevea{\@style{CODE}#1\@clearstyle}\else\texttt{{#1}}\fi}
If I understand right you are producing a documentation
in three formats
1. DVI (I mean you use latex in a standard fashion)
2. html.
3. text.
For output 1. you are happy with \textttt
For output 2, you want <CODE>...</CODE>
For output 3, you want quotes.
Let me suggest that you write two style files
code.sty
\newcommand{\code}[1]{\texttt{#1}}
code.hva
\ifhtml
\newcommand{\code}[1]{{\@clearstyle\@style{CODE}#1}}
\else
\newcommand{\code}[1]{'#1'}
\fi
Then write \usepackage{code} in your source file.
That way you'll avoid complication in the future
(if you use the image feature).
> Should this be considered a bug? Is there a better way? Thanks a lot!
Apparently you found a bug (no terminal ' where it should perhaps be...)
But there is an easy workaround.
>
> Aleksey
>
-- Luc
More information about the OMake-Devel
mailing list