6

The text is too long and would like to split it in two: Any help please!

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{flalign*}
\textit{K}^{k,r}_{j}&   : \text{The transportation and handling \\ of item $k$, type $r$ machines in period $j$}& 
\end{flalign*}

\end{document}
4
  • Welcome to TeX.SX! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it).
    – egreg
    Aug 18, 2014 at 20:23
  • Using a \parbox should work. Aug 18, 2014 at 20:28
  • Peter am new to latex, could you please revise it for me? Thanks
    – user28251
    Aug 18, 2014 at 20:29
  • It would help if we have a complete example of what you have in mind: as is, your text has nothing to do with an align environment. Is it the description/ explanation of some mathematical notation?
    – Bernard
    Aug 18, 2014 at 21:01

2 Answers 2

6

The simplest way to cope with this is with a tabular:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\[
\begin{tabular}{l@{}l}
$K^{k,r}_{j}$ : \mbox{} & The transportation and handling of \\
                        & item $k$, type $r$ machines in period $j$
\end{tabular}
\]

\end{document}

enter image description here

Note that \textit{K} is not needed: a “K” in math mode is italic by default.

0
6

As Peter Grill mentioned in a comment, a \parbox ("paragraph-containing box") provides a fine solution method. The \parbox macro takes three arguments: the first, which is optional (and hence gets placed in square brackets), specifies the alignment: t, m (default), and b; the second specifies the width, and the third the actual text that needs to be typeset.

In the example below, I've chosen 3.5" as the width of the parbox; obviously, you're free to choose a different width. (For a way to make LaTeX compute the maximum available width and make it available to the parbox, see the posting Compute remaining horizontal space in align environment. (Thanks to Peter Grill for suggesting this possibility.)

The \raggedright instruction in the MWE -- suggested by @daleif -- at the start of the second required argument instructs LaTeX to typeset the text in raggedright mode rather than fully-justified mode; this is useful for avoiding potential extreme stretching of the text. The horizontal line above the equation is there just to illustrate the width of the text block.

enter image description here

\documentclass[fleqn]{article}
\usepackage{amsmath}
\begin{document}
\hrule % just to illustrate width of the text block
\begin{equation*}
K^{k,r}_{j} :\ 
\parbox[t]{3.75in}{\raggedright The transportation and handling of item~$k$, 
   type~$r$ machines in period~$j$}
\end{equation*}
\end{document}

Addendum: An essentially equivalent result can be achieved by typesetting the material in a two-column array environment, with the second column being of type p -- essentially a "parbox". Here's just the equation part of the required code (the preamble is the same as above):

\begin{equation*}
\begin{array}{@{} l p{3.75in} @{}}  % choose width of `p` column to suit your needs
K^{k,r}_{j} : &
\raggedright The transportation and handling of item~$k$, type~$r$ machines in period~$j$\\
\end{array}
\end{equation*}
5
  • I would recommend adding a \raggedright to the \parbox or one can easily end up with excessive stretch.
    – daleif
    Aug 18, 2014 at 21:16
  • @daleif - Good idea! I'll add the instruction to the MWE.
    – Mico
    Aug 18, 2014 at 21:21
  • @Mico: You could also incorporate the code from Compute remaining horizontal space in align environment so that you don't have to guess at the width. Aug 18, 2014 at 21:35
  • @PeterGrill - thanks for this suggestion; I'll mention it in a comment. For the equation at hand, it may be preferable to choose a fixed width based on the most desirable look of the material in the parbox.
    – Mico
    Aug 18, 2014 at 21:39
  • @PeterGrill math that wide seldom look attractive
    – daleif
    Aug 18, 2014 at 22:11

You must log in to answer this question.

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