2

If i run \test{ap} and \test{ap} i get

enter image description here

Here is the code

\newcommand{\test}[1]{
\tikz[baseline=(arced node.base)]{
            \node [inner sep=0pt, outer sep=0pt] (arced node) {#1};
            \draw [line width=2pt,transform canvas={yshift=-0.5mm},color=black] (arced node.south west) parabola [parabola height=-1.5mm] (arced node.south east);
        }
}

I want that both parabola are at the same height. Either starting at baseline or starting after depth. Do you guys have an idea how to manage that?

1
  • 1
    Please make your code snippet an MWE that people can just copy and compile in order to see the problem (cf. my answer). – schtandard Feb 17 at 10:46
4

I believe you are looking for the base west anchor.

\documentclass{article}

\usepackage{tikz}

\newcommand{\test}[1]{
  \tikz [baseline=(arced node.base)] {
    \node [inner sep=0pt, outer sep=0pt] (arced node) {#1};
    \draw [line width=2pt,transform canvas={yshift=-0.5mm},color=black] (arced node.base west) parabola [parabola height=-1.5mm] (arced node.base east);
  }
}

\begin{document}

ab \test{ab} \test{ap} ap

\end{document}

MWE output

3
  • perfect, thanks! – Bilal Yilmaz Feb 17 at 14:14
  • One question: How can I istead of base west, set to "midline west" and "capline west"? – Bilal Yilmaz Feb 17 at 14:38
  • @BilalYilmaz There is no predefined anchor for that. Ask a separate question. – schtandard Feb 17 at 17:58
0

Some other alternatives to adjust vertical alignment when some descendants (?) are missing. Include \strut or a \vphantom or just a text depth into node's definition.

Nodes are drawn to see the effect of every option to their size. Alignment is correct and south anchors are used.

\documentclass{article}

\usepackage{tikz}

\newcommand{\test}[1]{
  \tikz [baseline=(arced node.base)] {
    \node [inner sep=0pt, outer sep=0pt, draw] (arced node) {#1\strut};
    \draw [line width=2pt,transform canvas={yshift=-0.5mm},color=black] (arced node.south west) parabola [parabola height=-1.5mm] (arced node.south east);
  }
}

\newcommand{\testa}[1]{
  \tikz [baseline=(arced node.base)] {
    \node [inner sep=0pt, outer sep=0pt, draw] (arced node) {#1\vphantom{p}};
    \draw [line width=2pt,transform canvas={yshift=-0.5mm},color=black] (arced node.south west) parabola [parabola height=-1.5mm] (arced node.south east);
  }
}

\newcommand{\testb}[1]{
  \tikz [baseline=(arced node.base)] {
    \node [inner sep=0pt, outer sep=0pt, draw, text depth=.25ex] (arced node) {#1};
    \draw [line width=2pt,transform canvas={yshift=-0.5mm},color=black] (arced node.south west) parabola [parabola height=-1.5mm] (arced node.south east);
  }
}

\begin{document}

ab \test{ab} \test{ap} ap \testa{ab} \testa{ap} ap \testa{ab} \testa{ap}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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