LaTeX forum ⇒ New MembersTables, ugh!

You would like to introduce yourself before starting to post? That's a nice idea and here is the forum for you...
davidp99
Posts: 1
Joined: Wed Jul 13, 2022 2:45 am

Tables, ugh!

Postby davidp99 » Wed Jul 13, 2022 3:48 pm

hi, I'm new to LaTex, using Overleaf, and having trouble with tables! My two questions are included in the table itself. Thanks

%  Preliminaries
 %................................................................................
\documentclass[12pt,english]{article}
\usepackage{dcolumn,booktabs}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[title]{appendix}
\usepackage{geometry}				 %  changing margins 
\usepackage{setspace}				 %  changing spacing between lines
\usepackage{hyperref}  				 %  hyperlinks
\usepackage{amsmath}                 %  allows text in equations
\usepackage{etoolbox}
\makeatletter
\patchcmd\@addmarginpar{\hb@xt@}{\pdfrunninglinkoff\hb@xt@}{}{\fail}
\apptocmd\@addmarginpar{\pdfrunninglinkon}{}{\fail}

\renewcommand{\paragraph}{ %
  \@startsection{paragraph}{4} %
  {\z@}{9.25ex \@plus 1ex \@minus .2ex}{-1em} %
  {\normalfont\normalsize\bfseries} %
}
\makeatother

\usepackage{natbib}[maxbibnames=99]     	 % bibliography
\usepackage{physics}                         % combining bold and italics for  
                                             % vectors with \vb*{v}
\usepackage{graphicx}                        % include graphics

 %figures
\usepackage{tikz}                            % superimpose labels on figure
\usepackage{caption}                         % to allow for subfigures
\usepackage{subcaption}                      % to allow for subfigures

 %tables
\usepackage{booktabs,caption}                % for nice tables
 %\usepackage[flushleft]{threeparttable}     % for nice tables 
\usepackage{siunitx}                         % to line up #s by decimal point
\usepackage{dcolumn}			   	         % line up at decimal

\begin{document}
\begin{table}[!h!]
%\hline
\footnotesize
\caption{sample table}
\hline
\medskip
This table has some rows grouped close together, and other rows normal spacing.  
I would like to: (1) align according to decimals in cols 2-4; and (2) merge cols 2-4 of the first row (containing CAR \%) and include an underline.  Thanks.
\medskip
\hline
\medskip
\centering
\footnotesize
\begin{tabular}{l d d d c} 
Forecasted           &    &   {CAR {\%}_} $     & \\
change in something        &   &  & \\
interesting & [-1,1\bigr]      &       [-1,3\bigr] & [-1,5\bigr] & Observations\\[.5em]
\hline\\
\bigskip
>30\% &	1.320*** & 1.253***& 1.189***& 1352\\
\\[-2.6em]
$ & (8.73) & (7.02) 	& (6.08)  $ \\ 	[-.3em]
\\

(0.30\%\bigr]$ &	1.103*** & 1.388*** & 1.447***& 411\\ [-.3em]
$ & (3.64) & (3.61) 	& (3.33)  $  	
\medskip
% more rows to come

\end{tabular}
\end{table}

\end{document}

Recommended reading 2021:

LaTeXguide.org • LaTeX-Cookbook.net
LaTeX Beginner's Guide LaTeX Cookbook
Kreuz Elf
Posts: 22
Joined: Thu Mar 04, 2021 7:33 pm

Tables, ugh!

Postby Kreuz Elf » Thu Jul 14, 2022 11:47 pm

Your code is not compilable. There are definitely many errors, not just one or two. Please post a minimal working example.


Return to “New Members”

Who is online

Users browsing this forum: No registered users and 2 guests