Graphics, Figures & TablesCustom \Rightarrow and \Leftrightarrow

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

Custom \Rightarrow and \Leftrightarrow

Post by bstex »

Hi,
is there a way to customize the \Rightarrow and \Leftrightarrow to match with my customized rightarrow?
mwe.png
mwe.png (41.67 KiB) Viewed 10286 times
As you can see the rightarrow between A and B is perfect. But the other two arrows are not.

Code: Select all

\documentclass[a4paper,11pt]{book}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta}
\usepackage[version=4]{mhchem}

\ExplSyntaxOn
\cs_set:Npn \__mhchem_arrow_options_minLength:n  { {1.1em} }
\ExplSyntaxOff

\mhchemoptions{arrows=pgf{Straight Barb[round, angle=60:1.5pt 3]}{0.1ex}}

\begin{document}
I have these:
\colorbox{green}{
\ce{A -> B} \qquad C $\Rightarrow$ D \qquad 	E $\Leftrightarrow$ F}

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}
\end{document}
Thank you in advance.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Custom \Rightarrow and \Leftrightarrow

Post by kaiserkarl13 »

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 "<=>>").
bstex
Posts: 69
Joined: Mon Oct 23, 2017 10:22 am

Custom \Rightarrow and \Leftrightarrow

Post by bstex »

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.
Post Reply