5

Using MikTex/pdfLatex

Question: How can I improve table?

Consider Column Title: I'd like to remove table numbering? (i.e. remove 'Table 0.1')

Consider Column headings: I'd like to get single line columns to appear on the 2nd line.

Consider Second column: I'd like to get numbers in parenthesis on 2nd line.

Consider Third column: All entries are of the style {XXXXX vs YYYYY} . I'd like to get the YYYY to appear on separate line.

        \documentclass[letterpaper,10pt]{memoir}
        \usepackage{lipsum}
        \usepackage{enumerate}
    \usepackage{outlines}
    \usepackage{booktabs}

    \begin{document}
    \pagenumbering{gobble}

    \begin{quotation}
    Isay yousay igpay atinlay modi tempora incidunt ut labore et dolore magnam aliquam quaerat.\sourceatright{Maximus Minimus }
    \end{quotation}

    \begin{table}[ht]
    \begin{LARGE}
    \caption{\textsc{\Large{
     Consectetu Neque Porros ab ubi Quisu Dolo Ipsum
    }}}
    \centering
    \end{LARGE}

    \begin{tabular}%
    {p{0.50in}p{0.90in}p{1.50in}p{2.75in}}
    \toprule
    \\
    %Column Headings
    \textbf{Amet} &
    \textbf{Sed (quis)} &
    \textbf{Cumque Voluptas} &
    \textbf{Quis autem vel eum iure reprehenderit qui in ea voluptate}
    \\
    \midrule
    %Row Entries
    1 &
    Culparu &
    Facil vs. laborum & 
    Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
    \tabularnewline
    \\
    2 &
    Laboriosame (2-3) &
    Solentia vs. conse qua turti &
    Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? 
    \tabularnewline
    \\
    3 & 
    Eaque provident (4-5) & 
    Solutanobi vs. animi & 
    Doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo
    \tabularnewline
    \\
    \end{tabular}
    \end{table}
    \end{document}
  • regarding the third column, if all entries contain "vs.", i'd be tempted to create a macro for just that, with a built-in line break. mico has provided reasonable answers for 'most everything else. – barbara beeton Sep 6 '14 at 20:22
  • Voting to close: Please only ask one question per question. – doncherry Sep 6 '14 at 20:34
  • 2
    @doncherry seems a bit harsh:-) There are lots of "this table is too wide" questions that have not been closed. The OP was kind enough to pint out some particular issues that make it too wide but they aren't really separate questions. – David Carlisle Sep 6 '14 at 20:44
10

You'd a lot of blank lines which I removed (\\ and \tabularnewline are the same thing) also don't put font formatting in a caption it's bad style (and messes up the list of tables. To avoid a number I used \caption* from the caption package although memoir may have its own way of doing that (memoir warns about caption package usage.)

I used tabularx to calculate the column width so the table fits on the page

 \documentclass[letterpaper,10pt]{memoir}
    \usepackage{lipsum,caption}
    \usepackage{enumerate}
\usepackage{outlines}
\usepackage{booktabs,tabularx}

\begin{document}
\pagenumbering{gobble}

\begin{quotation}
Isay yousay igpay atinlay modi tempora incidunt ut labore et dolore magnam aliquam quaerat.\sourceatright{Maximus Minimus }
\end{quotation}


\begin{table}[ht]
\centering
\noindent X\dotfill X


\caption*{Consectetu Neque Porros ab ubi Quisu Dolo Ipsum}

\begin{tabularx}{\textwidth}
{@{}l>{\raggedright}p{0.60in}>{\raggedright}p{1in}X@{}}
\toprule
%Column Headings
\textbf{Amet} &
\textbf{Sed (quis)} &
\textbf{Cumque Voluptas} &
\textbf{Quis autem vel eum iure reprehenderit qui in ea voluptate}
\\
\midrule
%Row Entries
1 &
Culparu &
Facil\\ vs.\\ laborum & 
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
\\[5pt]
2 &
Labor\-iosame (2-3) &
Solentia\\ vs.\\ conse qua turti &
Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? 
\\[5pt]
3 & 
Eaque provident (4-5) & 
Solutanobi\\ vs.\\ animi & 
Doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo
\end{tabularx}
\end{table}
\end{document}
| improve this answer | |
  • Is it worrisome or good that the main suggestions of our answers are so similar? :-) – Mico Sep 6 '14 at 20:38
  • @Mico yes I nearly didn't post mine as you'd beaten me to it, but as I'd done the work so I thought why not? (and if I don''t pass 200K this weekend egreg may die laughing:-) – David Carlisle Sep 6 '14 at 20:40
  • I do not want egreg to die so i happily will help you get there... but apparently you already passed. Congratulations are in order then? :) Congrats! – henry Sep 6 '14 at 20:46
  • It'll be a great weekend, then, for TeX.SE: You're about to pass 200K and Harish about to pass 100K! – Mico Sep 6 '14 at 20:47
  • @Mico actually I probably wouldn't have posted this if I'd noticed you'd used TX as well, I didn't read to the end of yours as I was posting mine:-) – David Carlisle Sep 6 '14 at 20:52
7

You asked:

Column Title: I'd like to remove table numbering? (i.e. remove 'Table 0.1')

By loading the caption package and writing \caption*{...} instead of \caption{...}.

Column headings: How can I get single line columns to appear on the 2nd line?

Not sure I understood this question.

Second column: How can I get numbers in parenthesis on 2nd line?

Third column: All entries are of the style {XXXXX vs YYYYY} . How do i get the YYYY to appear on separate line?

You could set up a custom tabular environment. In the answer below, I set up an environment called mysplit for just this job.

Separately, I would like to suggest that you use a tabularx environment instead of the basic tabular environment and use a (custom version of) the X column type for the final column of the table.

enter image description here

\documentclass[letterpaper,10pt]{memoir}
%%%\usepackage{lipsum}   %%% I've commented out the unneeded packages and macros
%%%\usepackage{enumerate}
%%%\usepackage{outlines}
\usepackage{booktabs}
\usepackage[margin=1in]{geometry}
\usepackage{caption}  % for '\caption*' macro
\usepackage{tabularx} % for 'tabularx' environment
\usepackage{ragged2e} % for '\RaggedRight' macro
\newcolumntype{Y}{>{\RaggedRight\arraybackslash}X} % customized form of 'X' column type
\newenvironment{mysplit}%
  {\begin{tabular}[t]{@{}l@{}}}{\end{tabular}}
\begin{document}
\pagenumbering{gobble}

%\begin{quotation}  % have commented out the quotation as well
%Isay yousay igpay atinlay modi tempora incidunt ut labore et dolore magnam aliquam quaerat.\sourceatright{Maximus Minimus }
%\end{quotation}

\begin{table}[ht]
%%%\begin{LARGE}
\captionsetup{font={sc,Large}}  %% separate declaration of caption style
\caption*{Consectetu Neque Porros ab ubi Quisu Dolo Ipsum}
%%%\end{LARGE}

\begin{tabularx}{\textwidth}{@{} p{0.5in} p{1.0in} p{1.50in} Y @{}}
\toprule
%Column Headings
\textbf{Amet} &
\textbf{Sed (quis)} &
\textbf{Cumque Voluptas} &
\textbf{Quis autem vel eum iure reprehenderit qui in ea voluptate}
\\
\midrule
%Row Entries
1 &
Culparu &
\begin{mysplit}Facil vs. \\ laborum \end{mysplit} & 
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
\\[1\baselineskip]
2 &
\begin{mysplit}Laboriosame\\(2--3)\end{mysplit} &
\begin{mysplit}Solentia vs.\\conse qua turti \end{mysplit}&
Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? 
\\[1\baselineskip]
3 & 
\begin{mysplit}Eaque provident\\ (4--5) \end{mysplit} & 
\begin{mysplit}Solutanobi vs.\\ animi \end{mysplit}& 
Doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo
\\
\end{tabularx}
\end{table}
\end{document}
| improve this answer | |

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.