LaTeX forum ⇒ Graphics, Figures & TablesArrow coordinates

Information and discussion about graphics, figures & tables in LaTeX documents.
bstex
Posts: 65
Joined: Mon Oct 23, 2017 10:22 am

Arrow coordinates

Postby bstex » Sat Mar 31, 2018 6:25 pm

Hi,
i'm having this:
Screen Shot 2018-03-31 at 19.16.56.png
Screen Shot 2018-03-31 at 19.16.56.png (8.59 KiB) Viewed 233 times

and I would like to raise the arrow, so it is vertically center with the text.
Can that happen without the \raisebox command?
Also, how can I modify the tikz code of the arrow, so it automatically puts a blank space after every arrow I insert in my code with the \myArrow command? I want this because, as you see, the letter B is very close to the arrow tip.

My MWE:
  1. \documentclass{book}
  2. \usepackage{tikz}
  3. \usepackage{chemfig}
  4. \newcommand{\myArrow}{\tikz {\draw[semithick] [-{Straight Barb[angle=60:1.5pt 3]}] (0,0) -- ++ (0.4,0);}}
  5.  
  6. \begin{document}
  7. A \myArrow B
  8. \end{document}


Thank you.

User avatar
Stefan Kottwitz
Site Admin
Posts: 9156
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sat Mar 31, 2018 11:08 pm

Ho about this:

  1. \documentclass{book}
  2. \usepackage{tikz}
  3. \usetikzlibrary{positioning}
  4. \usepackage{chemfig}
  5. \newcommand{\myArrow}[2]{\tikz[baseline=(A.base)] {%
  6. \node (A) {#1};
  7. \node (B) [right =0.4 of A] {#2};
  8. \draw[semithick] [-{Straight Barb[angle=60:1.5pt 3]}] (A) -- (B);}}
  9.  
  10. \begin{document}
  11. \myArrow{X}{Y}
  12. \end{document}


Stefan
Site admin


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 7 guests