
Does anybody know what the magical LaTeX command is to turn (say) "++" into two overprinted pluses? (As seems to be fashionable...)

You can define
\newcommand{\pp}{+ \hspace{-0.2cm} +}
On 6/8/07, Andrew Coppin
Does anybody know what the magical LaTeX command is to turn (say) "++" into two overprinted pluses? (As seems to be fashionable...)
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Andrés

On 6/8/07, Alfonso Acosta
\newcommand{\pp}{+ \hspace{-0.2cm} +}
Why 0.2cm? Wouldn't that depend on the font size?
You are right. It depends on the font size. using ems as the
hspace size sounds more reasonable.
Yes, we can define \pp in this way, or we can define it as \newcommand{\pp}{+ \negthinspace +}. -- Andrés

Hi
Does anybody know what the magical LaTeX command is to turn (say) "++" into two overprinted pluses? (As seems to be fashionable...)
Just use lhs2tex and you get this (and more) for free. http://www.informatik.uni-bonn.de/~loeh/lhs2tex/ Thanks Neil

I got this from the Literate Haskell page on the Emacs Wiki[1]:
\usepackage{listings}
\lstloadlanguages{Haskell}
\lstnewenvironment{code}
{\lstset{}%
\csname lst@SetFirstLabel\endcsname}
{\csname lst@SaveFirstLabel\endcsname}
\lstset{
basicstyle=\small\ttfamily,
flexiblecolumns=false,
basewidth={0.5em,0.45em},
literate={+}{{$+$}}1 {/}{{$/$}}1 {*}{{$*$}}1 {=}{{$=$}}1
{>}{{$>$}}1 {<}{{$<$}}1 {\\}{{$\lambda$}}1
{->}{{$\rightarrow$}}2 {>=}{{$\geq$}}2 {<-}{{$\leftarrow$}}2
{<=}{{$\leq$}}2 {=>}{{$\Rightarrow$}}2
{\ .}{{$\circ$}}2 {\ .\ }{{$\circ$}}2
{>>}{{>>}}2 {>>=}{{>>=}}2
{|}{{$\mid$}}1
}
That replaces various strings (including ++) with their symbol
equivalents and generally makes things quite pretty.
Tom
[1]: http://haskell.org/hawiki/LiterateProgramming
On 6/8/07, Andrew Coppin
Does anybody know what the magical LaTeX command is to turn (say) "++" into two overprinted pluses? (As seems to be fashionable...)
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (5)
-
Alfonso Acosta
-
Andrew Coppin
-
Andrés Sicard Ramírez
-
Neil Mitchell
-
tom