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

make label below option work for \annotate #16

Merged
merged 1 commit into from
May 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified annotate-equations.pdf
Binary file not shown.
7 changes: 5 additions & 2 deletions annotate-equations.sty
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
%
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{annotate-equations}
[2023/05/05 v0.2.1 easily annotate equations using TikZ]
[2023/05/06 v0.2.2 easily annotate equations using TikZ]

%%% lualatex compatibility, from https://tex.stackexchange.com/a/351520/171664
\RequirePackage{ifluatex}
Expand Down Expand Up @@ -170,6 +170,9 @@
\colorlet{currentcolor}{.}
\def\myEAcolor{\usevalue{\myEAmark}}%
%
\def\EAspace{ } % workaround: did not find any other way of getting a space into \myEAlabelanchor without upsetting LaTeX/PGF/... somehow
\edef\myEAlabelanchor{\EAlabelanchor\EAspace\EAwesteast}%
%
%
\def\myEAxshift{\EAxshift{\EAwesteast}}%
\begin{tikzpicture}[overlay,remember picture,>=stealth,nodes={align=left,inner ysep=1pt},<-]
Expand All @@ -182,7 +185,7 @@
\foreach \EAmark in \myEAmarks
\draw [color=\myEAcolor, annotate equations/arrow] (\EAmark.\EAmarkanchor) % arrow from the equation
% \EAmarkanchor north: above the equation, south: below
|- ([xshift=\myEAxshift,yshift=0.1ex] \eqnannotateCurrentNode.south \EAwesteast);
|- ([xshift=\myEAxshift,yshift=0.1ex] \eqnannotateCurrentNode.\myEAlabelanchor);
% - south east: we want line to end at bottom right of annotation text;
% - negative xshift makes it a little bit shorter;
% - yshift for aesthetics (\strut is ever so slightly too tall).
Expand Down
6 changes: 2 additions & 4 deletions annotate-equations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
text above listing,
#1}

\title{\texttt{annotate-equations.sty}, v.0.2.1}
\title{\texttt{annotate-equations.sty}, v.0.2.2}
\author{ST John}
\date{\url{https://github.com/st--/annotate-equations}}

Expand Down Expand Up @@ -131,7 +131,7 @@ \subsection{Annotation options}
\end{equation*}
\annotate[yshift=1em]{left}{node1}{my}
\annotate[yshift=-0.5em]{below,left}{node2}{annotation}
\annotate[yshift=-1em]{below}{node3}{text}
\annotate[yshift=-1em]{below, label below}{node3}{text}
\end{LTXexample}
\noindent
%
Expand Down Expand Up @@ -362,8 +362,6 @@ \subsection{Extra spacing between \texttt{\textbackslash{}tikzmarknode} and arro
\section{Known issues}

\begin{itemize}
\item \texttt{label above}/\texttt{label below} is not implemented for \verb|\annotate|.

\item Annotations of mathematical relations require some manual patching to get the correct surrounding spacing (see \cref{sec:mathrel}).

\end{itemize}
Expand Down