[Tex/LaTex] How to get decoration text to be right side up instead of upside down

arrowsdecorations

I am drawing arrows in a block diagram and using decorations.text to label them. Arrows going left to right are fine: the labels are upright. But arrows going right to left are appearing upside down.

For example:

\documentclass{article}
\usepackage{tikz}
\usepackage[graphics, active, tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\usetikzlibrary{positioning, arrows.meta, bending, decorations.text}
\begin{document}
\begin{tikzpicture}
\node (aa) at (0,0) {A};
\node (bb) [right= 5cm of aa] {B};
\draw [-latex] [postaction={
    decoration={text along path, text align=center, raise={1em},
        text={Hello World}}, decorate
        }]
    (aa) to [bend right=45] (bb);
\draw [-latex] [postaction={
    decoration={text along path, text align=center, raise={1em},
        text={Goodbye World}}, decorate}]
    (bb) to [bend right=45] (aa);
\end{tikzpicture}
\end{document}

How does one get "Goodbye World" to appear right side up? (I know I can use latex- to reverse the arrows, but in a complex drawing I'd prefer to draw the arrows the way flows actually happen in my model.)

Best Answer

You can add reverse path to the edge options. By the way, I suggest you start using the standalone class, which is very handy for typesetting single tikzpictures. It even has the options tikz (loads the package) and preview. See the link to the manual for more details (class is on page 7).

Edit: As A.Ellett rightfully pointed out, ex measurement is usually adopted for vertical shifting and em for horizontal shifting.

Output

enter image description here

Code

\documentclass[tikz,margin=15pt]{standalone}
\usetikzlibrary{positioning, arrows.meta, bending, decorations.text}

\begin{document}
\begin{tikzpicture}
\node (aa) at (0,0) {A};
\node (bb) [right= 5cm of aa] {B};
\draw [-latex] [postaction={
    decoration={text along path, text align=center, raise={1ex},
        text={Hello World}}, decorate
        }]
    (aa) to [bend right=45] (bb);
\draw [-latex] [postaction={
    decoration={text along path, text align=center, raise={-2.5ex},reverse path,
        text={Goodbye World}}, decorate}]
    (bb) to [bend right=45] (aa);
\end{tikzpicture}
\end{document}
Related Question