I'm trying to do something similar to $\underleftarrow{A}$
; however with the up arrow, not left or right arrows, i.e., I want to draw a pointer at A
. Any suggestion, please?
[Tex/LaTex] Under Up Arrow Text
arrows
Related Solutions
The \arrowsize
length is only an auxiliary dimen that you can use to calculate a length. It does not actually have anything to do with size of the arrow tip.
The right extend is the length the line will be shorten when the arrow tip is applied. This also does move the origin of the arrow coordinate system (the \pgfpointorigin
you use). You need to take the same amount into consideration if you want to draw the arrow.
The line has to be shortened by 1.5
its width.
The left extend (which is actually only needed if you want to combine arrow tips) is then 5pt-1.5\pgflinewidth
. I have used basic TeX dimen calculation and the \pgfutil@tempdima
dimen to calculate this so that the PGF math parser isn't needed (as indicated and forced by the +
in the extend macros).
The \pgftransformshift
macro is used to shift the origin back to the tip of the arrow.
The q
uick version of \pgfpoint
is used as its arguments do not need to get parsed by PGF math, either.
Instead of another \pgfpathlineto
I used \pgfpathclose
(this is the low-level equivalent of -- cycle
) even though you use filling and the closing is implied.
The backgrounds
library and its gridded
option is only used so one can easily spot the coordinates (0,0)
and (1,0)
. The second picture is the result of opacity=.5
and shows the line and the arrow tip separately.
Code
\documentclass[tikz,convert=false]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,backgrounds}
\makeatletter
\pgfarrowsdeclare{ipe arrow}{ipe arrow}{%
\pgfutil@tempdima=5pt\relax
\advance\pgfutil@tempdima-1.5\pgflinewidth
\pgfarrowsleftextend{+-\pgfutil@tempdima}%
\pgfarrowsrightextend{+1.5\pgflinewidth}%
}{%
\pgftransformshift{\pgfqpoint{1.5\pgflinewidth}{0pt}}%
\pgfpathmoveto{\pgfpointorigin}%
\pgfpathlineto{\pgfqpoint{-5pt}{-1.666pt}}%
\pgfpathlineto{\pgfqpoint{-5pt}{+1.666pt}}%
\pgfpathclose
\pgfusepathqfill
}
\makeatother
\begin{document}
Output
This is not easy to do with mychemistry
. I recommend to use chemfig
(which is loaded by mychemistry
). It is more far more flexible and I believe the input is more convenient, too. chemfig
lets you define own arrow types which can be used here. On texwelt I suggested the following solution for exactly this kind of arrow with chemfig
.
Here is how it goes. The code may look a bit complicated but it's basically a copy of existing arrow definitions in chemfig
. I added a few comments for explanation. It defines an arrow type <y>
with several optional arguments:
% define new arrow `<y>' with 7 optional arguments:
% syntax:
% \arrow{-y>[<label arc begin>]%
% [<label arc end>]%
% [<label below>]%
% [<ratio equilibrium arrows>]%
% [<offset>]%
% [<ratio arc radius/arrow length>]% default: 0.333
% [<half angle of arc>]% default: 60
% }
The scheme itself is then created rather easy:
\schemestart
\ch{E}
\arrow{<=>}
\ch{S1}
\arrow{<=>}
\ch{ES1}
\arrow{<=>}
\ch{E'P1}
\arrow{<=>[][\ch{P1}]}
\ch{E'}
\arrow{<y>[\ch{S2}]}
\ch{E'S2}
\arrow{<y>[][\ch{P2}]}
\ch{E}
\schemestop
The complete example
\documentclass[11pt]{article}
\usepackage{chemfig,chemformula}
\makeatletter
% define new arrow `<y>' with 7 optional arguments:
% syntax:
% \arrow{-y>[<label arc begin>]%
% [<label arc end>]%
% [<label below>]%
% [<ratio equilibrium arrows>]%
% [<offset>]%
% [<ratio arc radius/arrow length>]% default: 0.333
% [<half angle of arc>]% default: 60
% }
% this code is a combination of chemfig's arrow types `<=>' and `-U>'
%
\definearrow{7}{<y>}{%
% offset:
\CF@arrow@shift@nodes{#5}%
% coordinates for equilibrium arrows:
\ifx\@empty#4\@empty
\else
\pgfmathsetmacro\CF@tmp@stra{(1-#4)/2}%
\pgfmathsetmacro\CF@tmp@strb{(1-#4)/2+#4}%
\fi
\edef\CF@tmp@str{%
\noexpand\path[allow upside down](\CF@arrow@start@node)--(\CF@arrow@end@node)
node[pos=0,sloped,yshift=1pt](\CF@arrow@start@node @u0){}
node[pos=\ifx\@empty#4\@empty0\else\CF@tmp@stra\fi,sloped,yshift=-1pt]
(\CF@arrow@start@node @d0){}
node[pos=1,sloped,yshift=1pt](\CF@arrow@start@node @u1){}
node[pos=\ifx\@empty#4\@empty1\else\CF@tmp@strb\fi,sloped,yshift=-1pt]
(\CF@arrow@start@node @d1){};%
}\CF@tmp@str
% draw main arrows:
\expandafter\draw\expandafter[\CF@arrow@current@style,-CF@half]
(\CF@arrow@start@node @u0)--(\CF@arrow@start@node @u1)node[midway](yarrow@arctangent){};%
\expandafter\draw\expandafter[\CF@arrow@current@style,CF@half-]
(\CF@arrow@start@node @d0)--(\CF@arrow@start@node @d1);% is there label #1?
\edef\CF@tmp@str{\ifx\@empty#1\@empty[draw=none]\fi}%
% if yes draw left half of arc:
\expandafter\draw\CF@tmp@str (yarrow@arctangent)%
arc[
radius=\CF@compound@sep*\CF@current@arrow@length*\ifx\@empty#6\@empty0.333\else#6\fi,
start angle=\CF@arrow@current@angle-90,
delta angle=-\ifx\@empty#7\@empty60\else#7\fi
]
node(yarrow@start){};
% is there label #2?
\edef\CF@tmp@str{[\ifx\@empty#2\@empty draw=none,\fi-CF@full]}%
% if yes draw secon half of arc:
\expandafter\draw\CF@tmp@str (yarrow@arctangent)%
arc[
radius=\CF@compound@sep*\CF@current@arrow@length*\ifx\@empty#6\@empty0.333\else#6\fi,
start angle=\CF@arrow@current@angle-90,
delta angle=\ifx\@empty#7\@empty60\else#7\fi
]
node(yarrow@end){};
% place the labels - we need to no the sign of the offset here:
\edef\CF@tmp@str{\if\string-\expandafter\@car\detokenize{#5.}\@nil-\else+\fi}%
% place the labels #1 and #2:
\CF@arrow@display@label{#1}{0}{\CF@tmp@str}{yarrow@start}{#2}{1}{\CF@tmp@str}{yarrow@end}%
% place label #3:
\CF@arrow@display@label{#3}{0.5}{-}{\CF@arrow@start@node}{}{}{}{\CF@arrow@end@node}%
}
\makeatother
\begin{document}
\schemestart
\ch{E}
\arrow{<=>}
\ch{S1}
\arrow{<=>}
\ch{ES1}
\arrow{<=>}
\ch{E'P1}
\arrow{<=>[][\ch{P1}]}
\ch{E'}
\arrow{<y>[\ch{S2}]}
\ch{E'S2}
\arrow{<y>[][\ch{P2}]}
\ch{E}
\schemestop
\end{document}
Best Answer
Will
help?
You can get rid of using
$
also by using\ensuremath
:The MWE:
Edit You can add some coloring to spice things up: