General ⇒ Use a predefined newcommand in another newcommand.
Use a predefined newcommand in another newcommand.
\newcommand{A}{This}
and then
do \newcommand{B}{\A\A} to get \B = ThisThis ??
I tried but it won't work. How can I do to solve this problem? I would like to have a hierarchical way of defining new commands.
Thanks!!
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Use a predefined newcommand in another newcommand.
Code: Select all
\documentclass{article}
\newcommand{\A}{This}
\newcommand{\B}{\A\A}
\begin{document}
\B
\end{document}
Re: Use a predefined newcommand in another newcommand.
As someone who always wonder what went wrong, I guess
I have goofed up when I tried something like
\newcommand{\PDF}{A}
\newcommand{\PDFa}{\PDF/a}
I think..
Thanks for the reply ! If not, I would have an ugly layout in my document!
Re: Use a predefined newcommand in another newcommand.
\PDFa is working fine. I must have used \PDF1a (which broke the newcommand, I thought the little 'a' will
make LaTeX view PDF1a as a whole unit, but apparently not.), and I believe the true reason is that the newcommand does not like weird
characters. Thanks for the patience if you have followed so far...
-
- Site Moderator
- Posts: 814
- Joined: Tue Jul 01, 2008 2:19 pm
Re: Use a predefined newcommand in another newcommand.
--
Joseph Wright