Graphics, Figures & Tableschemfig | Distance Bond—Molecule

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

chemfig | Distance Bond—Molecule

Post by svend_tveskaeg »

Hi all.

Consider the following MWE:

Code: Select all

\documentclass{article}
\usepackage{chemfig}

\begin{document}

\setbondoffset{4pt}
\chemfig{CH_3-\lewis{0:2:,O}(-[6]H)-[:-0,,,,dash pattern=on 1.8pt off 1.8pt]H}

\end{document}
How do I get a larger distance between the electrons at the oxygen atom and the (dashed) bound connecting oxygen and hydrogen?

I know that \setbondoffset does the trick but I cannot figure out what to put it in my \chemfig argument in order to make it work.

Thank you in advance!

P.S. I have looked at page 12 of the English chemfig manual.
Last edited by svend_tveskaeg on Thu Mar 15, 2012 6:11 pm, edited 3 times in total.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

unbonpetit

chemfig | Distance Bond—Molecule

Post by unbonpetit »

You can use "#"

Code: Select all

\chemfig{CH_3-\lewis{0:2:,O}(-[6]H)-#(5pt)[:-0,,,,dash pattern=on 1.8pt off 1.8pt]H}
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

chemfig | Distance Bond—Molecule

Post by svend_tveskaeg »

Thank you. In the MWE it works just fine but for some (to me unknown) reason, the following code will not compile.

Code: Select all

\documentclass[danish]{beamer}
\usepackage{babel}
\usepackage{chemfig}

\begin{document}

\begin{frame}{Alcohol}
\begin{center}
\setbondoffset{4pt}
\chemfig{CH_3-\lewis{0:2:,O}(-[6]H)-#(5pt)[:-0,,,,dash pattern=on 1.8pt off 1.8pt]H-\lewis{0:2:,O}(-[6]CH_3)-#(5pt)[:-0,,,,dash pattern=on 1.8pt off 1.8pt]H-\lewis{0:2:,O}(-[6]CH_3)}
\end{center}
\end{frame}

\end{document}
What is wrong here?

Notice that I use the beamer class here.

Thank you in advance!

P.S. The log file is attached.
Attachments
test.log
Log file.
(36 KiB) Downloaded 224 times
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
unbonpetit

chemfig | Distance Bond—Molecule

Post by unbonpetit »

Try

Code: Select all

{\catcode`\#=12
\begin{frame}{Alcohol}
\begin{center}
\setbondoffset{4pt}
\chemfig{CH_3-\lewis{0:2:,O}(-[6]H)-#(5pt)[:-0,,,,dash pattern=on 1.8pt off 1.8pt]H-\lewis{0:2:,O}(-[6]CH_3)-#(5pt)[:-0,,,,dash pattern=on 1.8pt off 1.8pt]H-\lewis{0:2:,O}(-[6]CH_3)}
\end{center}
\end{frame}}
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Re: chemfig | Distance Bond—Molecule

Post by svend_tveskaeg »

I love it! Thank you very much!
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
Post Reply