5

I am using chemfig scaling and want to increase the font size, but not any other parameter of the molecule. So a MWE would be:

\documentclass{article}
\usepackge{chemfig}

\begin{document}

\definesubmol{R1}{--[:150]-[::60]-[::-60]-[::60]-[::-60]-[::-60]-[::-60]-[::-60]-[::60]}
\definesubmol{R2}{--[:30]-[::-60]-[::60]-[::-60]-[::+60]-[::+60]-[::+60]-[::+60]-[::-60]}
\definesubmol{R3}{-[,0.6]}
\chemfig[][scale=0.7]{([:-18]N*5((!{R1})-(!{R3})=\chemabove{N}{\quad\scriptstyle\oplus}([:342]!{R2})-=-))}

\end{document}

Can I increase the font size minimally without changing the rest of the molecule?

2
  • 1
    You have two possibilities: redefine \printatom to use a larger font or set the bond length (via \setatomsep) to use a fixed length instead of a font-size dependent one.
    – cgnieder
    Sep 5, 2014 at 8:32
  • how would I redefine \printatom to use, say, \Large font?
    – Hug
    Sep 5, 2014 at 8:46

2 Answers 2

2

To my surprise, the first or the second optional arguments of \chemfig do not take the option font=\Large (which is a tikz option for node font), contrary to what manual states. Here are the two methods mentioned by cgnieder along with a scalebox version (very hacky).

\documentclass{article}
\usepackage{chemfig,graphicx}

\begin{document}
%% ugly method and not advisable
\definesubmol{R1}{--[:150]-[::60]-[::-60]-[::60]-[::-60]-[::-60]-[::-60]-[::-60]-[::60]}
\definesubmol{R2}{--[:30]-[::-60]-[::60]-[::-60]-[::+60]-[::+60]-[::+60]-[::+60]-[::-60]}
\definesubmol{R3}{-[,0.6]}
\chemfig[][scale=0.7]{([:-18]\vphantom{N}\scalebox{1.2}%
{\smash{N}}*5((!{R1})-(!{R3})=\chemabove[0.8ex]{\vphantom{N}\scalebox{1.2}%
{\smash{N}}}{\quad\scriptstyle\oplus}([:342]!{R2})-=-))}

%% change printatom
\renewcommand * \printatom[1]{\Large\ensuremath{\mathrm{#1}}}

\definesubmol{R1}{--[:150]-[::60]-[::-60]-[::60]-[::-60]-[::-60]-[::-60]-[::-60]-[::60]}
\definesubmol{R2}{--[:30]-[::-60]-[::60]-[::-60]-[::+60]-[::+60]-[::+60]-[::+60]-[::-60]}
\definesubmol{R3}{-[,0.6]}
\chemfig[][scale=0.7]{([:-18]{N}*5((!{R1})-(!{R3})=\chemabove{N}{\quad\scriptstyle\oplus}([:342]!{R2})-=-))}
\renewcommand * \printatom[1]{\ensuremath{\mathrm{#1}}}   %% resetting for the example


%% fix a static bond length
\setatomsep{5mm}
\definesubmol{R1}{--[:150]-[::60]-[::-60]-[::60]-[::-60]-[::-60]-[::-60]-[::-60]-[::60]}
\definesubmol{R2}{--[:30]-[::-60]-[::60]-[::-60]-[::+60]-[::+60]-[::+60]-[::+60]-[::-60]}
\definesubmol{R3}{-[,0.6]}
\chemfig[][]{([:-18]{N}*5((!{R1})-(!{R3})=\chemabove{N}{\quad\scriptstyle\oplus}([:342]!{R2})-=-))}
\end{document}

enter image description here

4
  • I use the second version and encapsulate big molecules like this in the two renewcommand statements so that it's applied locally. Thank you very much!
    – Hug
    Sep 5, 2014 at 9:47
  • You can use font=\large if you prevent it from expansion in the wrong moment, e.g. by loading etoolbox and adding \robustify\large to the preamble
    – cgnieder
    Sep 5, 2014 at 9:52
  • @cgnieder: Yes, I found that out soon after posting the answer (and it was not smooth). But I felt that it is again hacky, hence didn't add it. Thanks for noting though. :-)
    – user11232
    Sep 5, 2014 at 10:01
  • IMHO it isn't (but that's just an opinion...). None of 2e's macros are engine protected since it predates eTeX. I imagine that the corresponding macros in a future LaTeX3 probably will be...
    – cgnieder
    Sep 5, 2014 at 11:02
1

Changing the atom separation to 2em and subsequent scaling of the figure works fine in my case.

\setatomsep{2em}\chemfig[][scale=2.0]{<figure-description>}
1
  • Doesn't work for me.
    – shrx
    Apr 19, 2017 at 7:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .