Hot answers tagged

13

Perhaps you are trying to place a box around the last equation. One way to do that is to use Aboxed from the mathtools package: \documentclass{article} \usepackage{mathtools} \usepackage{mhchem} \begin{document} \begin{align*} \ce{K_w} &= \ce{[H3O+][OH^-]} \\ -\log \ce{K_w} &= -\log ( \ce{[H3O+][OH^-]} ) \\ -\log \ce{K_w} &= - ( ...


13

The problem is that bookmarks can't handle things like math, colors, or font changes. You can use \texorpdfstring; the first argument will be used in the document and the second one will be used in the bookmarks: \documentclass{article} \usepackage{mhchem} \usepackage{hyperref} \begin{document} \section{\texorpdfstring{\ce{IrO2}}{Ir02}} \end{document}


12

Pershaps, the chemfig package may help you though it relies on tikz? Here is the first reaction: \documentclass{minimal} \usepackage{chemfig} \begin{document} text before \schemestart \setlewis{4pt}{}{red}\Lewis{0:,\chemfig{@{a}\textcolor{red}{A}}}\hskip4pt\chemfig{@{b}\textcolor{black!40!green}{B}}% \arrow \Lewis{0.,A}% \+\Lewis{4.,B}% ...


12

Yes chemifg is a great tool. But as well as almost every code to picture system the syntax is not trival. Please consider the following example. You can easily see, that chemfig syntax follows a logical and human readable syntax, but will become extremely complex for larger structures. And so far as i can see chemfig is the easiest system for chemical ...


11

Put \mhchemoptions{textfontcommand=\addfontfeature{Numbers=Lining}} inside your document. But: I have never used that package, so I don't know if there is a better way.


11

Update: with version 4.5 (2014/04/08) chemformula has a basic native support for Kröger-Vink notation. It must be enabled with the option kroeger-vink=true: \documentclass{article} \usepackage{chemformula}[2014/04/08] \begin{document} \setchemformula{kroeger-vink} \ch{Al_{Al}^x} \ch{Ni_{Cu}^x} \ch{V_{Cl}^{*}} \ch{Ca_i^{**}} \ch{e'} \ch{Cl_i'} ...


11

You can simply write it inside the equation and maybe add some horizontal space between with \quad or \qquad: \documentclass{article} \usepackage[version=3]{mhchem} % Package for chemical equation typesetting \usepackage{amssymb} \usepackage{siunitx} \begin{document} \begin{equation} \ce{N2(g) + 3H2(g) -> 2NH3(g)} \qquad \Delta H_{\mathrm{f}}^\circ = ...


9

can also be put into a macro if it is used multiple times with different elements. \documentclass{article} \usepackage{pst-node} \usepackage[version=3]{mhchem} \usepackage{chemexec} \begin{document} \huge \ce{\rnode{left1}{2\ox{0}{Na}} + \rnode{left2}{\ox{0}{Cl}_2} -> \rnode{right1}{2\ox{+1}{Na}^+} + \rnode{right2}{2\ox{-1}{Cl}^-}} ...


9

The short answer is 'no' at the present time. Products such as ISISDraw/Accelrys Draw or ChemDraw produce binary files, which cannot be read directly by TeX. So any conversion would either require a separate tool or reading a text file format, such as ChemDraw's XML format. By far the most popular file format for journal submission is ChemDraw's .cdx ...


9

Techically, ( and ) are not letters, so they won't participate to hyphenation. You can make them acceptable with the following trick, which should have no adverse effect with normal input: \lccode`\(=`\( \lccode`\)=`\) \hyphenation{poly(ethylene-glycol)} A different strategy could be to define a macro: \newcommand{\Q}[1]{(\nobreak\hspace{0pt}#1)} ...


8

Another answer because I misunderstood your question. Digging around in the source code there are several macros which effect the length of the arrows. From mhchem.sty we have \newcommand*\mhchem@xlongrightshortleftharpoons[2][]{\mathrel{% \sbox{\mhchem@arrows@box}% {$\mkern9mu\ext@arrow 3399\mhchem@leftharpoondownfill@% ...


8

I suggest to take a look to the new package chemmacros that was uploaded yesterday on CTAN and should be in TeX Live in the next update. The examples on pages 9 and 10 seem to be what you need. Link for chemmacros: http://www.ctan.org/tex-archive/macros/latex/contrib/chemmacros


8

Edit: mhchem version 3.16 includes the fix shown below. Update will be available in a few days. (This redefinition requires the current version of mhchem, not the one in texlive 2012) \documentclass{article} \usepackage{amsmath} \usepackage{mhchem} \makeatletter \def\mhchem@cee@i#1\\#2#3\mhchem@ENDEND{% \ifx\mhchem@END#2% ...


8

The textcase package provides a version of uppercase that is more careful about these things \documentclass{minimal} \usepackage[paperwidth=70mm, paperheight=20mm, left=10pt, top=20pt]{geometry}% \usepackage{textcase} \usepackage[version=3]{mhchem} \begin{document} \MakeTextUppercase{Preparation of \NoCaseChange{\ce{Mn3Ga}}.} \end{document}


8

do not use empty lines in definitions! \newcommand\ncoord[2][0,0]{% \tikz[remember picture,overlay]{\path (#1) coordinate (#2);}} or at least \newcommand\ncoord[2][0,0]{% \tikz[remember picture,overlay]{\path (#1) coordinate (#2);}% }


8

Form the file ioplatexguidelines.pdf: Since mhchem loads and, more importantly, requires amsmath, you have two options: stick to iopart.cls and don't use mhchem but another package offering a similar functionality, or change your document class and use mhchem; as the guideline mentions this is not a problem since they will accept your document written ...


7

Honest Answer: The answer is straightforward. Because I, the package author, did not have any sensible use case in mind, when writing the macro handling. Explanation: Because the mhchem syntax is so different from normal LaTeX, I have to parse it before any inner expansion. So I have to take care of macros early on and decide how to handle them. I had some ...


7

The argument of mhchem's \ce already is a "hidden math mode". \ce{\bfseries B} will give ! LaTeX Error: Command \bfseries invalid in math mode. Try \ensuremath instead: \documentclass[12pt,letterpaper]{article} \usepackage{amssymb,mathtools} \usepackage[version=3]{mhchem} \newcommand{\tphoton}{\ensuremath{\gamma}} \begin{document} \ce{\tphoton} ...


6

You could simply enclose \times in braces: \documentclass[12pt,a4paper]{article} \usepackage[version=3]{mhchem} \begin{document} \ce{K_a {\times} K_b = K_w} \end{document}


6

It is not possible to draw such schemes with mhchem but as Twig has already noticed chemfig can be used. To expand a bit on Twig's answer and chemfig's possibilities: the \arrow command is the important macro here which is only valid between \schemestart and \schemestop. It has lots of arguments so here is a quick overview: draw an arrow and call the ...


6

Here is a solution using (my own) chemformula. It provides the option arrow-ratio=<num> where <num> should be a value between 0 and 1: \documentclass{article} \usepackage{chemformula} \begin{document} \ch{CH2OH + ATP <=>>[Hexokinase] "glucose~6-phosphate" + ADP + H+} \ch[arrow-ratio=.2]{CH2OH + ATP <=>>[Hexokinase] ...


6

You can simply place the non-integer part inside curly brackets \ce{Fe_{97.5}C_{2.5}} As @karlkoeller mentioned in a similar answer (now deleted), the . is a special character inside \ce


6

ChemFig is a great package but I don't believe that you'll gain much in time if you create your schemes with it rather than with ChemDraw. Once you know you're way around ChemFig you're just as fast or slow with it than with ChemDraw (supposing you know your way around that, too), at least that's my experience. There are other points you should consider: ...


6

There is a separate command for using \ce in equation environments that allows using ampersands (&) for alignment: \cee So, no need to work around an make things less readable: \documentclass{article} \usepackage[version=3]{mhchem} \begin{document} \begin{align} \cee{CH3COOH + NaOH &<=> CH3COONa + H2O} \\ \cee{H2O &<=> H^{+}_{(aq)} ...


6

\documentclass{article} \usepackage{amsmath} \let\xxmathchoice\mathchoice \usepackage{breqn} \let\yymathchoice\mathchoice \usepackage[version=3]{mhchem} \begin{document} \let\mathchoice\xxmathchoice \ce{H2SO4} ... \let\mathchoice\yymathchoice \begin{dmath}... \end{document}


6

As in mhchem answer, use \ce{CO2} to get the right formatting. If you want to get your "List of Abbreviations" printed, load the glossaries package with the option acronym \usepackage[acronym]{glossaries} % Load the package and define your entries as acronyms before \begin{document}, e.g. \newacronym{co2}{\ce{CO2}}{Carbon Dioxide} MWE: ...


6

Joseph Wright wrote a message to 10 package authors last weekend (and I am sure he does not mind quoting it here). Hello all, I've done a recent expl3 update in which I've remove functions deprecated in 2013, following the pattern we've set up. A sweep of TeX Live shows there are a few stray uses of \int_case:nnn, \tl_case:Nnn, \str_case:nnn ...


6

Smash the bottom of the exponent: \documentclass[12pt]{scrbook} \usepackage{amsmath} \usepackage[version=3]{mhchem} \usepackage{blindtext} \DeclareRobustCommand{\va}[2]{% \ensuremath{% \nu_{\,\text{#2}}% ^{\smash[b]{\ce{\,#1}}}% }% } \begin{document} \blindtext \va{CO2}{as} \va{CO}{as} \va{CO2}{as} \va{CO}{as} \va{O2}{asas} \blindtext ...


6

This is a bug in mhchem, which doesn't either define the command \pdf@strcmp or load the package pdftexcmds explicitly, where it is defined, but relies on the driver code (graphics.cfg) to load it. The bug can be seen when using MiKTeX with pdfLaTeX or XeTeX (not LuaLateX). When using TeX Live it can be noticed compiling with XeTeX. As a workaround, it ...


5

\oplus and \ominus are math symbols and must be used in math mode. This is also true in mhchem's formulas. \documentclass{article} \usepackage[version=4]{mhchem} \begin{document} \ce{A+ + A-} \par \ce{A^{$\oplus$} + A^{$\ominus$}} \end{document}



Only top voted, non community-wiki answers of a minimum length are eligible