1

In the code below, how do I add a vertical line to separate the second column from everything to the right of it? Also, the content of the table is too wide horizontally. I can see though that if columns 4 and up were aligned better, the content would perfectly fit the page. What would be the best way to do it? Thanks much in advance.

enter image description here

\documentclass[11pt]{article}

\usepackage{rotating}

\usepackage[
    lmargin=1.0in,
    rmargin=1.0in,
    tmargin=2.0cm,
    bmargin=2.0cm
]{geometry}



\usepackage{tabularx, booktabs}
\newcolumntype{Y}{>{\centering\arraybackslash}X}

\usepackage{multirow}


\begin{document}

\renewcommand{\arraystretch}{1.1}
\begin{sidewaystable}
    \centering
    \caption{bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.}
 %   \scalebox{0.95}{
    \begin{tabularx}{\textheight}{@{}l@{\quad}lc*{11}{Y}@{}}
    \toprule
      & & &\multicolumn{11}{c}{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}\\[1mm]
      & & $a$ &$1\times10^2$ & $2\times10^2$ & $3\times10^2$ & $4\times10^2$ & $5\times10^2$ & $6\times10^2$ & $7\times10^2$ & $8\times10^2$ & $9\times10^2$
        & $1\times10^3$ & $1\times10^4$\\
    %\midrule
    \cmidrule[0.6pt]{4-14}
        \parbox[t]{3mm}{\multirow{22}{*}{\rotatebox[origin=c]{90}{cccccccccccccccccccccccccccccc}}}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$  & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cmidrule{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$  & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cmidrule{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$  & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cmidrule{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$  & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cmidrule{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$  & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cmidrule{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$  & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cmidrule{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$  & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cmidrule{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$  & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cmidrule{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$  & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cmidrule{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$  & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \bottomrule
    \end{tabularx}
  %  } % endof \scalebox
\end{sidewaystable}


\end{document}
  • You can sort of get the vertical line by changing your c*{11} into a c|c*{10}. But there is some residual vertical gap I don't understand. – Steven B. Segletes Aug 30 '14 at 18:42
  • 3
    Gaps in vertical line is caused by package booktabs. It is not designed for use of vertical lines. – Zarko Aug 30 '14 at 18:57
2

Here is a solution without booktabs, replaced with makecell, that has commands for defining variable width horizontal rules. I also use the cellspace package, that defines minimal vertical spacing between the top of a cell and the bottom of the above cell, and similarly a minimal spacing between the bottom of a cell and the top of the below cell. The width of the table is OK if we use footnotesize and reducetabcolsep` to 3pt.

I also loaded the caption package to have a correct vertical spacing between the caption and the top of the table (it swaps the values of \abovecaptionskip and \belowcaptionskip) and I simplified a little the code:

\documentclass[11pt]{article}

\usepackage{rotating}
\usepackage[hmargin=1.0in, vmargin=2.0cm, showframe, nomarginpar]{geometry}

\usepackage{tabularx, booktabs, caption}
\newcolumntype{Y}{>{\centering\arraybackslash}X}

\usepackage{multirow}

\usepackage{hhline, makecell}
\newcommand\thickhline{\Xhline{1.2pt}}
\newcommand\thickcline[1]{\Xcline{#1}{1.2pt}}
\newcommand\medhline{\Xhline{0.6pt}}
\newcommand\medcline[1]{\Xcline{#1}{0.6pt}}
\usepackage{cellspace}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}

\begin{document}

\renewcommand{\arraystretch}{1.1}
\begin{sidewaystable}
    \centering\footnotesize\renewcommand\tabcolsep{3pt}
    \caption{bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.}
    \begin{tabularx}{\textheight}{@{}l@{\quad}lc!{\vrule width 1.2pt}*{9}{Y}Scc@{}}
\thickcline{2-14}
      & & &\multicolumn{11}{c}{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}\\[0.5ex]
      & & $a$ &$1\times10^2$ & $2\times10^2$ & $3\times10^2$ & $4\times10^2$ & $5\times10^2$ & $6\times10^2$ & $7\times10^2$ & $8\times10^2$ & $9\times10^2$
        & $1\times10^3$ & $1\times10^4$\\[0.5ex]
  \medcline{4-14}
        \multirow{25}{*}{\rotatebox[origin=c]{90}{cccccccccccccccccccccccccccccc\enspace}}
 &\multirow{2}{*}{0.0}
 &\multirow{2}{*}{0.000000}
  & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
  \cline{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cline{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cline{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cline{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cline{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cline{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cline{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cline{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \cline{2-14}
            &\multirow{2}{*}{0.0}
            &\multirow{2}{*}{0.000000}
            & $00.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $000.00$ & $0,000.00$\\
            & &
            & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(000.000)$ & $(0,000.000)$ & $(00,000.000)$\\
    \thickcline{2-14}
    \end{tabularx}
\end{sidewaystable}

\end{document} 

enter image description here

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.