How to draw up a slightly more complicated table with LaTeX

| コメント(0)

I have recently and unfortunately run into the problems while making a slightly more complicated table with considerably varied vertical lines and horizontal lines using LaTeX. It may be presumptuous of me to comment
on these debatable matters, but I intend to write down in this article how to solve some of them in the service of your society.

I compiled the table as is given below and the source code is also given below.

table0206

      source code: table0206.tex

\documentclass[11pt]{article}
\usepackage{hangcaption,array,multirow,hhline}
\parindent=0pt
\begin{document}
\begin{table}[h]
\begin{center}
\begin{sffamily}
\begin{large}
\captionwidth=0.9\textwidth
\newcommand{\captionfonts}{\large\bfseries}
\makeatletter
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{{\captionfonts #1: #2}}%
\ifdim \wd\@tempboxa >\hsize
{\captionfonts #1: #2\par}
\else
\hbox to\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
\makeatother
\hangcaption{\large\sffamily
\mdseries A Slightly More Complicated Example}\medskip
\newlength{\hheight}
\setlength{\hheight}{32pt}
\newlength{\gheight}
\setlength{\gheight}{20pt}
\newcommand{\bhline}[1]{\noalign{\hrule height #1}}
\newcommand{\bvline}[1]{\vrule width #1}
\renewcommand{\multirowsetup}{\centering}
\renewcommand{\arraystretch}{0.8}
\extrarowheight=15pt
\arraycolsep=0pt
$\hspace{7pt}\overbrace{\hspace{38pt}}^{\mbox{\normalsize65pt}}
\hspace{2pt}\overbrace{\hspace{10pt}}^{\mbox{\normalsize1.6pt}}
\hspace{2pt}
\overbrace{\hspace{38pt}}^{\mbox{\normalsize65pt}}\hspace{2pt}
\overbrace{\hspace{10pt}}^{\mbox{\normalsize1.6pt}}\hspace{2pt}
\overbrace{\hspace{38pt}}^{\mbox{\normalsize65pt}}\hspace{2pt}
\overbrace{\hspace{8pt}}\hspace{2pt}
\overbrace{\hspace{80pt}}^{\mbox{\normalsize100pt}}$\\
$\begin{array}{p{65pt}!{\bvline{1.6pt}}p{65pt}!{\bvline{1.6pt}}
p{65pt}||b{100pt}} \bhline{1.6pt}
\multicolumn{3}{p{198.2pt}||}{\mbox{\centerline{$\backslash
$multicolumn\{3\}\{p\{198.2pt\}\}\{\}}}} &
\multirow{3}{100pt}{\rule{0pt}{\hheight} \mbox{\centerline{$
\backslash$multirow}}}\\[11pt] \hhline{=:=:=#~}
\multicolumn{1}{c!{\bvline{1.6pt}}}{\multirow{2}{65pt}
{\rule{0pt}{\gheight} \mbox{\centerline{$\backslash
$multirow}}}} & \multicolumn{1}{p{65pt}!{\bvline{1.6pt}}}
{\mbox{\centerline{$\backslash$vrule}}} &
\multicolumn{1}{p{65pt}||}{\mbox{\centerline
{$\backslash$vrule}}} & \\[11pt] \cline{2-3}
& \mbox{\centerline{$\backslash$vrule}} &
\mbox{\centerline{$\backslash$vrule}} &
\\[11pt] \hhline{=::=::=#=}
\multicolumn{1}{p{65pt}||}{\mbox{\centerline{
$\backslash$hrule}}} & \multicolumn{1}{p{65pt}||}
{\mbox{\centerline{$\backslash$hrule}}} &
\multicolumn{1}{p{65pt}||}{\mbox{\centerline{
$\backslash$hrule}}} & \multicolumn{1}{p{100pt}}
{\mbox{\centerline{$\backslash$hhline}}}\\[11pt]
\bhline{1.6pt}
\end{array}$ \\
\end{large}
\end{sffamily}
\end{center}
\end{table}
\end{document}

At first, you could draw the vertical lines with varied thickness when you might use \vrule and you could draw the horizontal lines with varied thickness when you might use \hrule. The command lines are given below.

   \documentclass[11pt]{article}
   \usepackage{array}
   \begin{document}
   \newcommand{\bhline}[1]{\noalign{\hrule height #1}}
   \newcommand{\bvline}[1]{\vrule width #1}
   $\begin{array}{p{20pt}!{\bvline{1pt}}p{20pt}} \bhline{1pt}
   01 & 02 \\ \bhline{1pt}
   \end{array}$
   \end{document}

Secondly, you could put the double bottom lines on some cells when you might use \hhline. The command lines are given below.

   \documentclass[11pt]{article}
   \usepackage{array,hhline}
   \begin{document}
   $\begin{array}{p{20pt}||p{20pt}} \hhline{=#=}
   01 & 02 \\ \hhline{=#=}
   \end{array}$
   \end{document}

Thirdly, you could merge some cells in the same row when you might use \multicolumn and you could merge some cells in the same column when you might use \multirow. The command lines are given below.

   \documentclass[11pt]{article}
   \usepackage{array,multirow}
   \begin{document}
   $\begin{array}{p{20pt}|p{20pt}} \hline
   \multicolumn{2}{p{40.4pt}}{text} \\ \hline
   \multirow{2}{20pt}{\mbox{text}} &
   \multirow{2}{20pt}{\mbox{text}} \\
   & \\ \hline
   \end{array}$
   \end{document}

Finally I am happy to assist you in drawing up a slightly
more complicated table with the varied lines using LaTeX.

コメントする

My Photo
プロフィール!
2016・11・15 改訂
spacer01
rssspacer01foaf
spacer01
atom.xml
spacer01

この記事について

このページは、Suzuki TakashiがFebruary 6, 2011 9:25 PMに書いた記事です。

ひとつ前の記事は「本調子ではない。」です。

次の記事は「現代中国に対する欧米の見方について一考察。」です。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。

June 2024

Sun Mon Tue Wed Thu Fri Sat
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30

月別 アーカイブ

OpenID対応しています OpenIDについて