1

I'm rotating my text in a table cell with a \newcommand{\up}{\rotatebox[origin=c]{90}} definition. Sometimes it's good to rotate and align text left/right not centered.

So I would like to change that definition to take a second value that can be origin=l.

I found this but I'm not able to get a functional newcommand with second parameter something like \newcommand{\up{#2}}{\rotatebox[origin=#2]{90}}.

I wold like to use it like this: \up{l}{text}

Can somebody help me with that?

MWiesner
  • 225
novski
  • 1,039

1 Answers1

1

Do you want something like this?

\documentclass{article}
\usepackage{graphicx}

\newcommand{\up}[2]{\rotatebox[origin=#1]{90}{#2}}

\begin{document}

        \begin{tabular}{ll}
            \up{c}{First First} & \up{l}{First Second}\\
            Second First & Second Second
        \end{tabular}

\end{document}
bmv
  • 3,588
  • Exactly works perfect. Can you explane why the number [2] is in brackets at the start and the alignment parameter is #1 followed by a #2 at the end? i don't understand the syntaxt here... – novski Feb 10 '18 at 18:44
  • The syntax of \newcommand is: \newcommand{\mycommand}[number of arguments]{definition of the command}. You can refer to the arguments as #1, #2, #3 etc. – bmv Feb 10 '18 at 22:08