2

Currently, I am using the custom command notate from this TeX SE answer. The syntax of this command is:

\notate[B<race>]{<referenced math>}{<dropline length in \baselineskips>}{<math notation>}

Here's the MWE:

\documentclass{article}
\usepackage{graphicx,amsmath}
\usepackage[usestackEOL]{stackengine}
\usepackage{scalerel}

% \parskip \baselineskip  % it's creating a problem with my theorem environment designs
\def\svmybf#1{\rotatebox{90}{\stretchto{\{}{#1}}}
\def\svnobf#1{}
\def\rlwd{.5pt}
\newcommand\notate[4][B]{%
  \if B#1\let\myupbracefill\svmybf\else\let\myupbracefill\svnobf\fi%
  \def\useanchorwidth{T}%
  \setbox0=\hbox{$\displaystyle#2$}%
  \def\stackalignment{c}\stackunder[-6pt]{%
    \def\stackalignment{c}\stackunder[-1.5pt]{%
      \stackunder[2pt]{\strut $\displaystyle#2$}{\myupbracefill{\wd0}}}{%
    \rule{\rlwd}{#3\baselineskip}}}{%
  \strut\kern9pt$\rightarrow$\smash{\rlap{$~\displaystyle#4$}}}%
}

\begin{document}

\begin{equation*}
   S = \int \sqrt{\notate[X]{F}{1}{\text{$F$ is functional}}[x^a(\tau)]} d\tau
\end{equation*}

\end{document}

But my desired output is the following:

enter image description here

What do I need to change in the notate command to get the desired output?

Another feature I like to have in the command is regarding the placement of the arrowhead as an optional argument such that it can be placed in the direction of the <math notation> or/and the <referenced math> according to user choice. By default, it should be directed to the <math notation>. My desired syntax for the command:

\notate[<Brace>, <arrowhead>]{<referenced math>}{<dropline length in \baselineskips>}{<math notation>}

where the default choice would be such that the brace is at to the <referenced math> and the arrowhead is directed to the <math notation>. For example:

  1. The following two should generate the same output and [B,A] considered as the default choice for the optional argument:
\notate[B,A]{<referenced math>}{1}{<math notation>}
\notate{<referenced math>}{1}{<math notation>}
  1. To remove the brace and keep the arrowhead at the <math notation> only:
\notate[X,A]{<referenced math>}{1}{<math notation>}
  1. To switch the positions of the brace and arrowhead (the arrowhead is at the <referance math> and the brace is at the opposite end):
\notate[A,B]{<referenced math>}{1}{<math notation>}
  1. To keep the arrowheads at both ends:
\notate[A,A]{<referenced math>}{1}{<math notation>}
  1. To keep both ends blank (no brace, no arrowhead):
\notate[X,X]{<referenced math>}{1}{<math notation>}
0

2 Answers 2

3

One possibility is to use annotate-equations package. The only difference with the default output of the package is the direction of the arrow:

\documentclass{article}
\usepackage{amsmath}
\usepackage{annotate-equations}
\usepackage{derivative}

\begin{document}

\renewcommand{\eqnannotationfont}{\footnotesize}
\begin{equation*}
S = \int \sqrt{\tikzmarknode{f}{F}[x^a(\tau)]}\odif{\tau}
\end{equation*}
\annotate[yshift=-1em]{below}{f}{$F$ is functional}

\end{document}

enter image description here

Something not related: According to this post differentials should be upright, not italicized. I change the differential using derivative package.

Of course, another alternative could be tikzmark package. In any case, as a mere user, I believe it is better to use a package that is shipped with a documentation rather than code that can be not fully understood.

1
  • 1
    thanks for mentioning the derivative package too.
    – raf
    Commented Apr 21, 2023 at 16:18
2

As to the direct question on how to achieve the desired result for the presented equation, one need only \smash the \notate command.

EDITED to show a little more flexibility in the arrowhead choice. As before, B optional argument provides a upbrace on the referenced math. However, a U provides an \uparrow instead of a simple line-end.

Similar logic could be employed for rendering the \rightarrow or not, depending on the value of the optional argument.

\documentclass{article}
\usepackage{graphicx,amsmath}
\usepackage[usestackEOL]{stackengine}
\usepackage{scalerel}

% \parskip \baselineskip
\def\myupbracefill#1{\rotatebox{90}{\stretchto{\{}{#1}}}
\def\rlwd{.4pt}
\newcommand\notate[4][B]{%
  \if B#1\else\def\myupbracefill##1{}%
    \if U#1\def\myuparrow{$\uparrow$}\else\def\myuparrow{}\fi\fi%
  \def\useanchorwidth{T}%
  \setbox0=\hbox{$\displaystyle#2$}%
  \def\stackalignment{c}\stackunder[-6pt]{%
    \def\stackalignment{c}\stackunder[-1.5pt]{%
      \stackunder[2pt]{\strut $\displaystyle#2$}{\myupbracefill{\wd0}}}{%
    \stackunder[-.2pt]{\myuparrow}{\rule{\rlwd}{#3\baselineskip}}}}{%
  \strut\kern9pt$\rightarrow$\smash{\rlap{$~\displaystyle#4$}}}%
}
\begin{document}

\begin{equation*}
   S = \int \sqrt{
  \smash{\notate[X]{F}{1}{\text{$F$ is functional}}}
  [x^a(\tau)]} d\tau
\end{equation*}
\bigskip
\begin{equation*}
   S = \int \sqrt{
  \smash{\notate[U]{F}{.2}{\text{$F$ is functional}}}
  [x^a(\tau)]} d\tau
\end{equation*}

\end{document}

enter image description here

5
  • Thank you and I am looking forward to your updates about the features.
    – raf
    Commented Apr 21, 2023 at 16:30
  • 1
    Note, @raf that some \vspace may be needed before whatever text follows after this equation, because of the \smash Commented Apr 21, 2023 at 17:05
  • Have you thought about the other feature requests later?
    – raf
    Commented May 15, 2023 at 12:32
  • 1
    @raf please see my edited answer. Commented May 16, 2023 at 17:51
  • Thank you. But I didn't understand how to control the arrowhead and brace properly. So, I have updated the question to express my feature request more clearly (with 5 cases) to you. Also, your updated answer is giving an error Undefined control sequence when no optional argument is used. For example, it gives an error for the line: S = \int \sqrt{ \smash{\notate{F}{1}{\text{$F$ is functional}}} [x^a(\tau)]} d\tau. Kindly have a look when you get time.
    – raf
    Commented May 23, 2023 at 16:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .