4

I occasionally need to insert a placeholder equation (or set of equations) in a large technical document, to be filled in later. This is useful when making references to the equation or aligns in the text ("As we see in Eq.~\ref{eq:EnergyStates}..." or "As we see in \eqref{eq:EnergyStates}...") and when I want to see the ultimate layout.

We have lipsum for text and example-image for images. Is there an equivalent for sample equations or eqaligns (of specified size or number of typeset lines)?

If not, I humbly suggest a format such as:

\example-align[n]

where n is an integer stating the expected number of typeset lines.

Then in the code we could include:

\begin{align} \label{eq:EnergyStates}
\example-align[4]
\end{align}

(Of course the exact height in the text will depend upon the eqligns themselves, but this is much like calling paragraphs from lipsum where we cannot be sure ahead of time the length of text that will be included.)

I generally do not need the equation numbers for each of the aligns (or eqarray lines)... just for the whole set.

I would also like the typeset document to show bona-fide EQUATIONS (integral signs, fractions, square root signs,...) to give a sense of the final appearance. After all, we do precisely this with lipsum.

9
  • An equation has just one line.
    – egreg
    Jun 5, 2019 at 23:03
  • @egreg: Not so---at least not so for the number of typeset lines: images.search.yahoo.com/yhs/… Jun 5, 2019 at 23:05
  • You're confusing equation with align. If you want align with, say, three equations and three labels, do \begin{align} 1 \label{one} \\ 2 \label{two} \\ 3 \label{three}\end{align}.
    – egreg
    Jun 5, 2019 at 23:07
  • 2
    For a single math formula, you may benefit from the blindtext package. For example, you can define a macro like \makeatletter\newcommand{\blindequation}{\blindtext@formula}\makeatother and use \blindequation wherever you want a formula.
    – AboAmmar
    Jun 5, 2019 at 23:52
  • 1
    your suggested syntax is hard as you can not have - in a command name. Jun 6, 2019 at 6:53

1 Answer 1

2

To give you a starting point please see the following mwe. It seems you need as most important function to be able to add an label to your example formula, so that you can reference to it with \eqref or \ref. The number of lines for the example formula seems not to be so important (how do you know how many line you will need for the real formula to be inserted later?) so I leave that for you to do ...

Let us define the following command \blindequation (please see that your suggested command name is not usable because the included - not allowed in command names!) with one parameter for the label:

%\blindequation{eq:label}
\newcommand{\blindequation}[1]{%
  \begin{equation}
    \int_0^\infty e^{-\alpha x^2} \mathrm{d}x = 
    \frac12\sqrt{\int_{-\infty}^\infty e^{-\alpha x^2}}
    \mathrm{d}x\int_{-\infty}^\infty e^{-\alpha y^2}\mathrm{d}y =
    \frac12\sqrt{\frac{\pi}{\alpha}} \label{#1}
 \end{equation}
} 

We can use it for example with \blindequation{eg:einstein} and then we are able to reference to it with \ref{eg:einstein} or \eqref{eq:einstein}.

So please see the following complete mwe

\documentclass{article}

\usepackage{amsmath}

%\blindequation{eq:label}
\newcommand{\blindequation}[1]{%
  \begin{equation}
    \int_0^\infty e^{-\alpha x^2} \mathrm{d}x = 
    \frac12\sqrt{\int_{-\infty}^\infty e^{-\alpha x^2}}
    \mathrm{d}x\int_{-\infty}^\infty e^{-\alpha y^2}\mathrm{d}y =
    \frac12\sqrt{\frac{\pi}{\alpha}} \label{#1}
 \end{equation}
}


\begin{document}

\blindequation{eq:EnergyStates}

See~\eqref{eq:EnergyStates} \dots
As we see in Eq.~\ref{eq:EnergyStates} \dots

%\blindtext

\blindequation{eq:Energy}
See~\eqref{eq:Energy} \dots
As we see in Eq.~\ref{eq:Energy} \dots

\end{document}

and its result:

resulting pdf

The advantage with this is that you can use already for your example formulas the later to be used label and you can check, if the references to the formulas are okay. The disadvantage is you have to add an label for each example formula and I did no proof that there is one in the code ...

I think this is a starting point you can use to develop that tool that you (and your team?) need for your work ...

Edit:

To add a special number of equations with one command you can use the following definition to be able to use the following command \blindequation[3]{eq:label} to add 3 lines of equations labeled with \label{eg:label} (first line), \label{eg:label-2} (second line) and \label{eg:label-3} (third line):

%\blindequation[3]{eq:label}
\newcommand{\blindequation}[2][1]{%
  \ifcase#1\relax % 0 should not happen ...
    \or 
      \begin{align}
          a %= b         \label{#2}
      \end{align}
    \or
      \begin{align}
          a + x &= 2     \label{#2}\\
              x &= 2 - a \label{#2-2}
      \end{align}
    \else %all other possible numbers are handled here:
      \begin{align}
        a + b + x &= 3        \label{#2}\\
        a     + x &= 3 - b    \label{#2-2}\\
        x         &= 3 - b -a \label{#2-3}
      \end{align}
  \fi%
}

With \ifcase#1 you can decide how many equation lines you need (#1 contains the needed lines). With \relax we declare that number 0 will never happen. Comand \else makes sure that also greater numbers are handled. For example here the last number defined with \else is three lines, but because \else you can use option [11] in your command with no error message, but getting only 3 lines layouted ...

If you want to label only one line of n equations lines, you can define it by using the following code:

  \begin{align}
      a + b + c +d +e +f +g +x &= 8                     \nonumber\\
      a + b + c +d +e +f    +x &= 8 -g                  \nonumber\\
      a + b + c +d +e       +x &= 8 -g -f               \nonumber\\
      a + b + c +d          +x &= 8 -g -f -e            \nonumber\\
      a + b + c             +x &= 8 -g -f -e -d         \label{#2}\\
      a + b                 +x &= 8 -g -f -e -d -c      \nonumber\\
      a                     +x &= 8 -g -f -e -d -c -b   \nonumber\\
                             x &= 8 -g -f -e -d -c -b -a\nonumber
  \end{align}

Command \nonumber does not allow to number the line, and of course you can put the \label{#2} into that line you generaly want to be numbered ...

I do not know with which art of formulas you are working, so I simply added an very simple equation system to the following mwe and let it for you to add formulas in it you want to see there ...

With the following mwe

\documentclass{article}

\usepackage{amsmath}

%\blindequation[3]{eq:label}
\newcommand{\blindequation}[2][1]{%
  \ifcase#1\relax % 0 should not happen ...
    \or 
      \begin{align}
          \int_0^\infty e^{-\alpha x^2} \mathrm{d}x = 
          \frac12\sqrt{\int_{-\infty}^\infty e^{-\alpha x^2}}
          \mathrm{d}x\int_{-\infty}^\infty e^{-\alpha y^2}\mathrm{d}y =
          \frac12\sqrt{\frac{\pi}{\alpha}} \label{#2}
      \end{align}
    \or
      \begin{align}
          a + x &= 2     \label{#2}\\
              x &= 2 - a \label{#2-2}
      \end{align}
    \or
      \begin{align}
          a + b + x &= 3        \label{#2}\\
          a     + x &= 3 - b    \label{#2-2}\\
          x         &= 3 - b -a \label{#2-3}
      \end{align}
    \or
      \begin{align}
          a + b + c +x  &= 4           \label{#2}\\
          a + b     +x  &= 4 - c       \label{#2-2}\\
          a         +x  &= 4 - c - b   \label{#2-3}\\
                    +x  &= 4 - c - b -a\label{#2-4}
      \end{align}
    \or
      \begin{align}
          a + b + c +d +x &= 5            \label{#2}\\
          a + b + c    +x &= 5 -d         \label{#2-2}\\
          a + b        +x &= 5 -d -c      \label{#2-3}\\
          a            +x &= 5 -d -c -b   \label{#2-4}\\
                        x &= 5 -d -c -b -a\label{#2-5}
      \end{align}
    \or
      \begin{align}
          a + b + c +d +e +x &= 6               \label{#2}\\
          a + b + c +d    +x &= 6 -e            \label{#2-2}\\
          a + b + c       +x &= 6 -e -d         \label{#2-3}\\
          a + b           +x &= 6 -e -d -c      \label{#2-4}\\
          a               +x &= 6 -e -d -c -b   \label{#2-5}\\
                           x &= 6 -e -d -c -b -a\label{#2-6}
      \end{align}
    \or
      \begin{align}
          a + b + c +d +e +f +x &= 7                  \label{#2}\\
          a + b + c +d +e    +x &= 7 -f               \label{#2-2}\\
          a + b + c +d       +x &= 7 -f -e            \label{#2-3}\\
          a + b + c          +x &= 7 -f -e -d         \label{#2-4}\\
          a + b              +x &= 7 -f -e -d -c      \label{#2-5}\\
          a                  +x &= 7 -f -e -d -c -b   \label{#2-6}\\
                              x &= 7 -f -e -d -c -b -a\label{#2-7}
      \end{align}
    \or
      \begin{align}
          a + b + c +d +e +f +g +x &= 8                     \nonumber\\
          a + b + c +d +e +f    +x &= 8 -g                  \nonumber\\
          a + b + c +d +e       +x &= 8 -g -f               \nonumber\\
          a + b + c +d          +x &= 8 -g -f -e            \nonumber\\
          a + b + c             +x &= 8 -g -f -e -d         \label{#2}\\
          a + b                 +x &= 8 -g -f -e -d -c      \nonumber\\
          a                     +x &= 8 -g -f -e -d -c -b   \nonumber\\
                                 x &= 8 -g -f -e -d -c -b -a\nonumber
      \end{align}
    \else %9
      \begin{align}
          a + b + c +d +e +f +g +h +x &= 9                        \label{#2}\\
          a + b + c +d +e +f +g    +x &= 9 -h                     \label{#2-2}\\
          a + b + c +d +e +f       +x &= 9 -h -g                  \label{#2-3}\\
          a + b + c +d +e          +x &= 9 -h -g -f               \label{#2-4}\\
          a + b + c +d             +x &= 9 -h -g -f -e            \label{#2-5}\\
          a + b + c                +x &= 9 -h -g -f -e -d         \label{#2-6}\\
          a + b                    +x &= 9 -h -g -f -e -d -c      \label{#2-7}\\
          a                        +x &= 9 -h -g -f -e -d -c -b   \label{#2-8}\\
                                    x &= 9 -h -g -f -e -d -c -b -a\label{#2-9}
      \end{align}
    \fi%
}


\begin{document}

\blindequation[1]{eq:test}
1 See~\eqref{eq:test} \dots
As we see in Eq.~\ref{eq:test} \dots

\blindequation[3]{eq:EnergyStates}

3 See~\eqref{eq:EnergyStates} \dots
As we see in Eq.~\ref{eq:EnergyStates-2} \dots

%\blindtext

should not happen: \blindequation[0]{eq:Energy} number 0

\blindequation[5]{eq:Einstein}
5 See~\eqref{eq:Einstein} \dots
As we see in Eq.~\ref{eq:Einstein-3} \dots

\blindequation{eq:testerle}
1 See~\eqref{eq:testerle} \dots
As we see in Eq.~\ref{eq:testerle} \dots

\blindequation[8]{eq:testerlea}
8 See~\eqref{eq:testerlea} \dots
As we see in Eq.~\ref{eq:testerlea} \dots

\blindequation[15]{eq:testerleb}
15 See~\eqref{eq:testerleb} \dots
As we see in Eq.~\ref{eq:testerleb-9} \dots % \ref{eq:testerleb-10} is not working!
\end{document}

giving the result:

page one

You can see that the case of using a zero as number of printed equation is simply not executed, the numbering of line is done (as you wish?) and you can reference each line if you need to (simple rule: you have n lines of equations. The first line is referenced with your given label, for example \ref{eq:einstein}, the second line can then be referenced with \ref{eq:einstein-2} etc. until \ref{eq:einstein-n}).

Now let us look to the second page:

page two

I have called the command \blindequation[15]{eq:testerleb} to get 15 lines, but only 9 are defined. So you get only 9 equation lines printed and you also get only 9 labels to be active: \ref{eq:testerleb}, \ref{eq:testerleb-2} until \ref{eq:testerleb-9} ...

0

You must log in to answer this question.

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