cgnieder / chemmacros Goto Github PK
View Code? Open in Web Editor NEWcomprehensive support for typesetting chemistry documents
License: LaTeX Project Public License v1.3c
comprehensive support for typesetting chemistry documents
License: LaTeX Project Public License v1.3c
Is there an easy way (other than \textit{b}
) to input a lowercase italic letter inside a \iupac
command? This is needed for fused ring systems: http://www.acdlabs.com/iupac/nomenclature/79/r79_63.htm#a_21__5 http://www.acdlabs.com/iupac/nomenclature/93/r93_74.htm
If not, consider this a feature request.
Hello
Thank you for this amazing package!
Would it be possible to add an option to include the number of the compound into the brackets, eg. name (number, mass, ...) as opposed to the current behaviour: name number (mass, ...)?
Dear Clemens,
could you provide an option to label arrows in the reactions module?
(Perhaps following the syntax of chemformula:
\begin{reactions}
A &->[a][b] B + C \\
D + E &->[a][b] F
\end{reactions}
with a as the superscript and b the subscript of the arrow similar to:
\ch{A + B ->[a] C}
Regards,
Jakob
The chemmacros
package instantaneously loads the package bm
. Unfortunately this breaks later font choices (see MWE below), which is an instrinsic limitation of the bm
package and stated like this in its manual.
This means that it is best to load the package after any packages that define new symbol fonts, or (like the mathtime package) completely change the symbol font allocations.
There are two possibilities to rectify this issue:
bm
via \AtBeginDocument{\RequirePackage{bm}}
.chemmacros
in the manual.\documentclass{article}
\usepackage{chemmacros}
\usepackage{mathpazo}
\begin{document}
$\bm{a}$ versus \boldmath$a$\unboldmath
\end{document}
As I described in detail already at stackexchange (including a workaround), using the range-phrase option of the \SIrange-command of siunitx within a chemical equation (tested as top of an arrow) will cause errors.
used on MikTex
versions:
chemmacros: 5.11
siunitx: 2.8b
chemformula: 4.15j
I came across the following problem:
Line breaking after parentheses adds a hyphen of course. However, when a hyphen is already present in this position, a redundant hyphen is still produced.
\documentclass{scrbook}
\usepackage{chemmacros}
\chemsetup{modules={nomenclature}}
\begin{document}
\huge\iupac{SomeVeryLongNameWithParentheses-(Followed)-ByHyphens}
\end{document}
An example for where this occurred was [1,1'-biphenyl]-4,4'-dicarboxylic acid.
Hello,
\documentclass{article}
\usepackage{fourier}
\usepackage{chemmacros}
\usepackage[version=4]{mhchem}
\usepackage{chemfig}
\begin{document}
\chemfig{H-[:0]C(=[:60]\charge{30=|,120=|}{O})-[:-60]\charge{30=|,-60=|,-150=|,-25:8pt={$\fscrm$}}{O}}
\end{document}
With this example, I have a bug when mhchem is loaded.
Any idea ?
I use TexLive 2022
Best regards
(from here: https://tex.stackexchange.com/q/518398/134574)
Due to a bad timing between achemso
and chemmacros
, the following
document errors:
\documentclass{achemso}
\usepackage{chemmacros}
\title{Study of \iupac{1,2-di|methyl|benzene}}
\begin{document}
\end{document}
because achemso
appends \maketitle
to \document
, and only then
chemmacros
(loads etoolbox
and) officially starts the document. Then,
since the document is not tarted at the time \maketitle
is used, the -
(and other symbols) are not defined when \iupac
is used in the title, thus
they error.
It seems to me that it wouldn't harm to do
\bool_set_true:N \l__chemmacros_in_document_bool
in the definition of
\chemmacros_iupac:nn
, probably somewhere here:
chemmacros/chemmacros.module.nomenclature.code.tex
Lines 713 to 715 in 489695f
so that all definitions are there when needed. I don't think this would be
a problem since at this point typesetting is already allowed, and if \iupac
were to be used before that, then the Missing \begin{document} error
would kick in.
The use of the either packages chemformula
or chemmacros
with beamer
triggers the error:
(/home/rafapa/texlive/2019/texmf-dist/tex/latex/koma-script/scrlfile.sty
LaTeX Warning: Command \InputIfFileExists has changed.
Check if current package is valid.
LaTeX Warning: Command \InputIfFileExists has changed.
Check if current package is valid.
)
(/home/rafapa/texlive/2019/texmf-dist/tex/latex/filehook/filehook-scrlfile.sty
! Package filehook Error: Detected 'scrlfile' package with unknown definition o
f \InputIfFileExists.
Use the 'force' option of 'filehook' to overwrite it..
See the filehook package documentation for explanation.
Type H <return> for immediate help.
...
l.111 ... option of 'filehook' to overwrite it.}{}
\%
I attach an example. If you comment \usepackage{chemmacros}
there is no error message.
Sincerely,
Rafael
\documentclass[t,pdf,xcolor=pdftex,dvipsnames,table,10pt]{beamer}
\usepackage{chemmacros}
\usepackage[T1]{fontenc} % european characters
\usepackage[utf8]{inputenc}
% here you define the information that will be displayed in the title/cover page
\title[QFI]{Química Física I}
\author[Rafael R. P.]{{\LARGE Tema 3}}
\institute[QF, Univ. de Sevilla]{\Large Introducción a los sistemas multicomponentes}
\date{Grupo 4\\Curso 2019-2020}
\begin{document}
\begin{frame}[shrink=15]%,plain]
\titlepage
\begin{block}{3. Introducción a los sistemas multicomponentes. (4 horas)}
\begin{itemize}
\item El volumen molar parcial.
\item Propiedades molares parciales.
\end{itemize}
\end{block}
\end{frame}
\end{document}
Hi!
In some edge cases an extra dash is inserted after \{element}
macros:
\documentclass{article}
\usepackage{chemmacros}
\begin{document}
Compounds with very long names such as in this example somecharsab
\iupac{\N-(\emph{tert}-nonsense)butverylongnametoglycosylamines} sometimes
produce an extra dash due to hyphenation.
\end{document}
Not in this case however:
\documentclass{article}
\usepackage{chemmacros}
\begin{document}
Compounds with very long names such as in this example somecharsabc
\iupac{\N-(\emph{tert}-nonsense)butverylongnametoglycosylamines} sometimes
produce an extra dash due to hyphenation.
\end{document}
Chemmacros v5.11 2020/03/07
pdflatex -v
pdfTeX 3.14159265-2.6-1.40.21 (TeX Live 2020)
or
lualatex -v
This is LuaHBTeX, Version 1.12.0 (TeX Live 2020)
Hello,
I have trouble compiling my tex file using chemmacros. It gives me the following error
`! Undefined control sequence.
NewChem\str_uppercase:f
{\tl_head:n {Charge}}\tl_tail:n {Charge}
l.122 ...hemmacros_new_charge_command:Nn #1 {#2} }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type
I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
RenewChem\str_uppercase:f
{\tl_head:n {Charge}}\tl_tail:n {Charge}
l.122 ...hemmacros_new_charge_command:Nn #1 {#2} }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type
I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.
And so on.
I don't know why it gives me errors like that. I'm using TexMaker and I've installed chemmacros using the miktex package manager.
Could someone help me ?
Thank you very much !
Have a nice day
While \iupac
is supposed to add hyphens after closing parentheses when a line break is necessary, it also adds one between two closing parentheses:
MWE:
\documentclass[12pt, a4paper, twoside=semi, BCOR=10mm]{scrartcl}
\usepackage{chemmacros}
\chemsetup{modules={nomenclature}}
\NewDocumentCommand{\nbh}{}{\mbox{-}\nobreak\hspace{0pt}} %to avoid problematic \mbox{} in \iupac{}
\NewChemIUPACShorthand{=}{\nbh} %creates new shorthand to be used in \iupac{} for non-breaking hyphens
\begin{document}
\subsubsection{\iupac{ 4,4'=(((([1,1'=biphenyl]-4,4'=dicarbonyl)bis((ada|man|tan-1=yl)a|zane|di|yl))bis(carbonyl))bis(azanediyl))bis((2,2,6,6=tetra|me|thyl|pi|per|i|din-1=yl)oxi|da|nyl)}}
\end{document}
While trying to answer this question Create a simple “scheme” environment and a “List of Schemes”, I stumbled upon \listofschemes
resulting in a bunch of error messages when used in combination with the book
class. The following MWE works perfectly fine with article
, report
, the KOMA-script classes (including scrbook
) and memoir
but results in the error messages quoted below, when used with book
.
MWE:
\documentclass{book}
\usepackage{chemmacros}
\chemsetup{modules=scheme}
\begin{document}
\listofschemes
\end{document}
excerpt of the log file:
! Argument of \use:c has an extra }.
<inserted text>
\par
l.7 \listofschemes
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
! Paragraph ended before \use:c was complete.
<to be read again>
\par
l.7 \listofschemes
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
The above error messages were shown when compiling the MWE using an up to date MiKTeX (updated today).
Is there a way to override detection (cf. snippet) of float creation method (e.g. via an option in the scheme
module?
chemmacros/chemmacros.module.scheme.code.tex
Lines 132 to 135 in 489695f
I am currently forced to work with a scrbook
implementation sr-vorl
and do not manage to tweak the list of schemes to have the same formatting as the list of figures and list of tables. Adjust scheme numbering to within chapter (using the anyways loaded package chngcntr
), successfully alters numbering, but the indent
and numwidth
do not match.
\usepackage{chemmacros}
<...>
\chemsetup{
modules = {
nomenclature,
reactions,
redox,
scheme,
spectroscopy,
units,
},
formula = mhchem,
}
\chemsetup[mhchem]{
arrows = pgf-filled,
textminus = {--},
minus-text-sidebearing-left = {0.04em},% For dashed bonds
minus-text-sidebearing-right = {0.08em},% For dashed bonds
minus-math-sidebearing-left = {0.04em},
minus-math-sidebearing-right = {0.08em},
}
\chemsetup[redox]{
explicit-sign = true,
explicit-zero-sign = true,
decimal-marker = comma,
roman = false,
pos = top,
}
\chemsetup[spectroscopy]{
format = \bfseries,
pos-number=super,
}
\chemsetup[nomenclature]{
coord-use-hyphen = {false},
}
<...>
\AtBeginDocument{\counterwithout{scheme}{chapter}}
\AtBeginDocument{\counterwithin{scheme}{chapter}}
Although, I guess the KOMA
method should be used already in this case (using a KOMA
class) and I don't really understand why the list of schemes does not fit the format.
I was hoping that using a different creation method would help me overcoming that issue.
Or would you advise to manually define the float before chemmacros gets to do it?
\DeclareNewTOC[
type = scheme ,
types = schemes ,
float ,
name = Scheme ,
listname = {List of Schemes},
counterwithin=chapter
]{scheme}
Attempting to set the sticky-per
option of siunitx
at any time before or after loading chemmacros
causes one of several errors. Either there's an option conflict, or the package's use of \per
causes a duplicate-sticky-per
error.
I'm not sure if there's any solution given the lack of proper namespacing in LaTeX, but it might be at least worth documenting.
As stated in the manual, |
within \iupac{}
commands will prevent the generation of ligatures and also insert some extra spacing. May I ask why this is the case, e.g. what the actual benefit is?
\documentclass{article}
\usepackage{chemmacros}
\begin{document}
\iupac{1,3|-Di|chlo|ro|f|fbenz|ene}
1,3-Dichloroffbenzene
\end{document}
will produce
While the manual also describes how the extra spacing could be adjusted/deactivated:
\chemsetup{
nomenclature/break-space=0em,
nomenclature/hyphen-pre-space=0em,
nomenclature/hyphen-post-space=0em,
}
I couldn't find an option to disable the prevention of ligatures. Is there a workaround?
BTW: There's a small typo in the manual of version 5.11; on page 14, it reads: 'The character = is printed ad \nonbreakinghyphen'
\documentclass{article}
\usepackage{chemmacros}
\usechemmodule{orbital}
\colorlet{lightyellow}{yellow!50}
\begin{document}
\orbital[color=lightyellow]{s} % works
\orbital[color=yellow!50]{s} % error!
\end{document}
Hello,
The \ch
command works well in chemmacros package, but if there is Chinese bracket after the \ch
command there is distortion of the symbol before that.
Please use XeLaTeX engine:
\documentclass{article}
\usepackage{chemmacros,ctex}
\begin{document}
\ch{^{34}SO2}\par
\isotope*{34,S}\ch{O2}(Chinese bracket)\par
\isotope*{34,S}\ch{O2} (Chinese bracket)
\end{document}
Please see the link. @qinglee @leo-liu @Liam0205
Best regards.
\bridge{1}
, \dento{2}
and \hapto{3}
all give subscripts, when \dento{2}
and \hapto{3}
should be superscripts. This can be seen in the current version of the manual or in the example below.
MWE showing the problem:
\documentclass{article}
\usepackage{chemmacros}
\begin{document}
\ch{\hapto{3}}
\ch{\dento{2}}
\end{document}
Output:
chemmacrobugHaptoDento.pdf
As the package bm
is not compatible with some packages such as unicode-math
while the package amsmath
being not whose functions are realized basically normally, would it be a more user-friendly choice to use \RequirePackage{amsmath}
instead of \RequirePackage{bm}
? For users of XeLaTeX, bm
is not so desirable.
Thanks for the attention.
From the v6.1 manual, page 21, pos=sub
causes a problem:
\documentclass{article}
\usepackage{chemmacros}
\begin{document}
\chemsetup[phases]{pos=sub}
\ch{D\sld{} + 2 H2O\lqd{} -> CO2\gas{} + 2 H2\gas}
\ch{H2O "\lqd[\SI{5}{\celsius}]"}
\end{document}
I'm pretty sure™ that (2S,3S) and (2E,4Z) should be (2_S_,3_S_) and (2_E_,4_Z_) instead, respectively, so that the locant numbers are printed in roman. This resource seems to confirm my opinion, see page 17 and 19, for example.
Using one of the examples given in the manual, it no longer compiles, it was compiling up until yesterday. Is this possibly related to the chemmacros error but output ok I submitted on tex.stackexchange.com?
\documentclass{article}
\usepackage{chemmacros}
\begin{document}
\ch{
\OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox}
}
\end{document}
I get the following errors:
ABD: EveryShipout initializing macros
./chemmacros2.tex:7: Undefined control sequence.
<argument> \chemformula_font_inner: \OX
{a,Na}\c_math_toggle_token \rightarr...
l.7 }
?
./chemmacros2.tex:7: Undefined control sequence.
<argument> ...\l__chemformula_math_space_skip \OX
{b,Na}\pch \redox (a,b)[\c...
l.7 }
?
./chemmacros2.tex:7: Undefined control sequence.
<recently read> \redox
l.7 }
?
[1] (./chemmacros2.aux) )
So for my thesis i changed the numbering of Equations to look like "Eq. 2.2-1" (Eq. chapter.section - 1).
I did this with the command \renewcommand{\theequation}{Eq.\,\thesection-\arabic{equation}}
.
After changing this, I realized that my tags for reactions also have changed.
Also I can't change the look of them with
\renewcommand{\thereaction}{R. \thesection-\arabic{reaction}}
which was able at the beginning of my writing.
Is there anything I'm missing?
Hello,
I have some trouble with the chemmacros package. But those errors appeared only very recently.
Error Message is:
! Undefined control sequence.
<argument> ...@language@\@trnslt@current@language
It appears when I try to knit my document with \documentclass{scrartcl} but not with \documentclass{article}.
MWE:
\documentclass{article}
% \usepackage{upgreek}
\usepackage{chemmacros}
<<label = "RSetup", include=FALSE>>=
opts_chunk$set(echo = FALSE, results = FALSE, cache = FALSE)
opts_chunk$set(warning = FALSE, message = FALSE)
opts_chunk$set(dev = "tikz",fig.width=6, fig.height=3, fig.pos='!htb', out.width='.99\\textwidth')
knit_hooks$set(document = function(x) {sub('\\usepackage[]{color}', '\\usepackage{xcolor}', x, fixed = TRUE)}) ## knit_hook is added to supress warnings from xcolor package see https://github.com/yihui/knitr/issues/1068 for more information
@
\begin{document}
\section{S1}
<<firstplot>>=
plot(seq(1,10,1))
@
% \ch{C6H12O11}
\end{document}
The example above compiles fine.
\documentclass{scrartcl}
% \usepackage{upgreek}
\usepackage{chemmacros}
<<label = "RSetup", include=FALSE>>=
opts_chunk$set(echo = FALSE, results = FALSE, cache = FALSE)
opts_chunk$set(warning = FALSE, message = FALSE)
opts_chunk$set(dev = "tikz",fig.width=6, fig.height=3, fig.pos='!htb', out.width='.99\\textwidth')
knit_hooks$set(document = function(x) {sub('\\usepackage[]{color}', '\\usepackage{xcolor}', x, fixed = TRUE)}) ## knit_hook is added to supress warnings from xcolor package see https://github.com/yihui/knitr/issues/1068 for more information
@
\begin{document}
\section{S1}
<<firstplot>>=
plot(seq(1,10,1))
@
% \ch{C6H12O11}
\end{document}
This one does not compile at all.
Do you have any idea why this is happening? Thanks for you support!
- Session info ------------------------------------------------------------------------------------------------------------------------------------------------------------
setting value
version R version 4.1.2 (2021-11-01)
os Windows 10 x64 (build 22000)
system x86_64, mingw32
ui RStudio
language (EN)
tz Europe/Berlin
date 2022-01-18
rstudio 2021.09.0+351 Ghost Orchid (desktop)
pandoc NA
- Packages ----------------------------------------------------------------------------------------------------------------------------------------------------------------
package * version date (UTC) lib source
cachem 1.0.6 2021-08-19 [1] CRAN (R 4.1.1)
callr 3.7.0 2021-04-20 [1] CRAN (R 4.1.1)
cli 3.1.0 2021-10-27 [1] CRAN (R 4.1.2)
crayon 1.4.2 2021-10-29 [1] CRAN (R 4.1.1)
desc 1.4.0 2021-09-28 [1] CRAN (R 4.1.1)
devtools 2.4.3 2021-11-30 [1] CRAN (R 4.1.2)
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.1)
fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.1.1)
fs 1.5.2 2021-12-08 [1] CRAN (R 4.1.2)
glue 1.6.0 2021-12-17 [1] CRAN (R 4.1.2)
lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.1.1)
magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.1.1)
memoise 2.0.1 2021-11-26 [1] CRAN (R 4.1.2)
pkgbuild 1.3.1 2021-12-20 [1] CRAN (R 4.1.2)
pkgload 1.2.4 2021-11-30 [1] CRAN (R 4.1.2)
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.1.1)
processx 3.5.2 2021-04-30 [1] CRAN (R 4.1.1)
ps 1.6.0 2021-02-28 [1] CRAN (R 4.1.1)
purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.1)
R6 2.5.1 2021-08-19 [1] CRAN (R 4.1.1)
remotes 2.4.2 2021-11-30 [1] CRAN (R 4.1.2)
rlang 0.4.12 2021-10-18 [1] CRAN (R 4.1.1)
rprojroot 2.0.2 2020-11-15 [1] CRAN (R 4.1.1)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.1.2)
testthat 3.1.1 2021-12-03 [1] CRAN (R 4.1.2)
usethis 2.1.5 2021-12-09 [1] CRAN (R 4.1.2)
withr 2.4.3 2021-11-30 [1] CRAN (R 4.1.2)
Hey there,
I found an error in the chemmacros package. The bool variable \l__chemmacros_hyperref_bool
is not defined, but asked in the reaction module. Due to changes in expl3 (or something, I don´t remember) this creates errors now.
\documentclass[a4paper,twoside,10pt]{report}
\usepackage{chemmacros}
\begin{document}
Einbinden funktioniert nicht.
\end{document}
Alleine das Einbinden des Paketes erzeugt über 100 Fehler bei einem Lauf mit MikTex.
! Undefined control sequence.
Chem\str_upper_case:f
{\tl_head:n {alpha}}\str_lower_case:f {\tl_...
l.449 \chemgreek_drop_symbols:
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type
I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
There seems to be a bug regarding the compatibility between the nomenclature module and the subfiles package. While the main document compiles with the module, the subfile does not. It seems like this is only a problem with the nomenclature module as other modules work fine.
Versions: chemmacros 45164 (5.8b), subfiles 26645 (1.1) with latex/pdflatex/xelatex
\documentclass[]{article}
\usepackage{subfiles}
\usepackage{upgreek}
\usepackage{chemmacros}
\begin{document}
\subfile{sub}
\end{document}
\documentclass[main.tex]{subfiles}
\begin{document}
% commands working in both documents
\pH
\insitu
\ch{A -> B}
\iupac{abc}
\iupac{ab\chemgamma}
% commands working only in main document
\dexter
\iupac{abc^1}
\iupac{ab-c}
\iupac{ab(c)}
\iupac{ab[c]}
\end{document}
! Undefined control sequence.
l.12 \dexter
and analogously for the rest of the control sequences.
The current manual (v5.8b 2017/08/28) explains the use of the \DeclareChemTranslation
macro on page 31 (section 6.5.2). It states:
\DeclareChemTranslation{language}{key}{translation}
In the table with available translation keys (Table 3 on page 31) the keys scheme-name
, scheme
and Scheme
are listed, among many others.
However, given the following MWE (see https://tex.stackexchange.com/questions/494010/chemmacros-scheme-translation):
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{chemmacros}
\chemsetup{modules={scheme}}
\DeclareChemTranslation{spanish}{scheme-name}{Esquema} % 1
\DeclareChemTranslation{scheme-name}{spanish}{Esquema} % 2
\DeclareChemTranslation{spanish}{scheme}{Esquema} % 3
\DeclareChemTranslation{scheme}{spanish}{Esquema} % 4
\begin{document}
\begin{scheme}
\caption{Lorem ipsum}
\end{scheme}
\end{document}
Variant 1 and 3, which should be valid according to the manual, fail with an error ! Package translations Error: Unknown language `scheme-name'.
and Unknown language `scheme'
. In
chemmacros/chemmacros.module.lang.code.tex
Line 118 in 725c7d9
% #1: key
% #2: lang
% #3: translation
but the code the call to \declaretranslation
uses the arguments in the order 2, 1, 3. So maybe the manual should be updated, or the code, I'm not sure what would be the easiest or best solution.
For the other two variants in the MWE the redefinition of scheme
does not work, there are no errors but the caption of scheme
environments remains in English, or in German if that is the language of the document. The variant that redefines scheme-name
works as expected (no errors and the caption changes). Possibly the manual could clarify which translation key should be used?
The mwe.tex
% arara: pdflatex
\documentclass{article}
\usepackage{chemmacros}
\chemsetup{
compatibility/compatibility=5.10,
modules={spectroscopy},
}
\begin{document}
The preferred NMR solvent is DMSO-d\textsubscript{6}. Could also be \ch{DMSO-d\textsubscript{6}}, but doesn't look nice. What about \ch{ "DMSO-d\textsubscript{6}" } or \ch[minus-output-symbol=-]{DMSO-d\textsubscript{6}}?
\begin{experimental}[list=true,format=\bfseries]
\NMR{31,P[^1H]}(162,\mega\hertz)[DMSO-d\textsubscript{6}]~[ppm] =
\val{34.0}.
\end{experimental}
\begin{experimental}[list=true,format=\bfseries]
\NMR{31,P[^1H]}(162,\mega\hertz)[ "DMSO-d\textsubscript{6}" ]~[ppm] =
\val{34.0}.
\end{experimental}
\end{document}
will produce
where the minus sign within the 31P-NMR line doesn't fit. I suppose that the sovent part within brackets is typeset as if it was put into \ch{}
. That's why I tried to add "..."
to escape text input - However, no luck yet. I also tried to alter minus-output-symbol
as suggested in the manual but found no visual impact on the output...? Thanks for helping!
e/ Oops, now I posted this on chemformula where it better fits chemmacros, I guess. Can you move it to chemmacros or should I repost it to chemmacros...?
Is there a way to change the range-phrase
for every experimental
environment, without changing it in the whole document?
If not, I think an option to do so would be quite handy, and more practical than adding \sisetup{range-phrase = <newrangephrase>}
in every experimental
environment (especially considering consistency).
See https://tex.stackexchange.com/q/447242/35864
Since the three pre-defined Latin phrases are only defined in \AtBeginDocument
, the way to redefine them can be quite unintuitive.
\documentclass{article}
\usepackage{chemmacros}
\RenewChemLatin\insitu{in-situ}
\begin{document}
\insitu
\end{document}
Throws an unexpected error. Replacing \RenewChemLati
with \NewChemLatin
does not help either.
Maybe the documentation could mention the \AtBeginDocument
or (I like that even better) the definition could be made in the normal flow of code and not in \AtBeginDocument
.
Using
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{chemmacros}
\chemsetup{modules={spectroscopy}}
\begin{document}
\begin{experimental}
\NMR{1,H}(400,\mega\hertz)[CDCl3]~[ppm] = \val{8.69} (\pos{8}).
\NMR{1,H}(400,\mega\hertz)[CDCl3]~[ppm] = \val{8.69} (\pos{8A}).
\NMR{1,H}(400,\mega\hertz)[CDCl3]~[ppm] = \val{8.69} (\pos{8\(_A\)}).
\end{experimental}
\end{document}
produces
As alphabetical characters are regularly required to denote e.g. diastereotopic nuclei or equatorial/axial H atoms of cyclohexyl groups, it would be very convenient to have \pos
accept those as well.
The locants (numbers) in stereodescriptors made with \cip
are typeset in an italic font, but these should be upright, as IUPAC does in its preferred names (page 23 and others).
MWE reproducing this (it is also visible on pages 18-19 of the manual):
\documentclass{article}
\usepackage{chemmacros}
\begin{document}
\cip{2R,3S}
\end{document}
I get a warning message with the following document. The output is however correct.
\documentclass{article}
\usepackage{chemmacros}
\usepackage{textgreek}
\begin{document}
\ch{\isotope{U} ->[\textalpha] \isotope{234,Th} ->[\textbeta] \isotope{234,Pa} ->[\textbeta] \isotope{234,U}}
\end{document}
Package chemmacros Warning: The isotope \chemformula_subscript:n
(chemmacros) {2}\chemformula_subscript:n
(chemmacros) {3}\chemformula_subscript:n {4} is not defined for
(chemmacros) element Th.
Hej,
when I use Your great package (v6.2a 2022/03/11) together with hyerref (v7.00x 2023/04/22), both in the actual TeX Live 2023 distrib,, I get the warning
"I failed to patch \hyper@refstepcounter. Please contact the package author."
With other versions, e.g. TeX Live 2020 (ch... v.5.11, hy... v7.00d) this error don't occur.
Here ist the MWE:
`
\documentclass{article}
\usepackage{chemmacros}
%\chemsetup{modules=reactions}% for TL2020
\usepackage{hyperref}
\begin{document}
\begin{reaction}
A + B <<=> AB
\end{reaction}
\end{document}
`
I would like to change the color of the oxidation numbers in some reactions like:
\documentclass{article}
\usepackage{chemformula}
\usepackage{chemmacros}
\usepackage[spanish]{babel}
\let\chold\ch % necesario para que ch ponga bien las flechas
\renewcommand\ch[1]{%
\catcode`<=12
\catcode`>=12
\chold{#1}%
\catcode`<=\active
\catcode`>=\active
}
\chemsetup{
formula = {chemformula} ,
modules = {redox}
}
\chemsetup[redox]{
roman = false ,
explicit-sign = true ,
pos = top
}
\begin{document}
\ch{"\ox{5,N}" O3^- + 1 e- + 2 H+ <=> "\ox{4,N}" O2 + H2O}
\end{document}
I use chemmacros (ox) to write the oxidation numbers, but there is no color option. Is there any way to change only the color of the oxidations numbers? Thanks in advance
When using chemmacros with option formula=mhchem
the \NMR
command is not working.
MWE not working
\documentclass{report}
\usepackage[version=4]{mhchem}
\usepackage{chemmacros}
\chemsetup{
modules = spectroscopy,
formula = mhchem,
}
\begin{document}
\begin{experimental}
\NMR(600)[CDCl3] \val{2.01} (s, \#{24}, \pos{5}), \val{2.31} (s, \#{12}, \pos{1}), \val{6.72--6.74} (m, \#{2}, \pos{11}), \val{6.82} (s, \#{8}, \pos{3}), \val{7.05--7.07} (m, \#{2}, \pos{12}), \val{7.39--7.41} (m, \#{4}, \pos{9}), \val{7.48--7.49} (m, \#{4}, \pos{8}).
\end{experimental}
\end{document}
Errormessage:
! Undefined control sequence.
<argument> \chemformula_ch:nV
However, when using chemformula
it compiles without problems.
MWE working
\documentclass{report}
\usepackage{chemmacros}
\chemsetup{
modules = spectroscopy,
}
\begin{document}
\begin{experimental}
\NMR(600)[CDCl3] \val{2.01} (s, \#{24}, \pos{5}), \val{2.31} (s, \#{12}, \pos{1}), \val{6.72--6.74} (m, \#{2}, \pos{11}), \val{6.82} (s, \#{8}, \pos{3}), \val{7.05--7.07} (m, \#{2}, \pos{12}), \val{7.39--7.41} (m, \#{4}, \pos{9}), \val{7.48--7.49} (m, \#{4}, \pos{8}).
\end{experimental}
\end{document}
If parse=false
is set in the spectroscopy
module options, then it also compiles (but of course the solvent is not displayed as chemical formula).
It seems that \NMR is always calling \ch{<...>}
, independent of the formula
option.
While working on this answer, I found an inconsistency in the counter representation/dependencies (per chapter vs. continuous) as well as in the "chapter gap" in schemes
and \listofschemes
as compared to figure
/table
and \listoffigures
/\listoftables
in different documentclasses.
Using the report
class, figures
/tables
are by default numbered per chapter and the \listoffigures
/\listoftables
contains a larger vertical white space between figures/tables of different chapters than between figures/tables of the same chpter ("chapter gap"). Schemes
on the other hand, are numbered continuously and no chapter gap is present in the \listofschemes
.
Changing the scheme
numbering style from continuous to per chapter using \AtEndPreamble{\numberwithin{scheme}{chapter}}
corrects the numbering style to the expected one, but still leaves us with no gap in the \listofschemes
. Using
\usepackage{xpatch}\makeatletter\xapptocmd{\@chapter}{\addtocontents{los}{\protect\addvspace{10\p@}}}{}{}\makeatother
,
I can add the missing gap back in, however, I would have expected the \listofschemes
to look like the \listoffigures
initially and without having to do thouse changes.
Interestingly, when using memoir
, the schemes are already numbered within the chapter, as expected, however, the chapter gap is missing here, as well.
Taking a look at the KOMA-script classes, we get the opposite result: Using scrbook
or scrreprt
, the chapter gap is correctly present, and also correctly responds to adding listof=nochaptergap
as a class option, as well. On the other hand, the numbering scheme is again continuous instead of per chapter.
MWE:
\documentclass{report} % schemes numbered continuously instead of per chapter, chapter gap in listofschemes missing
%\documentclass{scrbook} % schemes numbered continuously instead of per chapter, chapter gap in listofschemes present
%\documentclass{memoir} % schemes numbered per chapter, chapter gap in listofschemes missing
\usepackage{chemmacros}
\chemsetup{modules=scheme}
\begin{document}
\listoffigures
\listoftables
\listofschemes
\chapter{first chapter}
\begin{figure}\caption{figure}\end{figure}
\begin{figure}\caption{figure}\end{figure}
\begin{table}\caption{table}\end{table}
\begin{table}\caption{table}\end{table}
\begin{scheme}\caption{scheme}\end{scheme}
\begin{scheme}\caption{scheme}\end{scheme}
\chapter{second chapter}
\begin{figure}\caption{figure}\end{figure}
\begin{figure}\caption{figure}\end{figure}
\begin{table}\caption{table}\end{table}
\begin{table}\caption{table}\end{table}
\begin{scheme}\caption{scheme}\end{scheme}
\begin{scheme}\caption{scheme}\end{scheme}
\end{document}
According to my investigations, this should be (partially) fixable by adding
\counterwithin {#1} {chapter}
to the definition of \chemmacros_define_float_method:nnn {KOMA}
and
\renewcommand{\insertchapterspace}{%
\addtocontents{lof}{\protect\addvspace{10pt}}%
\addtocontents{lot}{\protect\addvspace{10pt}}%
\addtocontents{los}{\protect\addvspace{10pt}}%
}
to the definition of \chemmacros_define_float_method:nnn {memoir}
.
The following example does not work
\documentclass{beamerswitch}
\usepackage{upgreek}
\usepackage{chemmacros}
\usepackage[T1]{fontenc} % european characters
\usepackage[utf8]{inputenc}
\begin{document}
\begin{frame}[shrink=15]%,plain]
\ch{Zn} and \ch{Cu\chemprime}
\end{frame}
\end{document}
just changing beamerswitch
to beamer
does work.
The error message is
! Undefined control sequence.
<argument> ...formula_atom_format_tl Cu\chemprime
\group_end: }
l.10 \end{frame}
I do not understand why \chemprime
is not defined when using beamerswitch
.
Thanks for the attention,
Rafael RP
\documentclass{article}
\usepackage{chemmacros}
\begin{document}
$\Delta_\mathrm{f}S^\standardstate(\ch{HgCl2}, \text{cr}, \SI{298.15}{\kelvin}) =
\SI{-154.3}{\joule\per\mole\per\kelvin}$
\end{document}
Hi,
I'm trying to use your package with different fonts setup in XeLaTeX. Unfortunately I think it looks somewhat ugly when I use
%!TEX TS-program = xelatex
\documentclass{article}
% Load packages for fonts and unicode
\usepackage{fontspec,xltxtra,xunicode}
% Load math packages
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{unicode-math}
% Set language
\usepackage[ngerman]{babel}
\setmainfont{TeX Gyre Heros}
\setsansfont{TeX Gyre Heros}
\setmonofont{TeX Gyre Cursor}
% These commands doesn't seem to change anything related to the problem
\setmathfont{TeX Gyre Bonum}
\SetMathAlphabet\mathrm{normal}{TU}{TeX Gyre Bonum}{m}{n}
\SetMathAlphabet\mathbf{normal}{TU}{TeX Gyre Bonum}{bx}{n}
\SetMathAlphabet\mathit{normal}{TU}{TeX Gyre Bonum}{m}{it}
\usepackage{chemmacros}
\begin{document}
\(\pH\)
\(\pOH\)
\(\Ka\)
\(\Kb\)
\(\pKa\)
\(\pKb\)
\vspace{1em}
\pH
\pOH
\Ka
\Kb
\pKa
\pKb
\end{document}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.