1

The following question is based on this.

I am sure this is a pretty basic question but I am still at a beginners level.

I have put the following in a new environment in order to increase readability and for ease of use

 \newenvironment{flowtable}[2]
{
\renewcommand\arraystretch{1.4}\arrayrulecolor{LightSteelBlue3}
    \captionsetup{font=blue, labelfont=sc, labelsep=quad,
        skip=0.5\baselineskip}
    % header and footer information
    \topcaption{#1} \label{tab:timeline}
    \tablefirsthead{\toprule}
    \tablehead{\multicolumn{2}{c}{\color{LightSteelBlue3}\textsc{Table \ref{tab:timeline}}, cont'd}\\[0.6ex]
        \toprule}
    \tablelasttail{\bottomrule}
    \xentrystretch{#2} %table length, negative number means longer table, given in fraction, 0.15 means 15%
\begin{xtabular}{@{\,}r <{\hskip 2pt} !{\foo} >{\RaggedRight\arraybackslash}p{5cm}}
}
{
\end{xtabular}
}

Now I can use it as

\begin{flowtable}{My List}{-0.15}
            1947 & AT\&T Bell Labs develop the idea of cellular phones\\
            1968 & Xerox Palo Alto Research Centre envisage the `Dynabook'\\
            1971 & Busicom `Handy-LE' Calculator\\
            1973 & First mobile handset invented by Martin Cooper\\
            1978 & Parker Bros.\ Merlin Computer Toy\\
    \end{flowtable}

This is working. Is there a better way of doing this? How to put some default values for options and suggestion to user indicative of the purpose of the inputs?

cosmicraga
  • 2,630

1 Answers1

1

In the following MWE I correct the missing % in the definition of the environment and added the label as variable.

The definition of the environment now is

%\begin{flowtable}{caption}{length}{label}

with caption as the text for the printed caption, length the length for command \xentrystretch{#2} and new label for the variable label to be used in command \ref.

Please see the following complete WE

\documentclass[a4paper,twoside,twocolumn,11pt]{book}
\usepackage[utf8]{inputenc}
\usepackage{xtab}
\usepackage[TS1,T1]{fontenc}
\usepackage{fourier, heuristica}
\usepackage{array, booktabs, caption, ragged2e}
\usepackage[x11names,table]{xcolor}
\DeclareCaptionFont{blue}{\color{LightSteelBlue3}}

\newcommand{\foo}{\color{LightSteelBlue3}\makebox[0pt]{\textbullet}\hskip-0.5pt\vrule width 1pt\hspace{\labelsep}}


%\begin{flowtable}{caption}{length}{label}
\newenvironment{flowtable}[3]
{
\renewcommand\arraystretch{1.4}\arrayrulecolor{LightSteelBlue3}%
    \captionsetup{font=blue, labelfont=sc, labelsep=quad,
        skip=0.5\baselineskip}%
    % header and footer information
    \topcaption{#1} \label{#3}%
    \tablefirsthead{\toprule}%
    \tablehead{\multicolumn{2}{c}{\color{LightSteelBlue3}\textsc{Table \ref{#3}}, cont'd}\\[0.6ex]
        \toprule}%
    \tablelasttail{\bottomrule}%
    \xentrystretch{#2} %table length, negative number means longer table, given in fraction, 0.15 means 15%
\begin{xtabular}{@{\,}r <{\hskip 2pt} !{\foo} >{\RaggedRight\arraybackslash}p{5cm}}%
}%
{%
\end{xtabular}%
}


\begin{document}

\begin{flowtable}{My List}{-0.15}{tab:test}
  1947 & AT\&T Bell Labs develop the idea of cellular phones\\
  1968 & Xerox Palo Alto Research Centre envisage the `Dynabook'\\
  1971 & Busicom `Handy-LE' Calculator\\
  1973 & First mobile handset invented by Martin Cooper\\
  1978 & Parker Bros.\ Merlin Computer Toy\\
\end{flowtable}

In table~\ref{tab:test} we can see ...
\end{document} 

and its result:

resulting pdf

Mensch
  • 65,388