2

The following code doesn't give the expected result.

\documentclass{standalone}

\usepackage{witharrows}

\begin{document}

$\begin{WithArrows}
A & = (a+1)^2 \Arrow[tikz=thick]{we expand} \\
  & = a^2 + 2a + 1
\end{WithArrows}$

\end{document}

In the output, the arrow is missing. This surely comes from the different compilations needed to add the arrow.

enter image description here

Is there an "automatic" way to fix that?

4
  • The arrows and the comments are, by design, not taken into account for determining the bounding box. They would be with DispWithArrows*, but in this case the result is a whole line. I see nothing in the manual that can solve your problem.
    – egreg
    Dec 10, 2022 at 23:35
  • Thanks for this "trick".
    – projetmbc
    Dec 10, 2022 at 23:38
  • With the class option varwidth and DispWithArrows* one gets an output where the arrow isn't missing. That result can be cropped by an external tool. Dec 11, 2022 at 4:09
  • This is a good solution. Indeed, I will do that systematically to avoid the kind of breaking noticed here.
    – projetmbc
    Dec 11, 2022 at 12:31

2 Answers 2

5

I have written a new version of witharrows (v. 2.8 of 2023/01/01). That version provides a new key right-overlap. When that key is set to false (with \WithArrowsOptions or for an individual environment {WithArrows}), the arrows are longer drawn on an overlapping position on the right.

\documentclass{standalone}

\usepackage{witharrows}

\WithArrowsOptions{right-overlap=false}

\begin{document}

$\begin{WithArrows}
A & = (a+1)^2 \Arrow[tikz=thick]{we expand} \\
  & = a^2 + 2a + 1
\end{WithArrows}$

\end{document}

Output of the above code

4

Not automatic, but you can manually adjust the bounding box with the border option of standalone. I also added some padding to the left and top, feel free to make those 0pt.

\documentclass[border={2pt 0pt 60pt 2pt}]{standalone}
% border={left bottom right top}
\usepackage{witharrows}

\begin{document}

$\begin{WithArrows}
A & = (a+1)^2 \Arrow[tikz=thick]{we expand} \\
  & = a^2 + 2a + 1
\end{WithArrows}$

\end{document}

pic

1
  • A starting point.
    – projetmbc
    Dec 10, 2022 at 23:44

You must log in to answer this question.

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