0

I have several piece of text for which I would like to be able to change easily the order in which they appear. Is there a way to do that?

The only solution I found until now is the following:

\documentclass{article} 
\newcommand{\firsttext}{blabla 1}
\newcommand{\secondtext}{$$blabla 2$$}
\newcommand{\thirdtext}{{\Large blabla 3}}  
\begin{document}
\firsttext
\secondtext
\thirdtext
\end{document}

with output

enter image description here

In this way I can easily change the order of the paragraphs just by switching the call for macros in the document. For example

\documentclass{article} 
\newcommand{\firsttext}{blabla 1}
\newcommand{\secondtext}{$$blabla 2$$}
\newcommand{\thirdtext}{{\Large blabla 3}}  
\begin{document}
\secondtext
\thirdtext
\firsttext
\end{document}

outputs enter image description here

The problem of this method is that the text that can be defined in the \newcommand{}{} is very limited. For example, I get an error if I replace
\newcommand{\secondtext}{$$blabla 2$$}
by \newcommand{\secondtext}{ \begin{equation*}blabla 2\end{equation*}}

However, the text I would like to easily be able to switch contains theorems, equations, etc...

Is there a proper way to do that?

3
  • 2
    You need \usepackage{amsmath} to use equation*, add that and it works. Oct 1, 2015 at 14:49
  • 1
    As @TorbjørnT. said. You get the same error if you use the equation* environment normally as part of your document body because it simply isn't defined. \usepackage{mathtools} solves the problem.
    – cfr
    Oct 1, 2015 at 14:53
  • :), ok that's great thank you 2. But I have then another problem. If I want to acces the Latex code for an equation from the PDF (rightclick with Texmaker) then it is not possible anymore. So I'm still interested in some better solution.
    – Surb
    Oct 1, 2015 at 14:56

1 Answer 1

1

As @Torbjørn T. and @cfr pointed out in the comments, the issue is that a package is missing in order to use the equation* environnement.

The problem can be solved by simply adding \usepackage{amsmath} or \usepackage{mathtools} in the preamble.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .