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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

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.