Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted
\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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.