Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am wondering why the \twoheadleftarrow in the code below looks so much different from (worse than) the \leftarrow, although according to the LaTeX symbol list, the arrow heads should be of the same height etc.

output

\documentclass{article}

\usepackage{amssymb}
\usepackage{bm}
\usepackage{Sweave}
\usepackage{listings}

\lstset{
  language=R,
  basicstyle=\ttfamily,
  literate={<-}{{$\bm\leftarrow$}}2{<<-}{{$\bm\twoheadleftarrow$}}2
}

% undefine Sinput, and Soutput (due to missing 'lstrenewenvironment')
\expandafter\let\csname Sinput\endcsname\relax
\expandafter\let\csname endSinput\endcsname\relax
\expandafter\let\csname Soutput\endcsname\relax
\expandafter\let\csname endSoutput\endcsname\relax

\lstnewenvironment{Sinput}[1][]{#1}{}

\begin{document}
<<foo>>=
x <- 1
x <<- 1
@
\end{document}
share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

Your minimal example could have been more minimal:-)

enter image description here

Looking at the log from

\documentclass{article}

\usepackage{amssymb}


\begin{document}
\showoutput
$ a \leftarrow b $

$ x \mathrel{\leftarrow\mkern-14mu\leftarrow} y $

$c \twoheadleftarrow d $

\end{document}

You see that the single arrow comes from the original CM font but the double arrow comes from the AMS font and the arrow head doesn't really match.

Your choice is to cast around for a font set that does have matching arrows or fake double arrows by over-printing single arrows as in my example. Once you have the arrows matching bm and sweave packages can do their stuff but if the basic underlying arrow definitions don't match, bm and sweave can't make them match.

share|improve this answer
    
Many thanks for helping, David, as usual. I tried to minimalize it, but didn't realize that the problem already appeared. Thanks again, works great. –  Marius Hofert Nov 13 '12 at 12:31
1  
@DavidCarlisle -- the ams symbol fonts were based on the shapes of the original am (pre-cm) fonts, and not updated when knuth changed some of the cm shapes, including those of arrowheads. the overlay approach is a good choice in this situation. –  barbara beeton Nov 13 '12 at 14:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.