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 decided I wanted to try my hand at providing a bit curvier answer to A better notation to denote arcs for an American high school textbook than what Werner provided. I also thought it would a good opportunity to practice a few of the tricks I've learned over the past year since I posted my original question.

Here's my approach:

\documentclass{article}
\usepackage{tikz}

\makeatletter

\newsavebox\ae@frown@box
\savebox\ae@frown@box{\tikz \path[fill] (0,0) to [out=50,in=130] 
                                        (2,0) to [out=150,in=30] 
                                        cycle;}
\def\ae@frown{\usebox{\ae@frown@box}}

\newsavebox\ae@tmp@box
\newcommand\arc[1]{%
  \sbox\ae@tmp@box{#1}%%
  \ooalign{%%
    \raisebox{\ht\ae@tmp@box}{%%
      \resizebox{\wd\ae@tmp@box}{!}{%%
        \ae@frown}}%%
    \cr
    #1}}

\makeatother

\pagestyle{empty}
\begin{document}

Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae,
aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli
appellantur. Hi omnes lingua, institutis, legibus inter se differunt.
\arc{OK}\ 
\arc{ABC}\ 
\fbox{\arc{Too much}}

\end{document}

enter image description here

The effects are not entirely as I expected. For two or three letter arc names I'm fine with the appearance, but somehow the height is not being taken into account when the paragraph is being formed. At first I thought the boxes' heights weren't being calculated incorrectly. That's when I threw in the \fbox{...}. But \fbox seems to get the height correct. Even more interestingly (or so I think) is that if I use the following text

Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae,
aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli
appellantur. Hi omnes lingua, institutis, legibus inter se differunt.
\arc{OK}
\rule{2pt}{1in}

enter image description here

There height of the rule is also somehow ignored.

Clearly I'm doing something wrong. Can someone explain what's happening here?

Post script: I did not use Werner's \setbox9=.... approach because I'm not entirely sure I understand that approach (I'm not sure whether I might be overwriting something with that approach).

share|improve this question
    
@HarishKumar I want to preserve the aspect ratio of the width and height. Your suggestion will over-distort things. That's why I chose to use {!} for the height. But I don't see how that matters for why the height of the box (and following boxes like the \rule) get ignored. –  A.Ellett Apr 30 at 4:28
1  
@A.Ellett: Read barbara's answer in Depth and height confusion: \ooalign removes the height/depth of its argument. –  Werner Apr 30 at 4:30
    
@HarishKumar Though your suggestion of 0.5\ht... seems to have a nice effect.... –  A.Ellett Apr 30 at 4:32
    
\ooalign uses the height of the first and the depth of the last line for the whole expression. But this is correct here, the height of the first is always greater than the height of the second because of \raisebox. And the height of the second line is smaller for the same reason. –  Heiko Oberdiek Apr 30 at 4:34
    
Another fix is to put the \ooalign inside an \mbox{}, Note that otherwise one \ooalign will mess up the whole line. Oops, same thing as a group. –  John Kormylo Apr 30 at 4:34

1 Answer 1

up vote 5 down vote accepted

\ooalign changes the parameters for line breaking (\baselineskip, \lineskip, \lineskiplimit). Therefore it should go into a group:

\documentclass{article}
\usepackage{tikz}

\makeatletter

\newsavebox\ae@frown@box
\savebox\ae@frown@box{\tikz \path[fill] (0,0) to [out=50,in=130]
                                        (2,0) to [out=150,in=30]
                                        cycle;}
\def\ae@frown{\usebox{\ae@frown@box}}

\newsavebox\ae@tmp@box
\newcommand\arc[1]{%
  \begingroup
    \sbox\ae@tmp@box{#1}%%
    \ooalign{%%
      \raisebox{\ht\ae@tmp@box}{%%
        \resizebox{\wd\ae@tmp@box}{!}{%%
          \ae@frown}}%%
      \cr
      #1% 
    }%
  \endgroup
}  

\makeatother

\pagestyle{empty}
\begin{document}

Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae,
aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli
appellantur. Hi omnes lingua, institutis, legibus inter se differunt.
\arc{OK}\ 
\arc{ABC}\
\fbox{\arc{Too much}}

\end{document}

Result

share|improve this answer

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.