TransWikia.com

Moving arrows down in tikz diagrams

TeX - LaTeX Asked by maestron9 on January 20, 2021

I try to create a "reaction scheme" using the tikz environment. Here is a part of the code:

node (Ba2+) [compound] {ce{Ba^{2+}}};
node (BaSO4) [compound, right of=BaO, xshift=1cm] {ce{BaSO4}};
draw [arrow] (Ba2+)--node[anchor=south]{ce{SO4^{2-}}}(BaSO4);

What I want to do (and don’t know how) is to move the arrow vertically down. LaTeX just draws the arrow from the center of (Ba2+) to that of (BaSO4), but I want the arrow to be lower.
Using vspace{} doesn’t move the arrow.

One Answer

Maybe this might be a solution for you?:

documentclass{article}

usepackage{chemformula}

begin{document}
    
    normal:
    
    ch[arrow-yshift=0pt]{Ba^{2+} ->[ {SO4^2-} ] BaSO4}
    
    lowered:
    
    ch[arrow-yshift=-3pt]{Ba^{2+} ->[ {SO4^2-} ] BaSO4}
    
end{document}

enter image description here

EDIT: An example which uses chemfig(which uses tikz):

documentclass{article}

usepackage{chemfig}


begin{document}
    
    schemestart
    chemfig{Ba^{2+}}
    arrow{->[chemfig{SO_4^{2-}}][][-3pt]}
    chemfig{BaSO_4}
    schemestop
    
end{document}

enter image description here

EDIT_2: An example of drawing vertical

documentclass{article}

usepackage{chemfig}


begin{document}
    
    schemestart
    chemfig{Ba^{2+}}
    arrow{->[chemfig{SO_4^{2-}}][][-3pt]}
    chemfig{BaSO_4}
    schemestop
    
    schemestart
    arrow[45]Barrow[-20,2]C
    schemestopbigskip
    
    schemestart
    arrow[90,,thick]Barrow[,2]Carrow[-45,,dashed,red]D
    schemestop
    
end{document}

enter image description here

EDIT_3: Example of reaction scheme with reactents in boxes.

documentclass{article}

usepackage{chemfig}

begin{document}
    
    setchemfig{compound style={draw,line width=0.8pt,semitransparent,text opacity=1,inner sep=8pt,rounded corners=1mm}} 
    
    schemestart
    chemfig{Ba^{2+}}
    arrow([fill=white]--[fill=white]){->[chemfig{SO_4^{2-}}]}[45]chemfig{BaSO_4}
    arrow(--[fill=white])chemfig{BaO + SO_2}
    arrow(--[fill=white]){-U>[*{0.180}chemfig{O_2}]}[-90]chemfig{BaO_2}
    schemestop
    
    
end{document}

enter image description here

Answered by Roland on January 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP