You misunderstand how TeX works. The meaning of a macro can be different in different parts of the document. When TeX reads the document, it does not replace all of '\aWord' in one go. Instead, it reads the file a line at a time. So first it finds
\newcommand{\aWord}{a word}
which defines \aWord ...
Search found 4 matches
- Thu Mar 17, 2011 4:08 pm
- Forum: General
- Topic: renewcommand not working backwards?
- Replies: 5
- Views: 3399
- Thu Mar 17, 2011 1:05 am
- Forum: Fonts & Character Sets
- Topic: Typing »^« in LaTeX
- Replies: 2
- Views: 1777
Typing »^« in LaTeX
Did you try:
Code: Select all
Something \^{}VP
- Thu Mar 17, 2011 12:45 am
- Forum: General
- Topic: renewcommand not working backwards?
- Replies: 5
- Views: 3399
renewcommand not working backwards?
Clarification: In the code below:
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\begin{document}
\newcommand{\aWord}{a word}
Testing \aWord
% -- a long document later -- %
\renewcommand{\aWord}{another word}
Testing \aWord
\end{document}
I don't ...
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\begin{document}
\newcommand{\aWord}{a word}
Testing \aWord
% -- a long document later -- %
\renewcommand{\aWord}{another word}
Testing \aWord
\end{document}
I don't ...
- Wed Mar 16, 2011 10:35 pm
- Forum: General
- Topic: renewcommand not working backwards?
- Replies: 5
- Views: 3399
renewcommand not working backwards?
How do I "save" a word in latex' memory? I.e. a word that is given later in the document, how can I use it at the beginning of the document e.g. with newcommand and renewcommand:
\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\begin{document}
\newcommand{\aWord}{a word ...
\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\begin{document}
\newcommand{\aWord}{a word ...