diff options
Diffstat (limited to 'macros/latex/contrib/annotate-equations/annotate-equations.tex')
-rw-r--r-- | macros/latex/contrib/annotate-equations/annotate-equations.tex | 72 |
1 files changed, 70 insertions, 2 deletions
diff --git a/macros/latex/contrib/annotate-equations/annotate-equations.tex b/macros/latex/contrib/annotate-equations/annotate-equations.tex index 26396e679e..5fc0aa6017 100644 --- a/macros/latex/contrib/annotate-equations/annotate-equations.tex +++ b/macros/latex/contrib/annotate-equations/annotate-equations.tex @@ -26,15 +26,18 @@ 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}[] @@ -52,6 +55,10 @@ There is still a bit of manual tweaking required (such as adding vertical space 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 @@ but this is likely to end up with the arrow tip too close to the target, so you \end{LTXexample} \noindent + \section{Simple annotations} \label{sec:annotate} @@ -128,6 +136,7 @@ One annotation can point to multiple targets, and multiple annotations can point \noindent % + \section{Double annotations} \label{sec:annotatetwo} @@ -146,6 +155,7 @@ One annotation can point to multiple targets, and multiple annotations can point % 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 @@ By redefining this command, you can change the ``alpha'' value of the highlight: \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,6 +256,18 @@ By redefining this command, you can change the ``alpha'' value of the highlight: \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 @@ -273,6 +296,32 @@ default it is \verb|\strut|, which has a similar effect to \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 @@ a \mathrel{\tikzmarknode[outer ysep=5pt]{node1}{=}} b \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} |