2

I was looking at this question Please help me solve. i am trying where there is the image below.

enter image description here

In my comment I have suggested using the witharrows package. I don't know this package very well, but using this code fragment (pag. 30 of the documentation) I have an error:

! Undefined control sequence.
l.9 tikz-code = {\draw
                       (#1) -- ++(4.5cm,0) |- (#2) ;
? 

The MWE is:

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{tikz,witharrows}
\begin{document}
\begin{DispWithArrows*}
[displaystyle,
ygap = 2mm,
ystart = 0mm,
tikz-code = {\draw (#1) -- ++(4.5cm,0) |- (#2) ;
\path (#1) -- (#2)
node[text width = 4.2cm, right, midway] {#3} ;}]
S_n
& = \frac1n \sum_{k=0}^{n-1}\cos\bigl(\tfrac{\pi}2\cdot\tfrac kn\bigr)
\end{DispWithArrows*}
\end{document}

The output should be the first line:

enter image description here

Is is possible to put $\cos x =\Re(e^{ix})$ externally and not internally by coloring the entire square arrow with a color of your choice?

3

I am not good at writing equations -- but I think this is what you want

enter image description here

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{tikz,witharrows}
\begin{document}
\begin{DispWithArrows*}%
[displaystyle,
ygap = 2mm,
ystart = 0mm,
tikz-code = {\draw [red,thick](#1) -- ++(4.5cm,0) |- (#2) ;%<---------new red, thick option
            \path (#1) -- (#2)
            node[text width = 4.2cm, right, midway, xshift=5cm] {#3} ;}]%<-------xshift option
S_n
& = \frac1n \sum_{k=0}^{n-1}\cos\bigl(\tfrac{\pi}2\cdot\tfrac kn\bigr)  \Arrow {we expand} \\
& = \frac1n \sum_{k=0}^{n-1}\cos\bigl(\tfrac{\pi}2\cdot\tfrac kn\bigr)
\end{DispWithArrows*}
\end{document}

OR

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{tikz,witharrows}
\begin{document}
\begin{DispWithArrows*}%
[displaystyle,
ygap = 2mm,
ystart = 0mm,
tikz-code = {\draw [red,thick,rounded corners](#1) -- ([xshift=2cm]#1) 
            -- node[rectangle, draw, auto = false, fill = gray!50, inner sep = 2pt] {\tiny #3}
            ([xshift=2cm]#2)
            -- (#2);}]
S_n
& = \frac1n \sum_{k=0}^{n-1}\cos\bigl(\tfrac{\pi}2\cdot\tfrac kn\bigr)  \Arrow {we expand} \\
& = \frac1n \sum_{k=0}^{n-1}\cos\bigl(\tfrac{\pi}2\cdot\tfrac kn\bigr)
\end{DispWithArrows*}
\end{document}

enter image description here

3
  • 1
    It's a good option, as are your other great answers with TikZ. My sincere congratulations to you and a cordial greeting to you and your family. :-) My best regards.
    – Sebastiano
    Jul 31 at 11:12
  • 1
    @Sebastiano, if answer met your requirement, you may accept it ;-) (by clicking on the check mark at top left side of answer). Thank you.
    – js bibra
    Jul 31 at 14:33
  • Don't worry. :-) I know the procedure :-). Truly I am waiting also the complete answer of @F. Pantigny for the correctness (see the comment below his answer). Best regards.
    – Sebastiano
    Aug 2 at 12:17
1

You should write \begin{WithArrows*}%. Otherwise, the options at the following line are not recognized as options of the environment {WithArrows*}: there must be no space between \begin{WithArrows*} and the character [ (and the newline counts as space).

5
  • I have tried your suggestion (+1) but I have an error: ! LaTeX Error: Environment WithArrows* undefined. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help.... l.5 \begin{WithArrows*} % ?
    – Sebastiano
    Jul 30 at 21:08
  • In your opinion is there a complete answer to my question?
    – Sebastiano
    Jul 30 at 21:09
  • 1
    @Sebastiano: For the LaTeX error, I think that you have not the latest version of witharrows. For the complete answer, I will see. Jul 30 at 21:15
  • Yesterday I made the MikTeX updating...and I will wait....Grazieeeeeeeeeeeeeeeeeeeeeeeee.
    – Sebastiano
    Jul 30 at 21:17
  • Waiting Pantigny..I have given the check mark. :-)
    – Sebastiano
    Aug 3 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.