2

I have a long table with an extra wide column on the right. I want to have this type of output, example

The code I've got doesn't work perfectly.

\begin{longtable}{rl}
\midrule
\midrule
\endhead
\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.

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

4 Answers 4

1

Like this?

\documentclass{article}

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

\begin{document}
\begin{longtable}{rp{3in}}
\midrule
\midrule
\endhead
\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}
1
  • 1
    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.
    – Karen
    Jun 20, 2017 at 15:56
1

I am not sure what is your problem... But may be my answer will help you.

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
\endhead
\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:

enter image description here

Edit:

If you prefer it can be changed like:

\begin{longtable}{rccL}
\midrule
\midrule
\endhead
\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:

enter image description here

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

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
\endhead
\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}

enter image description here

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
\endhead
\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}

enter image description here

1
  • Thank you egreg, this code is easier to type. Really helpful when dealing with a very long table. Many thanks.
    – Karen
    Jun 20, 2017 at 16:59
0

You may also consider avoid any tabular-like environment for this type of output, with a cleared source code:

mwe

\documentclass[a4paper,10pt]{article}
\usepackage{desclist}
\usepackage{amsmath}

\begin{document}
\begin{desclist}{\hfill\large}{\quad=\quad}[xxx] % xxx = longest label 

\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}
1
  • Thank you very much. This is much simpler and easier for typing. Many thanks for this.
    – Karen
    Jun 20, 2017 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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