TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I often find myself writing explanations to passages in (in)equality chains directly under the (in)equality signs, by putting an underset which puts a vertical line starting from the sign and going down (or up) to an explanation. As of now, I have to break the lines manually, which is very annoying. I was wondering if there is any way to have TeX break the lines by itself. For example:

\documentclass[a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,amsfonts,mathtools,newtxtext,newtxmath}

\begin{document}
\[\left\|\int\limits_0^Re^{-\lambda t}S(t)\left(\frac{S(h)u-u}{h}-Au\right)\mathrm{d}t\right\|\underset{\mathclap{\substack{\Big| \\ \text{Proprietà dell'integrale di Bochner,} \\ \text{la norma dell'integrale} \\ \text{è minore o uguale} \\ \text{dell'integrale della norma,} \\ \text{$e^{-\lambda t}$ è uno scalare, non solo} \\ \text{ma è positivo e minore o uguale} \\ \text{di 1, perché $\lambda>0,t>0$, la proprietà} \\ \text{del semigruppo, sto supponendo} \\ \text{che sia contrattivo, $\|S(t)\|\leq1$, quindi} \\ \text{maggioro con:}}}}{\leq}\int\limits_0^R\left\|\frac{S(h)u-u}{h}-Au\right\|\mathrm{d}t.\]
\end{document}

enter image description here

The explanation goes:

Property of the Bochner integral,
the norm of the integral
is less than or equal to
the integral of the norm,
$e^{-\lambda t}$ is a scalar, not only
but it's positive and less than or equal
to 1, because $\lambda>0,t>0$, the property
of the semigroup, I am supposing
it is contractive, $\|S(t)\|\leq1$, so
I major with:

Any way to avoid having to break the lines that way?

PS As an aside, as I inserted the example I remembered that I do the following usually:

\let\oldlg\lg
\renewcommand{\lg}{\lambda}

or something of the likes. Is there any reason not to do this? A macro somewhere using \lg, for example?

Edit

Sorry. After Alenanno's answer, I realized a better example of my intentions could be this align*:

enter image description here

whose code should be like:

\begin{align*}
\|\rho_n\ast u-u\|_{L^p(\omega)}^p=\int\limits_\omega\left|\rho_n\ast u-u\right|^p\mathrm{d}x\underset{\mathclap{\substack{\Big| \\ \text{Esplicito la convoluzione, magheggio} \\ \text{per scrivere $u(x)$ come integrale}}}}{=}{}&\int\limits_\omega\left|\int\limits_B\rho_n(y)(u(x-y)-u(x))\mathrm{d}y\right|^p\mathrm{d}x\leq{} \\
{}\underset{\mathclap{\substack{\Big| \\ Jensen rispetto alla misura di $\rho_n$}}}}{\leq}{}&\int\limits_\omega\left(\int\limits_B\rho_n(y)\left|u(x-y)-u(x)\right|^p\mathrm{d}y\right)\mathrm{d}x={} \\
{}\underset{\mathclap{\substack{\Big| \\ \text{Fubini-Tonelli}}}}{=}{}&\int\limits_B\left(\int\limits_\omega\rho_n(y)\left|u(x-y)-u(x)\right|^p\mathrm{d}x\right)\mathrm{d}y={} \\
{}\underset{\mathclap{\substack{\Big| \\ \text{Estraggo $\rho_n$ e faccio l'integrale interno}}}}{=}{}&\int\limits_B\rho_n(y)\|\tau_yu-u\|_{L^p(\omega)}^p\mathrm{d}y\overset{\mathclap{\substack{\text{Estraggo il massimo di quelle norme} \\ \Big|}}}{=}\sup_{|y|<\frac1n}\|\tau_yu-u\|_{L^p(\omega)}^p\int\limits_B\rho_n(y)\mathrm{d}y,
\end{align*}

or maybe this, whose code I am not going to give, which is another align*:

enter image description here

The given examples are all three from the notes of a Uni course I am attending. My notes of that course, I mean. Just for the record :).

Edit 2

For the record, here is the code for the text bits in the last example:

\text{Mm? Dunque, che cos'è?} \\ \text{Questa cosa qui è per definizione} \\ \text{l'integrale, non tanto per definizione} \\ \text{ma per quella proposizione che avevamo} \\ \text{visto, \sqb{parliamo del \kcref{thm:teor:ConvDeriv},}} \\ \text{è la convoluzione della derivata di $\rg_N$} \\ \text{che di fatto entra all'interno} \\ \text{dell'integrale, quindi questo qua} \\ \text{è che cosa?}

\text{'kèi? Fatemi usare questa notazione} \\ \text{un pochino, anche qui, molto} \\ \text{provvisoria, fatemi mettere} \\ \text{la variabile rispetto} \\ \text{a cui derivo qua. Questo è} \\ \text{calcolato in $x-y$, per $f(y)\diff y$,} \\ \text{'kèi? D'accordo. Adesso però} \\ \text{spostiamo questa derivata rispetto} \\ \text{alla variabile $x$ sulla derivata} \\ \text{rispetto alla variabile $y$,} \\ \text{e naturalmente c'è il rischio che,} \\ \text{siccome davanti ad $y$ c'è un segno,} \\ \text{a seconda della disparità,} \\ \text{di fatto, dell'ordine di derivazione, balli,} \\ \text{ci sia un segno che balla, no,} \\ \text{e questo effettivamente uno lo considera} \\ \text{con questo fattore correttivo che è} \\ \text{$-1$ elevato alla lunghezza del multi-indice,} \\ \text{cioè di fatto al numero complessivo di volte} \\ \text{che stiamo, uuuuh, derivando, dell'integrale} \\ \text{della derivata, stavolta nella variabile $y$.}

\text{D'accordo? OK? E questo è, attenzione,} \\ \text{questo è $(-1)^{|\ag|}$, 'kèi, questo pura} \\ \text{e semplice, uuuuh, ricopiatura, e adesso però} \\ \text{qui usiamo il fatto che $f$ possiede una $\pd^\ag$,} \\ \text{quindi questa qui cos'è, questa cosa qui} \\ \text{è, siccome, ovviamente, $\rg_N$ è,} \\ \text{in particolare, una funzione test, possiamo usare,} \\ \text{nella definizione di \dd, $\rg_N$} \\ \text{al posto di $u$, e quindi questo è un altro $(-1)^{|\ag|}$} \\ \text{per l'integrale su $\Wg$ di, $\rg_N$ questa volta} \\ \text{non è più derivato, e la derivata debole} \\ \text{si scarica su $y$, su $f$, scusate, non su $y$. Giusto?}
share|improve this question
    
if you're really hoping that you can get the text broken automatically for the two paragraphs applied to the first line of your last example, i think you're out of luck. the shapes of those paragraphs is something that is not recorded automatically, hence their nesting would not easily happen by itself. as a side comment, the baselines ot the text are very uneven; this could be ameliorated by putting the text into a \parbox or minipage, breaking the lines explicitly, and ending that box with \par or a blank line. – barbara beeton Jan 11 at 15:38
    
@barbara yes, as my answer says, a \parbox should solve everything since it regulates the width of the text. The strange shape is just to avoid superposition, the lines were broken manually, and the uneven line spacing is what TeX automatically puts there. – MickG Jan 11 at 15:41
    
I am sure that if I substitute all the \text{, } \\ \text{ and } with a mere \parbox{15.5em} (or some other parameter) wrapping with \centering in it, I will obtain a similar but much better result. I'm not doing it just 'cause I'm lazy :). – MickG Jan 11 at 15:45
    
as long as you're doing this just for yourself, no problem, but if you're expecting someone else to read it, have pity and make it easier to comprehend. here's a situation where using \\ to break lines in a "centered" \parbox does make sense, and doesn't really take more effort (in fact less) than many lines of \text. – barbara beeton Jan 11 at 15:50
1  
References: 1 and 2. – MickG Jan 11 at 16:22

You can use the adjustwidth environment provided by the changepage package, which works like this:

\begin{adjustwidth}{<left margin>}{<right margin>}    
    <narrow text>
\end{adjustwidth}

As far as the \renewcommand is concerned, that depends. Unless you know what you're doing, I don't think it's advisable to renew commands because you might break some commands you're already using throughout the document. Depending on the command, I suggest creating a new one.

enter image description here

\documentclass[a4paper]{report}
\usepackage{geometry}
\usepackage{changepage}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,amsfonts,mathtools,newtxtext,newtxmath}

\begin{document}
\[\left\|\int\limits_0^Re^{-\lambda t}S(t)\left(\frac{S(h)u-u}{h}-Au\right)\mathrm{d}t\right\|\underset{\mathclap{\substack{\Big|}}}{\leq}\int\limits_0^R\left\|\frac{S(h)u-u}{h}-Au\right\|\mathrm{d}t.\]
\begin{adjustwidth}{5.5cm}{4.5cm}\scriptsize
Property of the Bochner integral, the norm of the integral is less than or equal to the integral of the norm, $e^{-\lambda t}$ is a scalar, not only but it's positive and less than or equal to 1, because $\lambda>0,t>0$, the property of the semigroup, I am supposing it is contractive, $\|S(t)\|\leq1$, so I major with:
\end{adjustwidth}
\end{document}
share|improve this answer
    
Mm, but if I have more than an explanation on a line and multiple lines of explanation I would have to use a multi-column \intertext and work out all the parameters… can adjustwidth be opened inside the \underset? – MickG Jan 11 at 11:59
1  
@MickG Your question was about a single explanation. If you have more explanations in a single equation, you could have specified that. But you could show an example now? – Alenanno Jan 11 at 12:01
    
See the edit. Maybe I didn't choose the most complex example but just the one I was working on at that time. But I did say "chains" :). – MickG Jan 11 at 12:22
    
And I must say that typing that new example code took me like three times as long as it did with my shortcut commands in my notes :). Where \underset{\mathclap{\substack{\Big| \\ …}}} becomes \ux[\Big]{…} :). – MickG Jan 11 at 12:23
    
About the renews, the reason I do that is that I abbreviate all greek letters with a consistent scheme: alpha maps to \ag, beta to \bg, so I mapped all letters to latin letters, then I add g for Greek to the command. So lambda maps to l, then \lg. For the record. – MickG Jan 11 at 12:24
up vote 3 down vote accepted

Another solution is to use \parbox, as suggested here. Code with \parbox, centered as suggested here:

\documentclass[a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,amsfonts,mathtools,newtxtext,newtxmath}

\begin{document}
\[\left\|\int\limits_0^Re^{-\lambda t}S(t)\left(\frac{S(h)u-u}{h}-Au\right)\mathrm{d}t\right\|\underset{\mathclap{\substack{\Big| \\ \parbox{15.5em}{\centering Proprietà dell'integrale di Bochner, la norma dell'integrale è minore o uguale dell'integrale della norma, $e^{-\lambda t}$ è uno scalare, non solo ma è positivo e minore o uguale di 1, perché $\lambda>0,t>0$, la proprietà del semigruppo, sto supponendo che sia contrattivo, $\|S(t)\|\leq1$, quindi maggioro con:}}}}{\leq}\int\limits_0^R\left\|\frac{S(h)u-u}{h}-Au\right\|\mathrm{d}t.\]
\end{document}

Output:

enter image description here

Beware of the font change: the normal font in \underset is small, \parbox (like any box) gets back to normal text size, to have the right subscript size you have to use \scriptsize inside the \parbox.

Update

To fix the line spacing, put \linespread at the start of the \parbox, and remember to make a \selectfont immediately follow it, or the \linespread will have no effect.

Output example of this approach

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.