我创建了一个表格。我使用了 模板springer
。我想使用 选项来修复表格的宽度weights
,但我不知道该怎么做。我用过textwidth
但没有得到积极的结果。
这是我的代码:
\begin{filecontents*}{Draft Paper.eps}
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 19 19 221 221
%%CreationDate: Mon Sep 29 1997
%%Creator: programmed by hand (JK)
%%EndComments
gsave
newpath
20 20 moveto
20 220 lineto
220 220 lineto
220 20 lineto
closepath
2 setlinewidth
gsave
.4 setgray fill
grestore
stroke
grestore
\end{filecontents*}
\documentclass[twocolumn]{svjour3} % twocolumn
\usepackage{multirow}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\begin{document}
\begin{center}
\begin{table*}[htp]
%\scriptsize
\centering
%\begin{tabular}{|l|l|l|l|l|l|l|l|l|}
\begin{tabular} { |p{0.04\textwidth}|
p{0.04\textwidth}|p{0.12\textwidth}|p{0.12\textwidth}|p{0.13\textwidth}|p{0.13\textwidth}|p{0.12\textwidth}|p{0.12\textwidth}|p{0.02\textwidth}|}
%%{ |p{0.04\textwidth}|
%%p{0.04\textwidth}|p{0.12\textwidth}|p{0.12\textwidth}|p{0.13\textwidth}|p{0.13\textwidth}|p{0.12\textwidth}|p{0.12\textwidth}|p{0.02\textwidth}|}
\hline
Text Text Text
&
Text Text Text
&
Text Text Text
&
Text
&
Text Text & Text Text & Text Text & Text Text & Text Text
\\ \hline
{\multirow {10}{*}{\rotatebox{90}{ {Text Text } }}} &
%[origin=c] [3em]{\cellcolor{yellow}\begin{sideways}TEST\end{sideways}}
%{\multirow {2}[3em]{\cellcolor{yellow}\begin{sideways}TEST\end{sideways}}} &
{\multirow [c]{14}{*}{\rotatebox{90}{ Text }}}
&
Text Text Text .
&
Text Text .
&
%\begin{tabular} {@{}l@{}}
\begin{tabitemize}
\item
RSS.
\item Text Text .
\item Text Text .
\end{tabitemize}
&
%\begin{tabular}{@{}l@{}}
\begin{tabitemize}
\item Text Text .
\item Text Text .
\item Text Text %\hspace{0.28cm}
rate.
\end{tabitemize}
%\end{tabular}
&
Text Text Text Text Text Text Text .
&
Text Text Text Text Text .
&
Text
\\ \cline{3-9}& &
Text Text Text .
&
Text Text Text (10 Text Text 5 Text ).
&
%\begin{tabular}{@{}l@{}}
\begin{tabitemize}
\item Text .
\item Text Text .
\item Text .
\end{tabitemize}
%\end{tabular}
&
Text Text Text Text .
&
Text Text Text Text Text Text .
&
Text Text Text Text Text Text Text .
&
Text \\
\cline{1-1} \cline{3-9}
\multirow{4}{*} {\rotatebox[origin=c]{90} { Text }} &
&
Text -Text .
&
Text Text Text .
&
Text Text Text Text in $t_{n}$.
&
Text Text Text Text Text Text $t_{n+1}$.
&
Text Text Text Text Text Text Text Text .
&
%\multicolumn{1}{c|}{
//
%}
&
Text
\\
\hline
%\multirow{5}{*}{\rotatebox{90}{Example 3}}
\multirow{8}{*} {\rotatebox[origin=c]{90} { Text }} &
\multirow{8}{*} {\rotatebox[origin=c]{90} { Text }}
&
Text Text .
&
Text Text Text .
&
%\begin{tabular} {@{}l@{}}
\begin{tabitemize}
\item Text Text .
\item Text .
\item Text .
\item Text .
\item Text Text .
\item Text Text .
\end{tabitemize}
%\end{tabular}
&
Text Text Text (Text , Text , Text , Text Text Text ).
&
Text Text Text .
&
Text Text Text Text .
&
Text
\\ \hline
\end{tabular}
\caption{Text Text Text Text }
\label{Text }
\end{table*}
\end{center}
\end{document}
这是表格,我不知道为什么表格的宽度大于页面的宽度。
答案1
- 您的文档示例不完整。它不包含
tabitemize
环境定义。 - 对于表格环境,
tabularx
使用。为此规定了表格宽度(等于\textwidth} and defined
Xcolumn tape (modified to
L`,将单元格的文本左对齐) - 单元格列表是通过使用
enumitem
包来定义的,并重命名为tabitem
(如果愿意,可以将名称更改为tabitemize
)。 - 为了在单元格内容上方/下方获得更多垂直空间,请使用包
\makegapedcells
中定义的宏makecell
- 对于第一条和最后一条水平线,使用包
Xhline{<width>}
中定义makecell
来强调这些线 - 从 MWE(最小工作示例)中删除所有注释行,代码格式更紧凑,更易于阅读/维护。
\documentclass[twocolumn]{svjour3}
\usepackage{graphicx}
\usepackage{makecell, multirow, tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X} % new
\usepackage{enumitem} % new
\newlist{tabitem}{itemize}{1} % <-- defined new list
\setlist[tabitem]{nosep, % <-- new list setup
leftmargin=*,
label=$\bullet$,
before=\begin{minipage}[t]{\linewidth},
after=\end{minipage}
}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{table*}
\setcellgapes{2pt}
\makegapedcells
\setlength\tabcolsep{4pt}
\begin{tabularx}{\linewidth}{
*{2}{|p{0.04\textwidth}}
*{6}{|L}
|p{0.04\textwidth}|}
\Xhline{1pt}
Text Text Text
& Text Text Text
& Text Text Text
& Text
& Text Text
& Text Text
& Text Text
& Text Text
& Text Text \\
\hline
\multirow{7}{=}{\centering\rotatebox{90}{Text Text}}
& \multirow{10}{=}{\centering\rotatebox{90}{Text}}
& Text Text Text
& Text Text
& \begin{tabitem}
\item RSS.
\item Text Text
\item Text Text
\end{tabitem}
& \begin{tabitem}
\item Text Text
\item Text Text
\item Text Text rate.
\end{tabitem}
& Text Text Text Text Text Text Text
& Text Text Text Text Text
& Text \\
\cline{3-9}
& & Text Text Text
& Text Text Text (10 Text Text 5 Text).
& \begin{tabitem}
\item Text
\item Text Text
\item Text
\end{tabitem}
& Text Text Text Text
& Text Text Text Text Text Text
& Text Text Text Text Text Text Text
& Text \\
\cline{1-1} \cline{3-9}
\multirow{3}{=}{\centering\rotatebox[origin=c]{90}{Text}}
& & Text -Text
& Text Text Text
& Text Text Text Text in $t_{n}$.
& Text Text Text Text Text Text $t_{n+1}$.
& Text Text Text Text Text Text Text Text
& & Text \\
\hline
\multirow{6}{=}{\centering\rotatebox[origin=c]{90}{Text}}
& \multirow{6}{=}{\centering\rotatebox[origin=c]{90}{Text}}
& Text Text
& Text Text Text
& \begin{tabitem}
\item Text Text .
\item Text .
\item Text .
\item Text .
\item Text Text .
\item Text Text .
\end{tabitem}
& Text Text Text (Text, Text, Text, Text Text Text).
& Text Text Text
& Text Text Text Text
& Text \\
\Xhline{1pt}
\end{tabularx}
\caption{Text Text Text Text }
\label{Text }
\end{table*}
\end{document}
(红线显示页面布局)
答案2
这是 MWE,我使用了tabular*
\textwidth
宽。我减小了\tabcolsep
字体大小。此外,该命令@{\extracolsep{\fill}}
确保表格使用所有可用空间。新列(N
)将内容设置为右侧参差不齐。此外,我增加了最后一列的大小:
\documentclass[twocolumn]{article} % twocolumn
\usepackage{multirow, graphicx, array}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\newcolumntype{N}[1]{>{\raggedright\arraybackslash}p{0.#1\textwidth}}
\begin{document}
\begin{center}
\footnotesize
\begin{table*}[htp]
\centering
\setlength{\tabcolsep}{3pt}
\begin{tabular*}{\textwidth} {@{\extracolsep{\fill}}|N{04}|
N{04}|N{12}|N{12}|N{13}|N{13}|N{12}|N{12}|N{04}|}
\hline
Text Text Text
&
Text Text Text
&
Text Text Text
&
Text
&
Text Text & Text Text & Text Text & Text Text & Text Text
\\ \hline
{\multirow {10}{*}{\rotatebox{90}{ {Text Text } }}} &
{\multirow [c]{14}{*}{\rotatebox{90}{ Text }}}
&
Text Text Text .
&
Text Text .
&
\begin{itemize}
\item
RSS.
\item Text Text .
\item Text Text .
\end{itemize}
&
\begin{itemize}
\item Text Text .
\item Text Text .
\item Text Text
rate.
\end{itemize}
&
Text Text Text Text Text Text Text .
&
Text Text Text Text Text .
&
Text
\\ \cline{3-9}& &
Text Text Text .
&
Text Text Text (10 Text Text 5 Text ).
&
\begin{itemize}
\item Text .
\item Text Text .
\item Text .
\end{itemize}
&
Text Text Text Text .
&
Text Text Text Text Text Text .
&
Text Text Text Text Text Text Text .
&
Text \\
\cline{1-1} \cline{3-9}
\multirow{4}{*} {\rotatebox[origin=c]{90} { Text }} &
&
Text -Text .
&
Text Text Text .
&
Text Text Text Text in $t_{n}$.
&
Text Text Text Text Text Text $t_{n+1}$.
&
Text Text Text Text Text Text Text Text .
&
&
Text
\\ \hline
\multirow{8}{*} {\rotatebox[origin=c]{90} { Text }} &
\multirow{8}{*} {\rotatebox[origin=c]{90} { Text }}
&
Text Text .
&
Text Text Text .
&
\begin{itemize}
\item Text Text .
\item Text .
\item Text .
\item Text .
\item Text Text .
\item Text Text .
\end{itemize}
&
Text Text Text (Text , Text , Text , Text Text Text ).
&
Text Text Text .
&
Text Text Text Text .
&
Text
\\ \hline
\end{tabular*}
\caption{Text Text Text Text }
\label{Text }
\end{table*}
\end{center}
\end{document}