2

I'm having a lot of trouble using resizebox with equations in Latex for certain templates. I have the following code:

\documentclass[%
aip,%
jmp,%
% cp,%
amsmath,amssymb,%
%preprint,%
reprint,%
groupedaddress,
%author-year,%
%author-numerical,%
]{revtex4-1} 

\begin{document}

\begin{equation} \label{eq:Field_x}
\resizebox{.9\hsize}{!}{$\hat{x} =0$} \\ 
\end{equation}

\end{document}

Using a IEEE format file and the most recent version of Latex, it works perfectly fine. However if I want to compile it to AIP publishing standards which uses REVTEX 4.1, I get the following errors:

! LaTeX Error: There's no line here to end.See the LaTeX manual or LaTeX Companion for explanation.Type H <return> for immediate help.... \resizebox{.9\hsize}{!}{$\hat{x} =0$} \\
! Missing $ inserted.<inserted text>$ \resizebox{.9\hsize}{!}{$\hat{x} =0$} \\
! Display math should end with $$.<to be read again>\par \resizebox{.9\hsize}{!}{$\hat{x} =0$} \\

I've tried so much and I can't seem to figure out what's wrong. Why would it compile fine using the standard compiler, but not ok using REVTEX4.1? Does anyone have any ideas for what I'm doing wrong and/or if there is a workaround?

John
  • 21
  • You should remove the trailing \\ in your equation. Why is it there in the first place? – Werner Oct 16 '16 at 04:40
  • And there it is! my god I can't believe I didn't try that. I think some equation editors added it there when auto-generating the latex code. Thank you so much for helping me. – John Oct 16 '16 at 04:51
  • +1 My question may be related https://tex.stackexchange.com/q/467729/41144 , still unsolved – wonderich Dec 29 '18 at 00:03

1 Answers1

2

Your error refers to a line-ending which, in your case, happens inside the equation.

Remove the trailing \\ in your equation should solve your problem.

Werner
  • 603,163