3

I have edited a very long equation in the eqnarray environment and broken some long lines at the appropriate positions with \nonumber\\ (see the small example below). After compiling, the equation occupied nearly one page with some long lines beyond the edge of the page.

Since the long equation is in an appendix, I want to shrink its font size only to prevent any long line from going beyond the range of the page. As mentioned above the positions of \nonumber\\ are "appropriate", which means their positions shouldn't be changed. I don't know how to do this, please give me some suggestion. Thank you in advance.

\documentclass[a4paper,12pt]{article}

\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{REVSYMB4-1}
\usepackage{latexsym}
\usepackage[a4paper, total={6in, 9in}]{geometry}

\begin{document}
\begin{eqnarray}\label{eq:longeq}
w &=& 100(\partial_x f)^3x^2
+\cot\theta \partial_x f \partial_x fx^2-\partial_x g x^2
+ \left(z^3-150zzz^2-20\epsilon f z^2\right)
\partial_x f \partial_x^2 f \nonumber\\
&& + \epsilon\left[ 200\left( xxx\cot\theta f^3
-1\right)(\partial_x g)^2
+\left( \cot\theta- yyy^3\right)\partial_x f
-\left(4-1000\cot\theta f^3
\right)g\partial_x^2 f \right]\partial_x g +20zzz^2+500f^2
\nonumber\\
&& +\left( \cdots \right).
\end{eqnarray}

\end{document}
6
  • 2
    Welcome to TeX.SE! Can you please make your code snippet compilable? Then we do not have to guess what you are doing ... BTW: if possible do not use eqnarray ...
    – Mensch
    Commented Aug 25, 2019 at 7:42
  • Break long line into multiple shorts one using one of amsmath environments (align, split, multlines)
    – Zarko
    Commented Aug 25, 2019 at 9:32
  • You also can use the medsize environment from nccmath , which is between textstyle and displaystyle (the latter is reduced by about 20%).
    – Bernard
    Commented Aug 25, 2019 at 12:05
  • Thank you @Mensch please see my update :) To follow the template of a journal, I have used to work with eqnarray, please help in this case if possible. Thank you so much.
    – user55777
    Commented Aug 25, 2019 at 13:59
  • Thank you @Bernard could you please give an example:)
    – user55777
    Commented Aug 25, 2019 at 13:59

3 Answers 3

2

Well, you can use the usual fontsize commands like \small or \footnotesize to get a smaller font to print the equation. But in my eyes that looks ugly, I think better would be to name a term as extra variable to get the long line shorter and explain the new variable in an extra line.

However, in the following MWE I demonstrate the usage of \small and \footnotesize. Please see the leading { and the closing } to have the smaller font size only in the equation inside that {...}:

\documentclass[a4paper,12pt]{article}

\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{revsymb4-1}% <==================================== REVSYMB4-1
\usepackage{latexsym}
\usepackage[a4paper, total={6in, 9in}]{geometry}
\usepackage{blindtext} % <==================== add dummy text to document

\begin{document}
\blindtext
\begin{eqnarray}\label{eq:longeq}
w &=& 100(\partial_x f)^3x^2
+\cot\theta \partial_x f \partial_x fx^2-\partial_x g x^2
+ \left(z^3-150zzz^2-20\epsilon f z^2\right)
\partial_x f \partial_x^2 f \nonumber\\
&& + \epsilon\left[ 200\left( xxx\cot\theta f^3
-1\right)(\partial_x g)^2
+\left( \cot\theta- yyy^3\right)\partial_x f
-\left(4-1000\cot\theta f^3
\right)g\partial_x^2 f \right]\partial_x g +20zzz^2+500f^2
\nonumber\\
&& +\left( \cdots \right).
\end{eqnarray}

{\small % <=============================================== lower fontsize
\begin{align}\label{eq:longequ} % <=====================================
w &= 100(\partial_x f)^3x^2
   +\cot\theta \partial_x f \partial_x fx^2-\partial_x g x^2 \nonumber\\ % <========
  &+ \left(z^3-150zzz^2-20\epsilon f z^2\right)
    \partial_x f \partial_x^2 f \nonumber\\ % <=========================
  &+ \epsilon\left[ 200\left( xxx\cot\theta f^3
   -1\right)(\partial_x g)^2
   +\left( \cot\theta- yyy^3\right)\partial_x f 
   -\left(4-1000\cot\theta f^3
    \right)g\partial_x^2 f \right]\partial_x g \nonumber\\ % <==========
  &+20zzz^2+500f^2 \nonumber\\ % <======================================
  &+\left( \cdots \right).
\end{align}
} % <================================================= end lower fontsize

{\footnotesize % <======================================== lower fontsize
\begin{align}\label{eq:longequa} % <====================================
w &= 100(\partial_x f)^3x^2
   +\cot\theta \partial_x f \partial_x fx^2-\partial_x g x^2 \nonumber\\
  &+ \left(z^3-150zzz^2-20\epsilon f z^2\right)
    \partial_x f \partial_x^2 f \nonumber\\
  &+ \epsilon\left[ 200\left( xxx\cot\theta f^3
   -1\right)(\partial_x g)^2
   +\left( \cot\theta- yyy^3\right)\partial_x f 
   -\left(4-1000\cot\theta f^3
    \right)g\partial_x^2 f \right]\partial_x g \nonumber\\
  &+20zzz^2+500f^2 \nonumber\\
  &+\left( \cdots \right).
\end{align}
} % <================================================= end lower fontsize
\blindtext
\end{document}

BTW I marked important code changings with <===========. That is the resulting pdf:

resulting formulas

Edit:

After the comment of user @barbarabeeton I tried the following MWE (added \blindtext or free aditional text between the equations), but I can not recreate the behaviour described in the given link in the comment:

\documentclass[a4paper,12pt]{article}

\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{revsymb4-1}% <==================================== REVSYMB4-1
\usepackage{latexsym}
\usepackage[a4paper, total={6in, 9in}]{geometry}
\usepackage{blindtext} % <==================== add dummy text to document

\begin{document}
\blindtext
\begin{eqnarray}\label{eq:longeq}
w &=& 100(\partial_x f)^3x^2
+\cot\theta \partial_x f \partial_x fx^2-\partial_x g x^2
+ \left(z^3-150zzz^2-20\epsilon f z^2\right)
\partial_x f \partial_x^2 f \nonumber\\
&& + \epsilon\left[ 200\left( xxx\cot\theta f^3
-1\right)(\partial_x g)^2
+\left( \cot\theta- yyy^3\right)\partial_x f
-\left(4-1000\cot\theta f^3
\right)g\partial_x^2 f \right]\partial_x g +20zzz^2+500f^2
\nonumber\\
&& +\left( \cdots \right).
\end{eqnarray}
This is a short blindtext to test the behaviour of \verb|\small|. 
This is a short blindtext to test the behaviour of \verb|\small|. 
This is a short blindtext to test the behaviour of fontsize command. %\blindtext
{\small % <=============================================== lower fontsize
\begin{align}\label{eq:longequ} % <=====================================
w &= 100(\partial_x f)^3x^2
   +\cot\theta \partial_x f \partial_x fx^2-\partial_x g x^2 \nonumber\\ % <========
  &+ \left(z^3-150zzz^2-20\epsilon f z^2\right)
    \partial_x f \partial_x^2 f \nonumber\\ % <=========================
  &+ \epsilon\left[ 200\left( xxx\cot\theta f^3
   -1\right)(\partial_x g)^2
   +\left( \cot\theta- yyy^3\right)\partial_x f 
   -\left(4-1000\cot\theta f^3
    \right)g\partial_x^2 f \right]\partial_x g \nonumber\\ % <==========
  &+20zzz^2+500f^2 \nonumber\\ % <======================================
  &+\left( \cdots \right).
\end{align}
} % <================================================= end lower fontsize
This is a short blindtext to test the behaviour of \verb|\small|. 
This is a short blindtext to test the behaviour of \verb|\small|. 
This is a short blindtext to test the behaviour of fontsize command. 
{\footnotesize % <======================================== lower fontsize
\begin{align}\label{eq:longequa} % <====================================
w &= 100(\partial_x f)^3x^2
   +\cot\theta \partial_x f \partial_x fx^2-\partial_x g x^2 \nonumber\\
  &+ \left(z^3-150zzz^2-20\epsilon f z^2\right)
    \partial_x f \partial_x^2 f \nonumber\\
  &+ \epsilon\left[ 200\left( xxx\cot\theta f^3
   -1\right)(\partial_x g)^2
   +\left( \cot\theta- yyy^3\right)\partial_x f 
   -\left(4-1000\cot\theta f^3
    \right)g\partial_x^2 f \right]\partial_x g \nonumber\\
  &+20zzz^2+500f^2 \nonumber\\
  &+\left( \cdots \right).
\end{align}
} % <================================================= end lower fontsize
\blindtext
\end{document} 

with the result:

result mwe two

As you can see (marked with the two red arrows) there is no interaction with the line before {\small or {\footnotesize ...

3
  • Do watch out for the interaction of \small (or any font size change) for the display with the baselines of the preceding paragraph. See Use of \small to resize a math display affects the baseline stretch of the preceding paragraph. Commented Aug 25, 2019 at 19:53
  • @barbarabeeton Please see my updated answer. I can not recreate the behaviour which is described in your given link. Is that already corrected with an update in the LaTeX code or one of the packages used?
    – Mensch
    Commented Aug 25, 2019 at 22:49
  • The effect mentioned there won't happen if there is a blank line before the display. (But you don't want a blank line before the display.) There isn't any correction (that I know of) in the LaTeX code or any package; it happens seldom enough that it's not worth the effort to come up with a general "correction" that doesn't affect something else (usually unpredictably). Commented Aug 25, 2019 at 23:02
1

enter image description here

\documentclass[a4paper,12pt]{article}

\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{REVSYMB4-1}
\usepackage{latexsym}
\usepackage[a4paper, total={6in, 9in}]{geometry}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\begin{multline}\label{eq:longeq}
w = 100(\partial_x f)^3x^2 + \cot\theta \partial_x f \partial_x fx^2-\partial_x g x^2   
    + \bigl(z^3-150zzz^2-20\epsilon f z^2\bigr) \partial_x f \partial_x^2 f                 \\
    + \epsilon\bigl[ 200\bigl( xxx\cot\theta f^3 - 1\bigr)(\partial_x g)^2
        + \bigl( \cot\theta- yyy^3\bigr)\partial_x f                                        \\
    - \bigl(4-1000\cot\theta f^3\bigr)g\partial_x^2 f \bigr]\partial_x g +20zzz^2+500f^2    %\\
    + \bigl( \cdots \bigr).
\end{multline}

\end{document}
1

As I said in a comment, you can use \allowdisplaybreaks to enable page breaking inside a multiline equation. Here is a demo:

\documentclass[11pt]{article}
\usepackage[vmargin=2cm]{geometry}
\usepackage{amssymb,amsmath}

\usepackage{lipsum}
\allowdisplaybreaks

\begin{document}

\lipsum[1-5]

            \begin{align}
            \label{eq:S1f}
            y_1 &= a+b+c \\ & = d+e+f \\ & = g+h+ j\\
            y_2 &= a+b+c \\ & = d+e+f \\ & = g+h+j \\
            y_3 &= a+b+c \\ & = d+e+f \\ & = g+h+j \\
            y_4 &= a+b+c \\ & = d+e+f \\ & = g+h+j
            \end{align}

\end{document} 

enter image description here

Added:

As to the new code you posted, I would load mathtools and nccmath. Among many additions to amsmath, the first package enables to depart from an alignment in a line of an align environment, with its \EqMoveLeft command. The latter package defines medium-sized commands, which are ~ 80 % of \display style. This I propose this:

\documentclass[12pt]{article}%

\usepackage{mathrsfs}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{REVSYMB4-1}
\usepackage{nccmath}
\usepackage[a4paper, total={6in, 9in}, showframe]{geometry}

\begin{document}

\begin{align}\label{eq:longeq}
\MoveEqLeft\medmath{
w = 100(\partial_x f)^3x^2
+\cot\theta \partial_x f \partial_x fx^2-\partial_x g x^2
+ \left(z^3-150zzz^2-20\epsilon f z^2\right)
\partial_x f \partial_x^2 f} \notag\\
 & \medmath{{}+ \epsilon\Bigl[ 200\bigl( xxx\cot\theta f^3-1\bigr)(\partial_x g)^2
+\bigl( \cot\theta- yyy^3\bigr)\partial_x f -\bigl(4-1000\cot\theta f^3
\bigr)g\partial_x^2 f \Bigr]\partial_x g}\quad \notag\\
 & \medmath{{}+20zzz^2+500f^2 +( \cdots)}.
\end{align}

\end{document} 

enter image description here

2
  • Thank you for the answer @Bernard. Well, what i need is how to shrink the font size to accommodate a long line in a long multiline equation. Please compile the code in my question and see. Thank you again!
    – user55777
    Commented Aug 25, 2019 at 17:05
  • @user55777: I've added my way of coding the equation you've posted. Please see whether it's OK for you.
    – Bernard
    Commented Aug 25, 2019 at 20:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .