7

I have been using LaTeX for a couple of years now but couldn't find any useful answers related to the following problem that recently came up:

I have several equations in my thesis for which I give derivations in the appendix. Since I do not want to write "see Appendix ... for derivations" every time, I thought I could include some symbol into or at the end of the respective equation number. So far, I have thought of the following:

\documentclass[a5paper]{scrartcl}
\pdfpagewidth=\paperwidth
\pdfpageheight=\paperheight

\usepackage{amsmath}
    \makeatletter
        \def\tagform@#1{\maketag@@@{$\langle$#1$\rangle$\@@italiccorr}}
    \makeatother
    \numberwithin{equation}{section}
    \newcommand{\apptag}{\refstepcounter{equation}\tag*{$\langle$\theequation$\rangle$*}}

\begin{document}

\section{First Section}

Some equation without derivation:
%
\begin{align}
    a + b = c
\end{align}
%
Some equation with derivation:
%
\begin{align}
    d + e = f \label{d_and_e_and_f} \apptag
\end{align}
%

\section{Second Section}

\appendix

\section{Derivations}

To find \ref{d_and_e_and_f}, note that\ldots

\end{document}

This produces the following output:

enter image description here Actually, there are several questions regarding this problem:

  1. Does this circumvent any clever routine in the definition of the \tag macro? I haven't dug into LaTeX this deep, but I want to make sure that this doesn't backfire at some later date.

  2. Is there a more elegant way to achieve the same, possibly using some amsmath functionality that I don't know? As you can see, I've already found and used some 'deeper' code to redefine the parentheses; I wonder if there is something similar that simply adds the star symbol to the equation number if I use some custom command (like \addstartotag) at the end of the respective equation line.

  3. Is there a way to to make the star appear on the right of an imaginary line that aligns the equations?

  4. In the appendix, \ref adds the star, which I don't want. Is there a way to avoid this?

Thanks in advance! :)

5

I would use the mathtools package. It also takes care of the references (i.e. removes the extra characters you inserted.

The key would be to use different tag settings, renewing the default tagform and creating a new one, using \newtagform and the renew one. Please see the documentation of the package for further information.

So my first answer would be:

 \documentclass[a5paper]{scrartcl}
\pdfpagewidth=\paperwidth
\pdfpageheight=\paperheight
\usepackage{amsmath}
\usepackage{mathtools}
\renewtagform{default}{$\langle$}{$\rangle^{\phantom{*}}$}
\newtagform{appendix}{$\langle$}{$\rangle^{*}$}
\numberwithin{equation}{section}
\begin{document}

\section{First Section}

Some equation without derivation:
\usetagform{default}
\begin{equation}
    a + b = c
\end{equation}
%
Some equation with derivation:
%
\usetagform{appendix}
\begin{equation}
    d + e = f \label{d_and_e_and_f} 
\end{equation}
%

\section{Second Section}

\appendix

\section{Derivations}

To find \ref{d_and_e_and_f}, note that\ldots

\end{document}

This produces:

enter image description here

Please note that this is manually aligned with the \phantom instruction.

More refined solution

A second solution would be to define new environments that take care for you about the switching of the tags: in the preamble add the two following lines:

\newenvironment{mynormalequation}{\usetagform{default}\begin{equation}}{\end{equation}}
\newenvironment{myappendixequation}{\usetagform{appendix}\begin{equation}}

it then can be expanded:

\documentclass[a5paper]{scrartcl}
\pdfpagewidth=\paperwidth
\pdfpageheight=\paperheight
\usepackage{amsmath}
\usepackage{mathtools}
\renewtagform{default}{$\langle$}{$\rangle^{\phantom{*}}$}
\newtagform{appendix}{$\langle$}{$\rangle^{*}$}
\newenvironment{mynormalequation}{\usetagform{default}\begin{equation}}{\end{equation}}
\newenvironment{myappendixequation}{\usetagform{appendix}\begin{equation}}{\end{equation}}
\numberwithin{equation}{section}
\begin{document}

\section{First Section}

Some equation without derivation:
%\usetagform{default}
\begin{mynormalequation}
    a + b = c
\end{mynormalequation}
%
Some equation with derivation:
%
%\usetagform{appendix}
\begin{myappendixequation}
    d + e = f \label{d_and_e_and_f} 
\end{myappendixequation}

\begin{mynormalequation}
c=d
\end{mynormalequation}

\begin{mynormalequation}
c=d+0
\end{mynormalequation}

\begin{myappendixequation}
    d + e = f +0\cdot g\label{d_and_e_and_f_andg} 
\end{myappendixequation}


\section{Second Section}

\appendix

\section{Derivations}

To find \ref{d_and_e_and_f}, note that\ldots

\end{document}

Still yielding:

enter image description here

| improve this answer | |
  • That is almost what I was looking for... unfortunately, \usetagform doesn't work within the equation environment but only if placed before it. Having it on the inside would be useful to mark only one of several equations (which happens here and there at least in my thesis). Keeping it outside forces me to put them into several environments. In any case: Thank you! – loremipsum Apr 10 '17 at 15:55
  • @loremipsum you mean having subequations or similar of which only one has the star? – Moriambar Apr 10 '17 at 15:57
  • @loremipsum also: have you seen the refined solution? That does not require you to specify anything other than the environment – Moriambar Apr 10 '17 at 15:59
  • I'm not sure what you mean by "subequations"---isn't that some other (sub-)environment? I often have environments with a couple of equations in several lines. There may be tags for various lines, but every line should be able individually to carry the * sign if need be. – loremipsum Apr 10 '17 at 16:00
  • Yes, I've seen the refined solution and played around with it a bit. Maybe it's just me, but I couldn't get the 'individual-star solution' to work (as explained in my above comment). – loremipsum Apr 10 '17 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.