4

I'd like to place some text along a path in TikZ. Said text is a quote, and for quotes I invariably reach for the csquotes package. However, \enquote does not appear to work when used with text along paths.

Consider the following FMWE (fairly minimal working example):

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\usepackage{csquotes}
\begin{document}
\begin{tikzpicture}
\node at (0,-1) {\enquote{Howdy}};
\path[decorate, decoration={text along path, text={\enquote{Text along an arc}}}] (0, 0) arc[start angle=270, end angle=360, radius=3];
\end{tikzpicture}
\end{document}

Attempting to compile this causes xelatex, pdflatex or whatever other compile I use to hang indefinitely. Removing the \enquote in the path decoration makes everything work. The included node shows that csquotes is not in principle incompatible with TikZ.

So, my questions are:

  1. why doesn't \enquote work here?
  2. how can I make it work?
  3. if I can't make it work, is there another way of getting typographically correct quotation marks without having to manually choose them?

Thanks.

EDIT: I've since found it's not only \enquote that's causing trouble but also such things as \dots. My first two questions, at the very least, remain.

1 Answer 1

7

The decoration splits the text argment up in tokens and places them individually, i.e. \enquote and then Text along an arc. See the explanation in the manual. You can't use \enquote here just as much as you wouldn't be able to use \textbf for example.

Luckily, the csquotes package provides some user-macros discussed in section §11.6 of its manual, amongst others these are \textooquote (opening/outer) and \textcoquote (closing/outer). With these, the text at least will use the auto style provide by the facilities of the csquotes package.

These, you will have to enclose in {} as well.

Without csquotes you would have to manually enter the literal quotation marks of your language. In that case, they would need to be enclosed in {} as well unless you were using LuaLaTeX.

Code

\documentclass[tikz]{standalone}
%\documentclass{article}
%\usepackage{tikz}
\usetikzlibrary{decorations.text}
\usepackage{csquotes}
\begin{document}
\begin{tikzpicture}
\node at (0,-1) {\enquote{Howdy}};
\path[
  decorate,
  decoration={
    name=text along path,
    text={\textooquote}Text along an arc{\textcoquote}
  }
] (0, 0) arc[start angle=270, end angle=360, radius=3];
\end{tikzpicture}
\end{document}

Output

enter image description here

1
  • 1
    +1 I couldn't get my answer using \textooquote etc. to work because I didn't realize they need to the braced.
    – Alan Munn
    Dec 3, 2023 at 22:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .