# How to deal with this longtable

I have a long table with an extra wide column on the right. I want to have this type of output, The code I've got doesn't work perfectly.

\begin{longtable}{rl}
\midrule
\midrule
\multicolumn{2}{r}{to be continued \dots} \\
\endfoot
\bottomrule
\endlastfoot
$\tau_2$                      &=$\quad \inf\{t-\tau_1 \mid t>\tau_1, X_t \geq 0, X_{\tau_1}<0 \}$ \ \text{--} \ \text{time elasped after $\tau$ (or $\tau_1$) when $X_t$ goes back above zero} \\
$g_t^X$                 \quad &= $\quad \sup\{ s \leq t \mid \text{sign}(X_s) \neq \text{sign}(X_t) \}$ \ \text{--} \ \text{last crossing time of 0 before time $t$} \\
$d_t^X$                 \quad &= $\quad \inf\{ s \geq t \mid \text{sign}(X_s) \neq \text{sign}(X_t) \}$ \ \text{--} \ \text{first crossing time of 0 before time $t$} \\
\end{longtable}


How can I get an output like in the picture? Any help would be the most grateful.

• Next time, please provide a complete minimum working example.
– JPi
Jun 20, 2017 at 14:56
• Yeah, I should have specified the environment for math code. And thank you for your help. Jun 20, 2017 at 15:58

Like this?

\documentclass{article}

\usepackage{booktabs}
\usepackage{longtable}
\usepackage{amsmath}

\begin{document}
\begin{longtable}{rp{3in}}
\midrule
\midrule
\multicolumn{2}{r}{to be continued \dots} \\
\endfoot
\bottomrule
\endlastfoot
$\tau_2$   \quad                   =& $\inf\{t-\tau_1 \mid t>\tau_1, X_t \geq 0, X_{\tau_1}<0 \}$ -- time elasped after $\tau$ (or $\tau_1$) when $X_t$ goes back above zero \\
$g_t^X$                 \quad =& $\sup\{ s \leq t \mid \text{sign}(X_s) \neq \text{sign}(X_t) \}$ -- last crossing time of 0 before time $t$ \\
$d_t^X$                 \quad =&$\inf\{ s \geq t \mid \text{sign}(X_s) \neq \text{sign}(X_t) \}$ -- first crossing time of 0 before time $t$ \\
\end{longtable}
\end{document}

• Thank you very much for this. Just run the code, and it gives pretty good output which looks more closed to the picture. Many thanks. Jun 20, 2017 at 15:56

Here is the code:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{longtable}
\usepackage{array}
\usepackage{booktabs}
\usepackage{amsmath}
%opening
\title{}
\author{}

\begin{document}

\maketitle

\newcolumntype{L}{>{\small\raggedright\arraybackslash}p{0.7\textwidth}}

\begin{longtable}{rcL}
\midrule
\midrule
\multicolumn{3}{r}{to be continued \dots} \\
\endfoot
\bottomrule
\endlastfoot
$\tau_2$     &                 &=$\quad \inf\{t-\tau_1 \mid t>\tau_1, X_t \geq 0, X_{\tau_1}<0 \}$ \ \text{--} \ \text{time elasped after $\tau$ (or $\tau_1$) when $X_t$ goes back above zero} \\
\\
$g_t^X$      &            &= $\quad \sup\{ s \leq t \mid \text{sign}(X_s) \neq \text{sign}(X_t) \}$ \ \text{--} \ \text{last crossing time of 0 before time $t$} \\
\\
$d_t^X$      &            &= $\quad \inf\{ s \geq t \mid \text{sign}(X_s) \neq \text{sign}(X_t) \}$ \ \text{--} \ \text{first crossing time of 0 before time $t$} \\
\end{longtable}

\end{document}


And here is the result: Edit:

If you prefer it can be changed like:

\begin{longtable}{rccL}
\midrule
\midrule
\multicolumn{4}{r}{to be continued \dots} \\
\endfoot
\bottomrule
\endlastfoot
$\tau_2$     &                 &= &$\inf\{t-\tau_1 \mid t>\tau_1, X_t \geq 0, X_{\tau_1}<0 \}$  \text{--}  time elasped after $\tau$ (or $\tau_1$) when $X_t$ goes back above zero \\
\\
$g_t^X$      &            &=  &$\sup\{ s \leq t \mid \text{sign}(X_s) \neq \text{sign}(X_t) \}$  \text{--}  last crossing time of 0 before time $t$ \\
\\
$d_t^X$      &            &= &$\inf\{ s \geq t \mid \text{sign}(X_s) \neq \text{sign}(X_t) \}$  \text{--}  first crossing time of 0 before time $t$ \\
\end{longtable}


For the next result: • @koleyar Thank you very much. It works well. Problem solved. Jun 20, 2017 at 15:29
• Karen ... You are welcom... If you want check @JPi's answer too and accept the one you prefer Jun 20, 2017 at 15:40

I don't think you want those wide spaces around the equals signs. Anyway, they can be easily customized, see later.

\documentclass{article}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage{array,booktabs}

\DeclareMathOperator{\sign}{sign}

\begin{document}

\begin{longtable}{@{}>{$}r<{{}$}@{}p{.8\textwidth}@{}}
\toprule
\multicolumn{2}{r}{to be continued} \\
\endfoot
\bottomrule
\endlastfoot
\tau_2 = & $\inf\{t-\tau_1 \mid t>\tau_1, X_t \geq 0, X_{\tau_1}<0 \}$
-- time elapsed after $\tau$ (or $\tau_1$) when $X_t$ goes back above zero \\
g_t^X  = & $\sup\{ s \leq t \mid \sign(X_s) \neq \sign(X_t) \}$
-- last crossing time of 0 before time $t$ \\
d_t^X  = & $\inf\{ s \geq t \mid \sign(X_s) \neq \sign(X_t) \}$
-- first crossing time of 0 before time $t$ \\
\end{longtable}

\end{document} With wider spaces:

\documentclass{article}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage{array,booktabs}

\DeclareMathOperator{\sign}{sign}

\begin{document}

\begin{longtable}{@{}>{$\thickmuskip=24mu\relax}r<{{}$}@{}p{.8\textwidth}@{}}
\toprule
\multicolumn{2}{r}{to be continued} \\
\endfoot
\bottomrule
\endlastfoot
\tau_2 = & $\inf\{t-\tau_1 \mid t>\tau_1, X_t \geq 0, X_{\tau_1}<0 \}$
-- time elapsed after $\tau$ (or $\tau_1$) when $X_t$ goes back above zero \\
g_t^X  = & $\sup\{ s \leq t \mid \sign(X_s) \neq \sign(X_t) \}$
-- last crossing time of 0 before time $t$ \\
d_t^X  = & $\inf\{ s \geq t \mid \sign(X_s) \neq \sign(X_t) \}$
-- first crossing time of 0 before time $t$ \\
\end{longtable}

\end{document} • Thank you egreg, this code is easier to type. Really helpful when dealing with a very long table. Many thanks. Jun 20, 2017 at 16:59

You may also consider avoid any tabular-like environment for this type of output, with a cleared source code: \documentclass[a4paper,10pt]{article}
\usepackage{desclist}
\usepackage{amsmath}

\begin{document}

\item
[$\tau_2$]
$\inf\{t-\tau_1 \mid t>\tau_1, X_t \geq 0, X_{\tau_1}<0 \}$  --
time elasped after $\tau$ (or $\tau_1$) when $X_t$ goes back above zero.

\item
[$g_t^X$]
$\sup\{ s \leq t \mid \text{sign}(X_s) \neq \text{sign}(X_t) \}$ --
last crossing time of 0 before time~$t$.

\item
[$d_t^X$]
$\inf\{ s \geq t \mid \text{sign}(X_s) \neq \text{sign}(X_t)\}$ --
first crossing time of 0 before time~$t$.

\end{desclist}
\end{document}

• Thank you very much. This is much simpler and easier for typing. Many thanks for this. Jun 20, 2017 at 23:41