texlive[67031] Master/texmf-dist: annotate-equations (6may23)
commits+karl at tug.org
commits+karl at tug.org
Sat May 6 21:54:55 CEST 2023
Revision: 67031
http://tug.org/svn/texlive?view=revision&revision=67031
Author: karl
Date: 2023-05-06 21:54:55 +0200 (Sat, 06 May 2023)
Log Message:
-----------
annotate-equations (6may23)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/annotate-equations/annotate-equations.pdf
trunk/Master/texmf-dist/doc/latex/annotate-equations/annotate-equations.tex
trunk/Master/texmf-dist/tex/latex/annotate-equations/annotate-equations.sty
Modified: trunk/Master/texmf-dist/doc/latex/annotate-equations/annotate-equations.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/annotate-equations/annotate-equations.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/annotate-equations/annotate-equations.tex 2023-05-05 23:48:16 UTC (rev 67030)
+++ trunk/Master/texmf-dist/doc/latex/annotate-equations/annotate-equations.tex 2023-05-06 19:54:55 UTC (rev 67031)
@@ -26,16 +26,19 @@
text above listing,
#1}
-\title{\texttt{annotate-equations.sty}}
+\title{\texttt{annotate-equations.sty}, v.0.2.1}
\author{ST John}
\date{\url{https://github.com/st--/annotate-equations}}
+
\begin{document}
\maketitle
-\section{Introduction}
+
+%\section{Introduction}
+
This package is there to make it easier to make annotated equations in \LaTeX, such as in this example:
\begin{LTXexample}[]
\vspace{4em}
@@ -52,6 +55,10 @@
Note that this package relies on TikZ's \texttt{remember picture} option and therefore you have to compile your \LaTeX{} document at least twice to get everything in the right place (or just use \texttt{latexmk}!).
+
+\tableofcontents
+
+
\section{Marking annotation targets within your equation}
\newcommand{\cmdoption}[1]{$\langle$\textit{#1}$\rangle$}
@@ -74,6 +81,7 @@
\end{LTXexample}
\noindent
+
\section{Simple annotations}
\label{sec:annotate}
@@ -128,6 +136,7 @@
\noindent
%
+
\section{Double annotations}
\label{sec:annotatetwo}
@@ -146,6 +155,7 @@
%
Color is picked from the first of the two nodes.
+
\section{Package options}
\subsection{Size of highlight: shrink to content or always full height}
@@ -222,6 +232,7 @@
\noindent
\subsection{Default formatting of annotation labels}
+\label{sec:eqnannotationfont}
\verb|\eqnannotationfont| sets the \texttt{font} field of the TikZ annotation label and can be re-set to change its formatting:
\begin{LTXexample}[text outside listing,lefthand width=0.5in]
@@ -245,7 +256,19 @@
\vspace{1em}
\end{LTXexample}
\noindent
+%
+Alternatively, you can also change the style of \verb|annotate equations/text|:
+\begin{LTXexample}[text outside listing,lefthand width=0.5in]
+\tikzset{annotate equations/text/.style={font=\bfseries\small}}
+\begin{equation*}
+ \eqnmarkbox[blue]{v}{v}
+\end{equation*}
+\annotate[yshift=-0.5em]{below}{v}{velocity}
+\vspace{1em}
+\end{LTXexample}
+\noindent
+
\verb|\eqnannotationstrut| is defined to be a strut (zero-width height) to
provide minimum distance between the text and the corresponding arrow line. By
default it is \verb|\strut|, which has a similar effect to
@@ -273,6 +296,32 @@
\end{LTXexample}
+\subsection{Customize style}
+
+You can change the style of the annotation arrow line by setting the style of \verb|annotate equations/arrow|:
+\begin{LTXexample}[text outside listing,lefthand width=0.5in]
+\tikzset{annotate equations/arrow/.style={color=ForestGreen, >=latex', very thick, dashed}}
+
+\begin{equation*}
+ \eqnmarkbox[blue]{size}{s} = \eqnmarkbox[red]{other}{x}
+\end{equation*}
+\annotate[yshift=-0.5em]{below}{size}{The size}
+\annotatetwo[yshift=1em]{above}{size}{other}{the same}
+\end{LTXexample}
+\noindent
+Note that it applies to all \verb|\annotate| and \verb|\annotatetwo| arrows within the scope.
+
+You can also use this to change the arrow direction:
+\begin{LTXexample}[text outside listing,lefthand width=0.5in]
+\begin{equation*}
+ \eqnmarkbox[blue]{size}{s} = \eqnmarkbox[red]{other}{x}
+\end{equation*}
+\tikzset{annotate equations/arrow/.style={->}}
+\annotatetwo[yshift=1em]{above}{size}{other}{one and}
+\tikzset{annotate equations/arrow/.style={<-}}
+\annotatetwo[yshift=-1em]{below, label below}{size}{other}{the same} % note that the "direction" of the arrow is from first to second mark
+\end{LTXexample}
+
\section{Recommendations, tips \& tricks}
\subsection{Use \texttt{\textbackslash{}colorlet} for consistent, easily changeable colors}
@@ -319,4 +368,23 @@
\end{itemize}
+
+\section{Backwards-incompatible changes}
+
+\subsection*{v0.2.0}
+
+\subsubsection*{\texttt{\textbackslash{}eqnannotationtext} removed}
+
+To make it easier to format multiline annotations, version 0.2.0 introduced the \verb|\eqnannotationfont| and \verb|\eqnannotationstrut| (zero-argument) commands (see \cref{sec:eqnannotationfont}).
+
+In exchange, the \verb|\eqnannotationtext| (one-argument) command was removed. To upgrade, replace for example
+\begin{tcblisting}{listing only}
+ \renewcommand{\eqnannotationtext}[1]{\sffamily\tiny#1\strut}
+\end{tcblisting}
+with
+\begin{tcblisting}{listing only}
+ \renewcommand{\eqnannotationfont}{\sffamily\tiny}
+ \renewcommand{\eqnannotationstrut}{\strut}
+\end{tcblisting}
+
\end{document}
Modified: trunk/Master/texmf-dist/tex/latex/annotate-equations/annotate-equations.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/annotate-equations/annotate-equations.sty 2023-05-05 23:48:16 UTC (rev 67030)
+++ trunk/Master/texmf-dist/tex/latex/annotate-equations/annotate-equations.sty 2023-05-06 19:54:55 UTC (rev 67031)
@@ -5,7 +5,7 @@
%
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{annotate-equations}
- [2023/02/15 v0.2.0 easily annotate equations using TikZ]
+ [2023/03/05 v0.2.1 easily annotate equations using TikZ]
%%% lualatex compatibility, from https://tex.stackexchange.com/a/351520/171664
\RequirePackage{ifluatex}
@@ -55,6 +55,9 @@
label below/.code = {\renewcommand\EAlabelanchor{north}},
}
+\tikzset{annotate equations/arrow/.style={}}
+\tikzset{annotate equations/text/.style={font=\eqnannotationfont}}
+
%%%%% %%%%%%%% %%%%%
@@ -128,13 +131,13 @@
\begin{tikzpicture}[overlay,remember picture,>=stealth,nodes={align=left,inner ysep=1pt},<-]
% default anchor is at center
\node[anchor=\swapNorthSouth{\EAmarkanchor},color=\myEAcolor!85,
- font=\eqnannotationfont,#1
+ annotate equations/text,#1
] % color blended with white to 85%, any (optional) extra args #1
(\eqnannotateCurrentNode) % use counter-based "local node"
at ($(\myEAmarkOne.\EAmarkanchor)!0.5!(\myEAmarkTwo.\EAmarkanchor)$) % centered between the two nodes
{\myEAtext\eqnannotationstrut};
% double arrow to two uses within the equation:
- \draw [<->,color=\myEAcolor] (\myEAmarkOne.\EAmarkanchor) |- ([yshift=0.1ex] \eqnannotateCurrentNode.\EAlabelanchor) -| (\myEAmarkTwo.\EAmarkanchor); % from node 1 via annotation to node 2, with anchor #6 each
+ \draw [<->,color=\myEAcolor, annotate equations/arrow] (\myEAmarkOne.\EAmarkanchor) |- ([yshift=0.1ex] \eqnannotateCurrentNode.\EAlabelanchor) -| (\myEAmarkTwo.\EAmarkanchor); % from node 1 via annotation to node 2, with anchor #6 each
\end{tikzpicture}%
\endgroup% %%% close group again
}
@@ -171,13 +174,13 @@
\def\myEAxshift{\EAxshift{\EAwesteast}}%
\begin{tikzpicture}[overlay,remember picture,>=stealth,nodes={align=left,inner ysep=1pt},<-]
\node[anchor=\swapNorthSouth{\EAmarkanchor} \swapWestEast{\EAwesteast},
- color=\myEAcolor!85,font=\eqnannotationfont,#1] % TODO for some reason, passing #1 through command doesn't work...
+ color=\myEAcolor!85,annotate equations/text,#1] % TODO for some reason, passing #1 through command doesn't work...
% anchor=west: align left edge of text on top of tikzmark in equation
% should be north west for below and south west for above ...
(\eqnannotateCurrentNode) at (\myEAmark.\EAmarkanchor) % \EAmarkanchor north: above the equation, south: below
{\myEAtext\eqnannotationstrut};
\foreach \EAmark in \myEAmarks
- \draw [color=\myEAcolor] (\EAmark.\EAmarkanchor) % arrow from the equation
+ \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);
% - south east: we want line to end at bottom right of annotation text;
More information about the tex-live-commits
mailing list.