Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The annotate command adds a line after the equation if used outside the equation #24

Open
munael opened this issue May 17, 2024 · 1 comment

Comments

@munael
Copy link

munael commented May 17, 2024

Problem

When the \annotate command is used outside the math environment (as the examples use it), and extra line/paragraph is added after the math environment.

If instead one puts the \annotate command inside the math environment, such before \end{equation}, then no extra line is added. The user then needs to add \vspace explicitly to add spacing for the annotation labels that are rendered below, which is consistent with the requirements for those rendered above.

Example

Output

Note the line 223.

image

Code

Some text before.

\begin{equation}
    \eqnmark[red]{node1}{x} = \eqnmark[blue]{node2}{y}
\end{equation}
\annotate[yshift=0.2em]{above,left}{node1}{fubar X}
\annotate[yshift=0.2em]{above,right}{node2}{hello Y}

Some text after.

Some text before.

\begin{equation}
    \eqnmark[red]{node1}{x} = \eqnmark[blue]{node2}{y}
\annotate[yshift=0.2em]{above,left}{node1}{fubar X}
\annotate[yshift=0.2em]{above,right}{node2}{hello Y}
\end{equation}

Some text after.

Some text before.

\begin{equation}
    \eqnmark[red]{node1}{x} = \eqnmark[blue]{node2}{y}
\end{equation}

Some text after.
@munael
Copy link
Author

munael commented May 17, 2024

Explanation and Workaround

The \annotate command is treated as a paragraph started in some way. So if you put the text that comes later right after it, the line disappears. You can also put a commented line instead of a new line.

\begin{equation}
    \eqnmark[red]{node1}{x} = \eqnmark[blue]{node2}{y}
\end{equation}
\annotate[yshift=0.2em]{above,left}{node1}{fubar X}
\annotate[yshift=0.2em]{above,right}{node2}{hello Y}
% !!! This is changed from a mere new-line character in the original example.
% Any number of commented lines is the same as no new-line characters at all.
Some text after (no extra new-line).

Second paragraph (note the different indentation).

image

Another Caveat

The workaround does not work if the item that follows is complicated? Like a section. So the following doesn't work:

\begin{equation}
    \eqnmark[red]{node1}{x} = \eqnmark[blue]{node2}{y}
\end{equation}
\annotate[yshift=0.2em]{above,left}{node1}{fubar X}
\annotate[yshift=0.2em]{above,right}{node2}{hello Y}
%
% Does NOT work. New-line is still added!
%
\section{Section Title}

Fix

I don't know enough of Latex to suggest how to make \annotate not do that, but will keep an eye out for updates to the package in hopes that it's fixed! Thanks for the great package 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant