2

I know there are a few posts with similar titles. But my case is different. When I use \documentclass{article}, my table fits properly on the page. But when I use my university's document class \documentclass{ucr}, my table becomes stretched and goes beyond the page width.

The code that works:

\documentclass[12pt]{article}
%\usepackage[top=1in, left=1in, right=1in, bottom=1in]{geometry}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{array}
\usepackage{booktabs}

\begin{document}
\begin{table}[!h]
\centering{}%
\begin{tabular}{>{\centering}p{2cm}>{\centering}p{2cm}>{\centering}p{2cm}}
\toprule 
\centering{}Parameters & \centering{}GARCH-N & \centering{}GARCH-t\tabularnewline
\midrule
\midrule 
$\delta$ & \centering{}0.1106{*} (6.50)  & \centering{}.1084{*} (6.1425) \tabularnewline
$\beta_{1}$ & \centering{}0.630{*} (9.64)  & \centering{}0.629{*} (9.031) \tabularnewline
$\alpha_{0}$ & \centering{}0.008{*} (2.86)  & \centering{}0.008{*} (2.855) \tabularnewline
$\alpha_{1}$ & \centering{}0.203{*} (4.15)  & \centering{}0.232{*} (4.412) \tabularnewline
$\alpha_{2}$ & \centering{}0.663{*} (10.34)  & \centering{}0.639{*} (9.261) \tabularnewline
$\text{\ensuremath{\nu}}$ &  & \centering{}5.51{*} (63.53) \tabularnewline
Log- Likelihood & 14.603 & 26.318\tabularnewline
\bottomrule
\end{tabular}
%\begin{doublespace}
\caption{Blah blah}
%\end{doublespace}
\end{table}
\end{document} 

The code that does not work is the same as the above except the first line:

\documentclass[12pt]{ucr}

You can download the ucr class file called LaTex Template (Chairperson)* from http://graduate.ucr.edu/filingresources.html

I will be grateful if you could provide some suggestions here.

5
  • 1
    you are using \begin{tabular}{>{\centering}p{2cm}>{\centering}p{2cm}>{\centering}p{2cm}} so assuming you have 6cm (+36pt cell padding) available. If a different class has a narrower text width than that then the table will not fit. You do not need p columns here anyway why not simply use c columns and let the table be its natural width Jul 8, 2018 at 10:06
  • @DavidCarlisle If I use c columns then the standard errors (numbers inside the parentheses) do not get placed under the coefficients, rather they are placed on the right side of each coefficient. How can I overcome this?
    – TRa
    Jul 8, 2018 at 10:09
  • 1
    @TRa: You can use simple c type columns and keep the standard errors in the line underneath the coefficient of you insert your data in two rows as follows: $\delta$ & 0.1106 & .1084 \\ & (6.50) & (6.1425) \\
    – leandriis
    Jul 8, 2018 at 10:15
  • @leandriis sure I can do that. I just wanted to avoid doing it since that means retyping all my tables now.
    – TRa
    Jul 8, 2018 at 10:19
  • 1
    @TRa - Employing (abusing!, really) the p column type might appear to be convenient at first, but it precludes you from implementing truly decent typesetting practices such as aligning the numbers on their respective decimal markers.
    – Mico
    Jul 8, 2018 at 10:31

1 Answer 1

3

First off, whatever else you do, delete (or comment out) the penultimate line in ucr.cls, viz., the instruction \dsp. It is simply unconscionable to impose triple-spacing. (That final \dsp directive comes on top of other commands that increase line-spacing as well! Yikes!!)

Second, you're definitely abusing the p column type. (The ucr document class does a separate "job" on the p column type...) It would be much better if you placed the standard errors on separate lines and used a basic c column type for columns 2 and 3. (And, use the l ("left") column type, not c or p, for the first column.) Even better, load the dcolumn package and align the numbers in columns 2 and 3 on their decimal markers; see the following code for an application.

Do get rid of all \centering{} directives, and please replace $\text{\ensuremath{\nu}}$ with $\nu$. The less code clutter, the better.

enter image description here

\documentclass[12pt]{ucr-mod}   % modified by commenting out the final `\dsp` directive
\usepackage{amsmath,graphicx,array,booktabs}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro

\begin{document}
\setcounter{chapter}{1} % just for this example

\begin{table}[!h]
\centering
\begin{tabular}{ l d{3.5} d{3.5} }
\toprule 
Parameters & \mc{GARCH-N} & \mc{GARCH-t}\\
\midrule 
$\delta$     & 0.1106^{*}   & 0.1084^{*}  \\
  & (6.50) & (6.1425) \\
$\beta_{1}$  & 0.630^{*}    & 0.629^{*}  \\
  & (9.64) & (9.031) \\
$\alpha_{0}$ & 0.008^{*}    & 0.008^{*}  \\
  & (2.86) & (2.855) \\
$\alpha_{1}$ & 0.203^{*}    & 0.232^{*}  \\
  & (4.15) & (4.412) \\
$\alpha_{2}$ & 0.663^{*}    & 0.639^{*}  \\
  & (10.34) & (9.261) \\
$\nu$        &             & 5.51^{*}   \\
  & & (63.53) \\
Log-Likelihood & 14.603 & 26.318\\
\bottomrule
\end{tabular}
\caption{Blah blah}
\end{table}
\end{document} 
4
  • Wow! In your code, did you manually place all those standard errors on separate lines? I was just hoping there would be an easier way to do this. But thank you very much again for your valuable time.
    – TRa
    Jul 8, 2018 at 10:36
  • 2
    @TRa - I think it took me about 2 minutes to place the standard errors on separate lines. Entirely doable, I'd say.
    – Mico
    Jul 8, 2018 at 10:39
  • Thanks for the inspiration. By the way, it's an honor talking to you here, sir.
    – TRa
    Jul 8, 2018 at 10:41
  • @TRa - I'm blushing...
    – Mico
    Jul 8, 2018 at 10:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .