The source of the difficulty is that ellipses are constructed in a particular way in TikZ. They are paths that start from the x-axis and proceed counter-clockwise around their centre. The vast majority of the time, the exact parametrisation doesn't matter. You appear to have found the one situation where it does!
In the actual question, you only want to be able to mirror the ellipse, and so draw it starting from the negative x-axis (the title of the question suggests a more flexible approach). That's actually not too hard since we can exploit the symmetry of the ellipse. The key is to provide it with a negative x-radius, since then it will start from the negative x-axis (and proceed clockwise, but we could correct for that by negating the y-radius as well). To do this, we interrupt the call from the node shape to the drawing command and flip the sign of the x-radius. The simplest way to do this is to redefine the \pgfpathellipse
macro to do the negation and then call the original macro. The following code does this.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations,shapes,decorations.markings}
\makeatletter
\let\origpgfpathellipse=\pgfpathellipse
\def\revpgfpathellipse#1#2#3{%
#2%
\pgf@xa=-\pgf@x
\origpgfpathellipse{#1}{\pgfqpoint{\pgf@xa}{0pt}}{#3}}
\makeatother
\tikzset{
reversed ellipse/.style={
ellipse,
reverse the ellipse%
},
reverse the ellipse/.code={
\let\pgfpathellipse=\revpgfpathellipse
}
}
\begin{document}
\begin{tikzpicture}
\node[ellipse,
draw,
postaction={
decorate,
decoration={
markings,
mark=at position 1 with {
\arrow[line width=5pt,blue]{>}
}
}
}
] at (0,0) {hello world};
\node[reversed ellipse,
draw,
postaction={
decorate,
decoration={
markings,
mark=at position 1 with {
\arrow[line width=5pt,blue]{>}
}
}
}
] at (0,-2) {hello world};
\end{tikzpicture}
\end{document}
Here's the result:
(the arrow got clipped, but you can see where it lies)
As far as tikz-cd
is concerned, there is no way to point to a particular character in a cell, because all the commands refer to a cell. So there are two ways I can think of:
use the option shift left=<dimension>
(or shift right
) to manually adjust the arrows position. This will work for you because the characters in your example case are on top of each other but it's manual and it might not work for other cases. So I think in your case the best solution is the second one.
draw the diagram and the use tikzmark and TikZ do draw the arrows. I haven't tested this, but tikzmark has worked before inside a math environment, so it should work.
I don't know the other package so I can't speak on that. If I come up with a better solution, I'll edit the answer.
Best Answer
I would recommend the
tikz-cd
package for your commutative diagrams; the package documentation contains examples, like the one for the next example:Regarding your LaTeX system, the best thing is to keep your installation updated. Install the latest MiKTeX version and do a complete installation, not just the basic MiKTeX installation.
Regarding the problem mentioned, in a comment, you can use
swap
to change the position for the label for the arrow: