General Question: How do I use an environment from a package and modify one or more commands but keep all the functionality of the the others? Sorry if I should know that this isn't possible or viable and it's just easier to make the environments yourself from scratch (which would be beyond my skills).
Specific question: How do I use the experimental environment from chemmacros but modify for example the \NMR
, \pos
and maybe \J
commands? And is it possible to still make \\#{}
work with a renewed \NMR
command?
For our reports we need to present NMR data like shown in the picture.
Renewing the \NMR
command works well for use in the experimental environment and outside. But renewing the other commands doesn't work. And just \newcommand
for example for \J{}{}{}
works but only outside the environment.
\documentclass[12pt,a4paper]{scrartcl}
\usepackage{textgreek}
\usepackage{siunitx}
\usepackage{chemmacros}
\chemsetup{modules={all},greek=textgreek}
\renewcommand{\NMR}[6]{\noindent\textbf{$\mathbf{^{#1}#2}$-NMR (#3)} (#4~MHz, #5~K, \ch{#6}, $\delta/\si{ppm}$):} %\nmr{MZ}{Kern}{Nummer}{Frequenz}{Temperatur}{Lsm}
\renewcommand{\J}[3]{$^{{\textsl{##1}}}J_{\mathrm{##2}} = ##3~\mathrm{Hz}$} %\J{Bindungen}{koppelnde Kerne}{Frequenz}
\renewcommand{\pos}[1]{\textbf{##1}} %Zuordnung
\begin{document}
\begin{experimental}
\NMR{1}{H}{prakt\_AC.999}{400}{298}{CDCl3} \val{1.11--2.22} (d, 4 H, \J{4}{HH}{6.66}, \pos{7})
\end{experimental}
\end{document}
And renewing the environment "deletes" all the other commands, like for example the \val{}
command or the \J
command.
\renewenvironment{experimental}{
\renewcommand{\NMR}[6]{\noindent\textbf{$\mathbf{^{##1}##2}$-NMR (##3)} (##4~MHz, ##5~K, \ch{##6}, $\delta/\si{ppm}$):} %\nmr{MZ}{Kern}{Nummer}{Frequenz}{Temperatur}{Lsm}
\renewcommand{\pos}[1]{\textbf{##1}} %Zuordnung
\renewcommand{\#}[1]{\textbf{##1}} %Anzahl Kerne
}{}
experimental
first before if you still want to have its basic behaviour. And of course, the redefinitions are breaking the old stylechemmacros
, p. 55 f.chemmacros
'experimental
environment?«