6

What I am trying to do is probably very similar to the "Keep with next/previous" in MS Word. I have an equation and its description in two consecutive lines. I would like the two lines to shift to the next page if they cannot be in the same page.

\begin{equation}
   Incoming\ Radiation, F_\lambda = S_\lambda.\cos \phi
   \label{eq:SolSpecIrrad}
\end{equation}
Where $\phi$ is the solar zenith angle. % This line is getting pushed 
% to the next page, as the equation is the last 
% thing on the previous page. 
4
  • Look into the needspace package. Something like \needspace{1in} \begin{equation} Incoming\ Radiation, F_\lambda = S_\lambda.\cos \phi \label{eq:SolSpecIrrad} \end{equation} Where $\phi$ is the solar zenith angle. should work. Jun 21, 2016 at 11:27
  • 1
    don't use math italic for words! Incoming\ Radiation should be \textit{Incoming Radiation} Jun 21, 2016 at 11:28
  • @DavidCarlisle I was sure that text in math should not be in italics?
    – Runar
    Jun 21, 2016 at 11:37
  • @runartrollet \textrm is anther possibility of course, although I assumed the OP wanted italics here. Jun 21, 2016 at 13:09

3 Answers 3

4

You could put it into a minipage, or use the samepage-package. I've added here the mathtools-package, which I would advice you to use. As commented by David Carlisle, you shouldn't spell out complete words in math-environments, as each individual letter will be typeset as a variable. You could put them in \text{Word}.

Code

\documentclass[11pt]{article}
\usepackage{mathtools}
\begin{document}
\vspace*{17.5cm}
\noindent\begin{minipage}{\textwidth}
    \begin{equation}
   \text{Incoming Radiation}, F_\lambda = S_\lambda.\cos \phi
   \label{eq:SolSpecIrrad}
\end{equation}
Where $\phi$ is the solar zenith angle.
\end{minipage}
\end{document}
1
  • 1
    a single \text{...} would be better: \text{Incoming Radiation, }. Jun 21, 2016 at 14:39
2

Set \postdisplaypenalty to 10000 for the special case:

\documentclass[11pt]{article}
\usepackage{amsmath}

\usepackage{lipsum} % just for the example

\newcommand{\commentedequationtext}{} % initialize
\newenvironment{commentedequation}[1]
 {\renewcommand\commentedequationtext{#1}%
  \postdisplaypenalty=10000
  \equation}
 {\endequation\commentedequationtext}

\begin{document}

\vspace*{6\baselineskip}
\lipsum[1-3]

\begin{commentedequation}{where $\phi$ is the solar zenith angle.}
   \label{eq:SolSpecIrrad}
   \text{Incoming Radiation:}\quad F_\lambda = S_\lambda\cdot\cos \phi
\end{commentedequation}

\end{document}

You'll see that if 5\baselineskip is used, the equation will be on page 1.

0

I've manage to do what you need with nested tcolorbox. I've painted in red just to demonstrate a very long equation, the white background area inside is the description box.

enter image description here

\documentclass{article}    
\usepackage{tcolorbox}
\tcbuselibrary{breakable}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{lipsum}   
\begin{document}
\begin{tcolorbox}[colframe=red,colback=red!10,breakable,
]
\begin{equation}
   Incoming\ Radiation, F_\lambda = S_\lambda.\cos \phi
   \label{eq:SolSpecIrrad}
\end{equation}
\lipsum[1]

\lipsum[2-4]

Equation stuff, equation stuff,  equation stuff, equation stuff, equation stuff, equation stuff, equation stuff,  

\begin{tcolorbox}[boxsep=0mm,left=0mm,width=\linewidth,boxrule=0pt,arc=0pt]

Where $\phi$ is the solar zenith angle. % This line is getting pushed 
% to the next page, as the equation is the last 
% thing on the previous page. 

Description, description, description, description, %description, description, description
\end{tcolorbox}
\end{tcolorbox}    
\lipsum[7]
\end{document}

You must log in to answer this question.

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