LaTeX forum ⇒ Graphics, Figures & TablesCustom \Rightarrow and \Leftrightarrow

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

Custom \Rightarrow and \Leftrightarrow

Postby bstex » Fri Nov 16, 2018 1:15 pm

is there a way to customize the \Rightarrow and \Leftrightarrow to match with my customized rightarrow?
mwe.png (41.67 KiB) Viewed 5055 times

As you can see the rightarrow between A and B is perfect. But the other two arrows are not.

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass[a4paper,11pt]{book}
  2. \usepackage{tikz}
  3. \usetikzlibrary{positioning,arrows.meta}
  4. \usepackage[version=4]{mhchem}
  6. \ExplSyntaxOn
  7. \cs_set:Npn \__mhchem_arrow_options_minLength:n { {1.1em} }
  8. \ExplSyntaxOff
  10. \mhchemoptions{arrows=pgf{Straight Barb[round, angle=60:1.5pt 3]}{0.1ex}}
  12. \begin{document}
  13. I have these:
  14. \colorbox{green}{
  15. \ce{A -> B} \qquad C $\Rightarrow$ D \qquad E $\Leftrightarrow$ F}
  17. My MWE: \colorbox{green}{G \raisebox {0.35ex} {\tikz{\draw [double equal sign distance, -{Straight Barb[round, angle=60:1.5pt 1]}] (0,0) --++ (0.3,0)}} H}
  18. \end{document}

Thank you in advance.

Posts: 649
Joined: Tue Mar 25, 2008 5:02 pm

Postby kaiserkarl13 » Sun Nov 18, 2018 6:38 pm

I poked around in the code for mhchem for a while, but it's not obvious how to define => to mean what you want it to mean. (Writing \Rightarrow is always going to use the math symbol, hence the curviness; if you used \rightarrow instead of -> it would do the same thing.) One workaround is to use the txfonts package (pxfonts would also work), which uses straight double-arrow symbols.

The right way to do this is to add your own "=>" symbol into mhchem's machinery, though do take care not to confuse it with the harpoons (i.e., "<=>," "<<=>," and "<=>>").

Posts: 68
Joined: Mon Oct 23, 2017 10:22 am

Postby bstex » Mon Nov 19, 2018 1:35 pm

Thanks for your reply.

I would prefer to have a customized arrow created with \tikz.
My problem is that I can't make the two horizontal lines to "stop" when they meet the arrow tip.
Also, I'd like the space between the two horizontal lines to be transparent.

Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 6 guests