0

Hi I am trying to write up some NMR data and would like to be able to make some of the formatting a little simpler to setup.

Looking at this this link here I was able to go through and change the coupling constants to italics, but I think this might be a messy solution because it seems to have had some effect on my fonts and also how the \emph command works with the \ce label.

For example, within the new [NMR2] environment, I would like to be able to identify individual proton signals eg. \ce{CH2C\emp{H}3}. This seemed to work ok when I was trying to come up with a MWE, but once I tried using it within my actual document, it fails to work.

\documentclass[11 pt]{report}

\usepackage[T1]{fontenc}
\usepackage{bera}  
\usepackage[scaled]{berasans} 
\usepackage[scaled]{beramono} 
\usepackage{textcomp} 

\usepackage[utf8]{inputenc} 
\usepackage[english]{babel}

\usepackage[left=1in, right=1in, top=0.75in, bottom=0.5in, includeheadfoot, headheight=13.6pt]{geometry}
\usepackage{setspace}
\usepackage[compact]{titlesec}
\usepackage{balance} 
\usepackage{lastpage}
\usepackage[toc, page, header]{appendix} 
\usepackage{fancyhdr} 
\usepackage[plain]{fancyref} 


\usepackage{achemso}
\usepackage[version=3]{mhchem}

\usepackage[runs=2]{auto-pst-pdf}
\usepackage{chemstyle}
\usepackage{chemnum}

%%
%This Section Taken from linked%
\usepackage{regexpatch,environ}

 \NewEnviron{NMR2}{%
 \xpatchcmd*\BODY{J}{\textit{J}}{}{}%
 \BODY}

 %%

\usepackage{graphicx} 
\usepackage{mathptmx} \usepackage[scaled=.95]{helvet} \usepackage{courier}


\begin{document}

\begin{NMR2}
\ce{^1H} (\SI{600}{\MHz}; \ce{DMSO-d6}) 4.14 (2H, q, J 7.1 Hz, \ce{C\emph{H}2CH3}), 1.22 (3H, t, J 7.1 Hz, \ce{CH2CH3}).
\end{NMR2}

\end{document}

Is there a better way to do what I want here?

Here are the error messages:

? Runaway argument? ! Paragraph ended before \emph was complete. \par l.45 \end{NMR2}

? ! Missing $ inserted. $ l.45 \end{NMR2}

? ! Missing } inserted. } l.45 \end{NMR2}

? ! Missing } inserted. } l.45 \end{NMR2}

? ! Missing } inserted. } l.45 \end{NMR2}

? ! Undefined control sequence. \mhchem@cf@i ...tect #1\else \if \mhchem@cf@state e\mhchem@cf@sup =\expandaf... l.45 \end{NMR2}

  • 1
    We can't help you unless you can come up with a MWE that reproduces the issues you have. The code you present here works fine. – clemens Sep 25 '14 at 7:22
  • Perhaps it is an issue with my installation then? When I ran this through, it failed to compile properly, issues with extra } and $ I have am reinstalling miktek now, hopefully it will be ok afterwards. – Dylan Sep 25 '14 at 7:37
  • Does the exact code from your question produce errors (if so then I misunderstood the question)? You should then post the exact error message you get (re-installing really is the very last measure) – clemens Sep 25 '14 at 7:40
  • Yeah it does. The console output is too large to enter in its entirety. I will try and edit my post with just the error messages – Dylan Sep 26 '14 at 6:24
1

Making a copy of the .tex file into a new directory seems to have solved the problem. It looks like I had a few extra .sty files that might have been causing the issue. Not really sure which one it was, but it now compiles fine.

Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.