Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\documentclass[10pt]{article}
\usepackage{chemfig}
\usepackage[margin=1.2in]{geometry}
\newcommand{\chem}{\setatomsep{2em}\chemfig}

\begin{document}

\begin{itemize}
\item[--] 1$^\circ$ Alcohol $\rightarrow$  Aldehyde\\
\centerline{\schemestart
\chem{R-C(-[2]OH)(-[6]H)-H} \arrow{0}[,0] \+ [O] \arrow \chem{R-[:30]C(=[2]O)-[:-30]H} \arrow{0}[,0] \+ H$_2$O
\schemestop}
\end{itemize}

\end{document}

The above gives:

Overfull \hbox (25.00003pt too wide) in paragraph

It was working but now it doesn't, how can I fix it?

share|improve this question
1  
Please, make that code snippet into a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  egreg May 8 '13 at 18:00
    
I assume \newcommand{\chem}{\setatomsep{2em}\chemfig} is to have a command that's supposed to locally use an atomsep of 2em? If yes then the definition is wrong since the scope is not local to \chem. It simply sets the atomsep to 2em for all following appearances of \chemfig. It works in your MWE since the scheme places its compounds into TikZ nodes which are TeX groups. So it probably doesn't matter if you only use \chem inside \schemestart ...\schemestop. But it you use it anywhere else in the document beware to use it inside a group. –  cgnieder May 8 '13 at 20:41
add comment

1 Answer

up vote 8 down vote accepted

\centerline{ isn't really a latex command (it is in the latex format but just escaped from plain TeX). It makes a box \hsize wide but does not know about latex list structures and the indentation they introduce. So you line is too wide by 25pt which will be the left margin of the list item. Just remove \centerline and replace it with a \begin{center}...\end{center}.

share|improve this answer
    
I need to have the line centered though, as chemical equations look much better in the center. –  STRAIGHT OUTTA COMPTON May 8 '13 at 19:13
    
@STRAIGHTOUTTACOMPTON \begin{center}...\end{center} –  David Carlisle May 8 '13 at 19:19
    
Thanks but now I get "Underfull \hbox (badness 10000) in paragraph" instead. I even get it in the ones not even inside of itemize –  STRAIGHT OUTTA COMPTON May 8 '13 at 19:45
    
Edit: never mind removing the \\ did fix it –  STRAIGHT OUTTA COMPTON May 8 '13 at 19:51
    
delete the \\ as well (\\ is almost always the wrong thing if used in a paragraph rather than to end a table row) I just checked, your example then runs with no warnings. –  David Carlisle May 8 '13 at 19:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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