3

The Japanese character "yo", よ, is often used to denote the Yoneda embedding in category theory. Wanting to denote a related operator with the horizontally reflected character, I created a macro employing the \reflectbox command from the adjustbox package. Meanwhile, I am using tikz-cd to format commutative diagrams. Normally, tikz-cd resizes labels on arrows in diagrams, but reflectbox interferes with this somehow. The following MWE,

\documentclass[a4paper,10pt]{amsart}

\usepackage{adjustbox}
\usepackage{tikz-cd}

\DeclareFontFamily{U}{min}{}
\DeclareFontShape{U}{min}{m}{n}{<-> udmj30}{}
\newcommand{\yo}{\!\text{\usefont{U}{min}{m}{n}\symbol{'210}}\!}
\newcommand{\yoco}{\reflectbox{\yo}}

\begin{document}

\[
\begin{tikzcd}[ampersand replacement=\&]
    \& \cdot \\
    {\yoco(C)} \&\& {\yo(D)} \\
    {\yoco(C')} \&\& {\yo(D')} \\
    \& \cdot
    \arrow["{\yoco(f)}"'{color = red}, from=2-1, to=3-1]
    \arrow["{[x]}"{near end}, from=2-1, to=2-3]
    \arrow["{\yo(g)}", from=2-3, to=3-3]
    \arrow["{[y]}"'{near end}, from=3-1, to=3-3]
    \arrow[dotted, no head, from=1-2, to=4-2]
\end{tikzcd}
\]

\end{document}

produces the following diagram as output: Diagram in which the left-hand label, containing a horizontally reflected "yo" (highlighted in red for emphasis) is not properly rescaled.

The left-hand arrow label has not resized properly, which is a problem as soon as both versions of "yo" appear as labels in a diagram. How should I modify my code to rectify this? Is it related to the choice of document style (amsart)?

3
  • not that it matters but \reflectbox comes from graphicx package Nov 21, 2023 at 16:57
  • 2
    I think the label is scriptsize, you may want \text{\reflectbox... so the ams \text macro chooses teh right size, as you did in \yo Nov 21, 2023 at 17:00
  • That fixes it right away, thanks! Nov 21, 2023 at 20:15

2 Answers 2

6

You can simplify the example to

enter image description here

\documentclass[a4paper,10pt]{amsart}

\usepackage{graphicx}

\begin{document}

\[
a^{\text{F}} + a^{\reflectbox{F}} + a^{\text{\reflectbox{F}}}
\]

\end{document}

\reflectbox acts like \mbox and prevents things getting smaller in scriptstyle. The amsmath macro \text sets such boxes at a suitable size in script and scriptscript styles, as shown in the third term above.

So the difference between your definitions was the use or not of \text and adding \text produces the result you expected.

\newcommand{\yoco}{\text{\reflectbox{\yo}}}

3

When \text is inside \reflectbox it's already in text mode, so it is the same as \mbox and doesn't scale.

I suggest to split the definition, for efficiency.

\documentclass[a4paper,10pt]{amsart}
\usepackage{graphicx}
\usepackage{tikz-cd}

\DeclareFontFamily{U}{min}{}
\DeclareFontShape{U}{min}{m}{n}{<-> udmj30}{}
\newcommand{\yochar}{\usefont{U}{min}{m}{n}\symbol{'210}}
\NewDocumentCommand{\yo}{}{\!\text{\yochar}\!}
\NewDocumentCommand{\yoco}{}{\!\text{\reflectbox{\yochar}}\!}

\begin{document}

\[
\begin{tikzcd}
    & \cdot \\
    {\yoco(C)} && {\yo(D)} \\
    {\yoco(C')} && {\yo(D')} \\
    & \cdot
    \arrow["{\yoco(f)}"'{color = red}, from=2-1, to=3-1]
    \arrow["{[x]}"{near end}, from=2-1, to=2-3]
    \arrow["{\yo(g)}", from=2-3, to=3-3]
    \arrow["{[y]}"'{near end}, from=3-1, to=3-3]
    \arrow[dotted, no head, from=1-2, to=4-2]
\end{tikzcd}
\]

\end{document}

With \NewDocumentCommand you won't worry about the commands appearing in “risky” contexts.

enter image description here

You must log in to answer this question.

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