0

Here I need to number only one equation in the first align environment in the MWE. I tried it with align*, numbered the equation with \tag. But then cross-referencing was not working properly.

To give side-notes I am using \tag*{}. But the problem appeared when I am adding a label by \label{eq:1} and side-note by \tag*{ [ Using some formulas] }. Because it gives the whole sidenote [ Using some formulas ] when I mention it later as \eqref{eq:1}. But I don't want that. I want to display the \eqref{eq:1} as an equation number.

\documentclass[12pt]{fphw_assignment_toc}
\usepackage[utf8]{inputenc} 
\usepackage{lipsum}                              
\usepackage[sorting=none, defernumbers=true]{biblatex}      
\usepackage[
     hidelinks,                      % remove ugly borders around clickable cross-references and hyperlinks 
     bookmarksopen,                  % for PDF specific display option
     bookmarksnumbered,              % for PDF specific display option
]{hyperref}
\usepackage{mathtools}                     
\usepackage{amsmath, amsthm, amssymb, amsfonts}     
%........................
\begin{document}
\begin{align}
    P &= ......................................... \nonumber \\
  % some lines of equations
    &=  .........................................\label{eq:1} \tag*{ [ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. ] }  \\
      &= ......................................... \nonumber \\
   % some lines of equations  
    \implies P &\approx ......................................... \tag*{ [ Using \eqref{eq:2} on \eqref{eq:1} ] } \nonumber
\end{align}
\newpage
\lipsum
\begin{align}
      z = ......................................... \label{eq:2} 
\end{align}
\end{document}

I want to have an output like:

          P = ......................................... 
            = .........................................         
                   [ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. ]   (1)
            = .........................................   
       ⇒ P ≈ .........................................      [ Using (2) on (1) ] 
\newpage ...
\lipsum ...
               z = .........................................                       (2)

For sidenotes, I have tried using \text{} instead of \tag*{}. But it crosses the right margin when the sidenote is long. I don't want that either. Is it possible to allow auto-break lines in \text{} and align it properly with the available space? Also, I have noticed, if I click on \eqref{eq:2} on pdf, it doesn't take me exactly at \label{eq:2}.

When is the most efficient way to handle these issues?

raf
  • 633
  • For your MWE, it's best you condense it to the minimum needed to replicate the problem/idea. Also it's best to include the preamble (starting from \documentclass) so we can just copy&paste your code to try some things. – Matthias Arras Oct 06 '20 at 15:07
  • Kindly check it now. – raf Oct 06 '20 at 15:57
  • Please, be so kind and reduce your document example to an MWE (Minimal Working Example), which reproduce your problem, In it the most of packages in your document example is not needed. – Zarko Oct 06 '20 at 16:52
  • I have reduced my package sections. Hope it's okay now. – raf Oct 06 '20 at 17:13
  • 1
    Okay but where one can find the class file fphw_assignment_toc.cls used in your document? Meanwhile, There is no problem with article class. –  Oct 06 '20 at 20:05
  • @ferahfeza, sorry. Now I have added the GitLab link of the class file. – raf Oct 07 '20 at 05:10
  • This question addresses this same situation: Multiline \text in an equation. The only thing I'd add is that the [t] option to \parbox should be considered. (Possible duplicate.) – barbara beeton Oct 09 '20 at 13:40

2 Answers2

1

You can use double && for alignment the text in align environment instead of \tag.

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc} 
\usepackage{lipsum}                              
\usepackage[sorting=none, defernumbers=true]{biblatex}      
\usepackage[
     hidelinks,                      % remove ugly borders around clickable cross-references and hyperlinks 
     bookmarksopen,                  % for PDF specific display option
     bookmarksnumbered,              % for PDF specific display option
]{hyperref}
\usepackage{mathtools}                     
\usepackage{amsmath, amsthm, amssymb, amsfonts}     
%........................
\begin{document}
\begin{align}
    P &= \cdots \nonumber \\
  % some lines of equations
    &= \cdots \label{eq:1} &\qquad &\text{ [ Using some formulas ]}  \\
      &= \cdots \nonumber \\
   % some lines of equations  
    \implies P &\approx \cdots   &\qquad &\text{ [ Using \eqref{eq:2} on \eqref{eq:1} ] } \nonumber
\end{align}
\newpage
\lipsum
\begin{align}
      z = \cdots \label{eq:2} 
\end{align}
\end{document}

enter image description here

  • Sorry, I am not good at making MWE. Kindly check my updated one. Check it with your \text{}. You will see \text{} crosses the right margin for long side-notes. Is it possible to allow auto-break lines in \text{} and align it properly with the available space? – raf Oct 07 '20 at 10:59
1

You can use

\parbox[t]{2cm}{a long text..}

to allow linebreaking but a more standard and better looking layout would be to not put long comments there and place them in normal text before or after the alignment or in \intertext between the lines of an alignment.

David Carlisle
  • 757,742
  • Thank you so much. Is there any way to adjust the width of the \parbox automatically with the available space? Also, can I align the \intertext at the right? – raf Oct 09 '20 at 16:31
  • 1
    @raf 1 not easily, 2 \raggedleft – David Carlisle Oct 09 '20 at 17:32
  • Thank you, but \raggedleft \intertext doesn't produce my desired output. I am satisfied with \parbox. – raf Oct 10 '20 at 06:56