5

Currently, if I want to make my TikZ images independant of coordinates, I use

\newcommand\AX{0}
\newcommand\AY{1}

Can I create one coordiante for one point? How can I access the x-part or the y-part if it is possible?

4
\documentclass{article}
\makeatletter
\newcommand*\getX[1]{\expandafter\getX@i#1\@nil}
\newcommand*\getY[1]{\expandafter\getY@i#1\@nil}
\def\getX@i#1,#2\@nil{#1}
\def\getY@i#1,#2\@nil{#2}
\makeatother

\begin{document}
\newcommand\A{1,-1}
my coordinates: \getX{\A},\getY{\A}

\end{document}

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.