3

I'm using the packages tipa and tikz in the document class beamer. However, I'm having a hard time trying to combine them when drawing arrows. Look at the MWE below:

\documentclass{beamer}

\usepackage{tipa}
\usepackage{tikz} % if i remove package from preamble i get error message


\begin{document}
    
    \tikzstyle{every picture}+=[remember picture]
    \tikzstyle{na} = [shape=rectangle,inner sep=0pt,text depth=0pt]
    
    \begin{frame}

        \centering
        
        Text [ t ] more text [ \textsubbridge{t} ]
        
        \vspace{2em}
        
        symbol 1 and symbol 2
    
    \end{frame}
    
    \begin{frame}

        \centering
        
        Text [ \tikz\node[na](t1){t}; ] more text [ \tikz\node[na](t2){\textsubbridge{t}}; ]
        
        \vspace{2em}
        
        \tikz\node[na](n1){symbol 1}; and \tikz\node[na](n2){symbol 2};
        
        \begin{tikzpicture}[overlay]
            \path[->,red,thick](n1) edge (t1);
            \path[->,red,thick](n2) edge (t2);
        \end{tikzpicture}
        
    \end{frame}
\end{document}

Slide with no arrows:

enter image description here

Slide with arrows:

enter image description here

As you can see, when I add the arrow, it blocks part of the symbol, which is an important part of the symbol. How can I lower the arrow so that it doesn't cover any part of the second symbol?

PS: I know that beamer automatically loads the tikz package. However, for this MWE I kept getting an error if I don't load it manually. I believe it has to do with the definition of the tikzstyle{na}, but if I'm wrong, feel free to correct me.

3
  • (Unrelated to the actual question, but) if you have access to Xe/LuaLaTeX, using package tipauni might be advisable as it will render searchable|copy-able|past-able Unicode characters in the output. If you want the beamer fonts to be intact, you can \usepackage[documentfont=CMUSansSerif]{tipauni}.
    – Niranjan
    Feb 25 at 5:21
  • @Niranjan, I just tried loading this package, and I got the following error: File tipauni.sty not found. ^^M. I'm assuming that means I don't have access to Xe/LuaLaTeX.
    – Ernesto
    Feb 27 at 1:48
  • No. This means that you need the tipauni.sty i.e. the actual package file. You might be using an old installation. From TeX Live 2022 onward tipauni will be by default present. If you are using TeX Live 2021, please try tlmgr install tipauni. For installing the package locally; you can follow the instructions given here. Also simply adding the line in your code might not change the compiler. You have to manually change it from PDFLaTeX to Xe/LuaLaTeX.
    – Niranjan
    Feb 27 at 15:50

1 Answer 1

7
  • The beamer class doesn't load tikz automatically, which explains why it has to be loaded.

  • \tikzstyle is deprecated in favor of \tikzset.

  • Your problem is caused by text depth=0pt. Probably you do that to align the characters on the baseline, but this can be achieved using the baseline option.

  • To make text elements the source or target of arrows, you can use the \tikznode command described here. It corresponds roughly to your \tikz\node[na] (with the above problems removed).

  • To keep a bit of distance between the arrows and their targets, you can use the options shorten <=1pt,shorten >=1pt.

  • You might prefer other arrow heads, like \tikzset{>=stealth}.

enter image description here

\documentclass{beamer}
\usepackage{tipa}
\usepackage{tikz}
\newcommand\tikznode[3][]%
   {\tikz[remember picture,baseline=(#2.base)]
      \node[minimum size=0pt,inner sep=0pt,#1](#2){#3};%
   }
\tikzset{%
   every picture/.append style={remember picture},
   >=stealth  
}
\begin{document}
\begin{frame}
\centering
Text [ \tikznode{t1}{t} ] more text [ \tikznode{t2}{\textsubbridge{t}} ]
\vspace{2em}
        
\tikznode{n1}{symbol 1} and \tikznode{n2}{symbol 2}
        
\begin{tikzpicture}[overlay,shorten >=1pt,shorten <=1pt]
   \path[->,red,thick](n1) edge (t1);
   \path[->,red,thick](n2) edge (t2);
\end{tikzpicture}
\end{frame}
\end{document}
2
  • This works well. Thanks for the pointers re: tikz conventions. Also, it looks like in your code the ; is no longer needed at the end when defining the node.
    – Ernesto
    Jan 16 at 22:24
  • @Ernesto Thanks for the note regarding the semicolons, I removed them.
    – gernot
    Jan 17 at 9:00

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.