我想设置一个表格,但是我遇到了很多问题。我希望你能帮助我。1)它溢出了 2)字体大小自动减小(2 句子很长,换行符不起作用。我分享下面的图:这是我所拥有的
但是,我在给定的图中没有使用换行命令,而是在下面的 MWE 中使用了该命令:
\documentclass[journal]{IEEEtran}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\renewcommand{\q}[1]{``#1''}
\usepackage[usestackEOL]{stackengine}
\strutlongstacks{T}
\usepackage{makecell}
\usepackage{array}
\begin{table}[t]
\caption{anythings}
\renewcommand{\arraystretch}{1.8}
\begin{center}
\label{table_par}
\begin{tabular}{l|l l l l}
%{\textwidth}{*{1}{l|} *{4}{l|}}
\textbf{{\small Condition }} &fasfasdfafa %&\multicolumn{4}{c}{\textbf{\small jkhjhhk}}
\\
\hline\hline
\multirow{5}{*}{Smart system} &involves intelligent communication
technologyafdasfasfafdafsfonetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one two two one\\
&two onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one \\
&two onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one\\
&two onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one\\
&two onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one\\
\hline
\multirow{5}{*}{two onetwo onetwo one} & \thead{two onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onevzcxvz,\\ ztwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one \\one twoone one twoone one twoone one twoone one twoone } \\
&one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone \\
&one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone \\
&one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone \\
&one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone .
\\
\hline
\end{tabular}
\end{center}
\end{table}
\end{document}
我按照@barbara 提供的 MWE 更改了我的代码!然而,问题仍然存在,我只更改了 arraystretch 的大小和第一列的宽度,您能再看看吗。
答案1
这是示例代码的略微修改版本,允许右侧列中的(大部分)文本换行。宽度不理想;这需要您进行一些调整,但我认为该方法足够清晰。
我不确定您想要用该\multirow
组件做什么,所以我保留了它;它可能可以按照与表格主要部分相同的方式进行调整。
\documentclass[journal]{IEEEtran}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
%%\renewcommand{\q}[1]{``#1''}
\usepackage[usestackEOL]{stackengine}
\strutlongstacks{T}
\usepackage{makecell}
\usepackage{array}
\begin{document}
\begin{table}[t]
\caption{anythings}
\renewcommand{\arraystretch}{1.8}
\begin{center}
\label{table_par}
%%\begin{tabular}{l|l l l l}
\begin{tabular}{l|p{.7\linewidth}>{\raggedright} l l l}
%{\textwidth}{*{1}{l|} *{4}{l|}}
\textbf{{\small Condition }} &fasfasdfafa %&\multicolumn{4}{c}{\textbf{\small \ jkhjhhk}}
\\
\hline\hline
\multirow{5}{*}{Smart system} &involves intelligent communication
technologyafdasfasfafdafsfonetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one two two one\\
&two onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one \\
&two onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one\
two onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one\\
&two onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one\\
&two onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one\\
\hline
\multirow{5}{*}{two onetwo onetwo one} & two onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onevzcxvz, ztwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one \\one twoone one twoone one twoone one twoone one twoone \\
&one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone \\
&one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone \\
&one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone \\
&one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone .
\\
\hline
\end{tabular}
\end{center}
\end{table}
\end{document}
答案2
tabular
您在a中有数据table
,并且这两种环境都不能跨页。这里我使用supertabular
。我假设您只需要两列,尽管您在问题中的表中声明了 5 列。
\documentclass[journal]{IEEEtran}
\usepackage{array,supertabular}
\renewcommand{\arraystretch}{1.8}
\begin{document}
\tablehead{%
\textbf{{\small Condition }} &fasfasdfafa %&\multicolumn{4}{c}{\textbf{\small jkhjhhk}}
\\
\hline
}
\begin{supertabular}{
@{}
>{\raggedright\arraybackslash}p{50pt}
>{\raggedright\arraybackslash}p{120pt}
@{}}
\hline\hline
Smart system &involves intelligent communication
technology afdasfasfafdafsfonetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one two two one\\
&two onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one \\
&two onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one\\
&two onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one\\
&two onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one\\
\hline
two onetwo onetwo one & two onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onevzcxvz, ztwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo onetwo one one twoone one twoone one twoone one twoone one twoone \\
&one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone \\
&one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone \\
&one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone \\
&one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone one twoone .
\\
\hline
\end{supertabular}
\end{document}