Math & ScienceInline math spanning out of text margin

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
sandsoftime
Posts: 8
Joined: Mon Sep 21, 2009 9:04 pm

Inline math spanning out of text margin

Post by sandsoftime »

Hi
I am having trouble with latex putting an inline math formula so that part of it falls outside the text margin. How do I force it to be put on the next line instead?

SandsofTime

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: Inline math spanning out of text margin

Post by josephwright »

Post an example of what you are doing.
Joseph Wright
sandsoftime
Posts: 8
Joined: Mon Sep 21, 2009 9:04 pm

Inline math spanning out of text margin

Post by sandsoftime »

Code: Select all

..... and the reconstructed image denoted by $\left\langle R^{q}\left(x,z,\overrightarrow{\tau},\overrightarrow{\theta},\overrightarrow{\mathbf{r}}\right)\right\rangle $ . The objects can be tracked ....
Its a fairly short expression. If I add some extra text before in the paragraph it doesn't go beyond the margins anymore and instead falls onto the next line. I could probably change some wording of the text so that the math expression doesn't happen to lie at the end of a line, but it's only a stopgap measure. I don't understand why latex would simply not shift it to the next line by itself.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Inline math spanning out of text margin

Post by localghost »

When asked for an example, always post a complete sample document that is compilable as is. This is also called a minimal working example (MWE). I have no problem with the following sample code.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
%\usepackage[includeheadfoot,margin=2cm]{geometry}
\usepackage{amsmath}
\usepackage{blindtext}
\usepackage{lmodern}

\begin{document}
  \ldots and the reconstructed image denoted by $\bigl\langle R^{q}\bigl(x,z,\overrightarrow{\tau},\overrightarrow{\theta},\overrightarrow{\mathbf{r}}\bigr)\bigr\rangle $ . The objects can be tracked \ldots \blindtext
\end{document}
You can additionally try the microtype package to improve the typesetting quality.


Best regards
Thorsten
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Inline math spanning out of text margin

Post by phi »

sandsoftime wrote:I don't understand why latex would simply not shift it to the next line by itself.
TeX must fulfill certain constrains specified by parameters in its paragraph breaking algorithm. These constrains are supposed to prevent "ugly" line breaks. Although they can be weakened, I suggest to avoid that and to use a displayed equation in your case. This also solves the problem that the formula is to high to fit in one line:

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
%\usepackage[includeheadfoot,margin=2cm]{geometry}
\usepackage{amsmath}
\usepackage{blindtext}
\usepackage{lmodern}

\begin{document}

\blindtext \ldots and the reconstructed image denoted by
%
\begin{equation*}
  \left< R^{q} \left( x, z, \vec{\tau}, \vec{\theta}, \vec{\mathbf{r}} \right) \right>.
\end{equation*}
%
The objects can be tracked \ldots \blindtext

\end{document}
Post Reply