Information and discussion about graphics, figures & tables in LaTeX documents.
frznchckn
Posts: 3 Joined: Thu Dec 09, 2010 9:23 pm
Post
by frznchckn » Wed Feb 16, 2011 1:47 am
I have a 32 column table, and to make it fit on letter size paper, I used \hspace. However, when I use a \multicolumn, the total wide of the column spanning cell does not follow the widths as defined by \hspace. Is there a way to remedy this? Perhaps a different approach that I'm not doing? Thanks.
Code: Select all
\tiny{\begin{tabular}{
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|}
\hline
\multicolumn{32}{|c|}{CSR}\\
\hline
\hline
31 & 30 & 29 & 28 & 27 & 26 & 25 & 24 &
23 & 22 & 21 & 20 & 19 & 18 & 17 & 16 &
15 & 14 & 13 & 12 & 11 & 10 & 9 & 8 &
7 & 6 & 5 & 4 & 3 & 2 & 1 &
0 \\
\hline
\multicolumn{28}{|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}|}{Unused} &
\begin{sideways} {Generate Test} \end{sideways} &
\begin{sideways} {Unused} \end{sideways} &
\begin{sideways} {Software Reset} \end{sideways} &
\begin{sideways} {Capture} \end{sideways}\\
\hline
\end{tabular}}
Last edited by
frznchckn on Wed Feb 16, 2011 8:41 pm, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.
Frits
Posts: 169 Joined: Wed Feb 02, 2011 6:02 pm
Post
by Frits » Wed Feb 16, 2011 8:52 am
A less elegant way would be to use \hphantom{}. Not sure if it'll work though, since your code produces a lot of errors here I can't test it..
frznchckn
Posts: 3 Joined: Thu Dec 09, 2010 9:23 pm
Post
by frznchckn » Wed Feb 16, 2011 9:22 am
Thanks for the replay Frits. I'm not familiar with \hphantom and will give it a look.
If you're having trouble with the code perhaps the following would help.
\usepackage{rotating}
\usepackage{colortbl}
I should've posted more. I posted the complete file below. It runs no problem for me.
Code: Select all
\documentclass[11pt,letterpaper]{article}
\usepackage{fullpage}
\usepackage{mathptmx}
\usepackage[pdftex]{graphicx}
\usepackage{rotating}
%\usepackage[table]{xcolor}
\usepackage{colortbl}
\usepackage{longtable}
%\definecolor{tableShade}{HTML}{F1F5FA}
%\definecolor{tableShade2}{HTML}{ECF3FE}
\addtolength{\oddsidemargin}{-.5in}
\addtolength{\evensidemargin}{-.5in}
\addtolength{\textwidth}{1.0in}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
%\usepackage{parskip}
\begin{document}
%\input{./title.tex}
%\title{Trig FPGA Interface Control Document}
%\author{David Robison \and Chris Woodruff}
%\date{\today}
%\maketitle
%\tableofcontents
%\listoffigures %\listoftables
%\section{Introduction}
%\subsection{intro2}
\begin{center}
%\begin{tabular}{|c|}
%\hline
%DMAx CSR \\
%\hline
%\end{tabular}
\tiny{\begin{tabular}{
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}>{\columncolor[gray]{0.9}[0.15cm][0.15cm]}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}
|}
\hline
\multicolumn{32}{|c|}{CSR}\\
\hline
\hline
31 & 30 & 29 & 28 & 27 & 26 & 25 & 24 &
23 & 22 & 21 & 20 & 19 & 18 & 17 & 16 &
15 & 14 & 13 & 12 & 11 & 10 & 9 & 8 &
7 & 6 & 5 & 4 & 3 & 2 & 1 &
0 \\
\hline
\multicolumn{28}{|@{\hspace{0.15cm}}c@{\hspace{0.15cm}}|}{Unused} &
\begin{sideways} {Generate Test} \end{sideways} &
\begin{sideways} {Unused} \end{sideways} &
\begin{sideways} {Software Reset} \end{sideways} &
\begin{sideways} {Capture} \end{sideways}\\
%\begin{sideways} BIT10 \end{sideways} &
%\begin{sideways} BIT9 \end{sideways} &
%\begin{sideways} BIT8 \end{sideways} &
%\begin{sideways} BIT7 \end{sideways} &
%\begin{sideways} BIT6 \end{sideways} &
%\begin{sideways} BIT5 \end{sideways} &
%\begin{sideways} BIT4 \end{sideways} &
%\begin{sideways} BIT3 \end{sideways} &
%\begin{sideways} {Ignore Errors } \end{sideways} &
%\begin{sideways} Done \end{sideways} &
%\begin{sideways} {{Go}} \end{sideways} \\
\hline
\end{tabular}}
\linebreak
\newline
\normalsize{\begin{tabular}{|c|c|c|}
\hline
{\bf {Bit Field Name}} & {\bf{Range}} & {\bf{Description}} \\
\hline
{Unused} & {31:4} & {N/A} \\
\hline
{Generate Test} & {3} & {DOES SOMETHING TBD} \\
\hline
{Unused} & {2} & {N/A} \\
\hline
\end{tabular}}
\end{center}
%\chapter{Block Diagrams}
%\chapter{Memory Maps}
%\chapter{Register Definitions}
Hello World!
\appendix
%\chapter{Related Documents List}
%\chapter{something else}
\end{document}
frznchckn
Posts: 3 Joined: Thu Dec 09, 2010 9:23 pm
Post
by frznchckn » Wed Feb 16, 2011 7:11 pm
Peter from the latexusersgroup pointed out that I over specified my multicolumn. It should have been:
\multicolumn{28}{|c|@{\hspace{0.15cm}}}{Unused} &
localghost
Site Moderator
Posts: 9202 Joined: Fri Feb 02, 2007 12:06 pm
Post
by localghost » Wed Feb 16, 2011 8:23 pm
frznchckn wrote: Peter from the latexusersgroup pointed out that I over specified my multicolumn. […]
If that solves the problem, then please mark the topic (not the last post) accordingly as written in Section 3 of the
Board Rules (to be read before posting).
Best regards and welcome to the board
Thorsten