我使用了一个代码,我有一个使用创建的表tabularx
,但问题是,我想使用tabularx
和使用创建下表textwidth
,其中第一列 A 的值为0.1/5
,列 TexttExText 为0.2/5
,TextTextText 为0.2/5
。
我需要一条信息,我希望该列接受自动换行,因为我将T
用长文本替换它。
我尝试创建以下代码,请帮助我:
\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}
}
\begin{table} [htp]
\setcellgapes{2pt}
\centering
\makegapedcells
\setlength\tabcolsep{1pt}
\begin{table} [htp]
\setcellgapes{4pt}
\centering
\makegapedcells
\setlength\tabcolsep{2pt}
\begin{tabularx}{\linewidth}
{| L L|
p{0.18\textwidth} |
p{0.18\textwidth} |
}
\hline
\multicolumn{2}{c}{ \multirow{2}{=} {\centering A}} &
\multirow{2}{=} {\centering TextTextText} &
\multirow{2}{=} {\centering TextTextText}
\\
\hline
\hline
\multicolumn{2}{c}{ {\centering MADM}} &
\multirow{2}{=} {\centering T} &
\multirow{2}{=} {\centering T}
\\
\hline
\end{tabularx}
\end{table}
答案1
这是你想要的吗?
\documentclass[twocolumn]{article}%{svjour3}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{makecell, multirow, tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X} % new
\usepackage{lipsum}
\begin{document}
\lipsum[2]
\begin{table} [htp]
\setcellgapes{4pt}
\centering
\makegapedcells
\setlength\tabcolsep{2pt}
\begin{tabularx}{\columnwidth}{|>{\hsize =0.66\hsize}L| >{\hsize =0.66\hsize}L|
>{\hsize =1.34\hsize}L|>{\hsize =1.34\hsize}L|}
\hline
\multicolumn{2}{|c|}{ \multirowcell{1}{\centering A}} &
\multirow{2}{=} {\centering TexttEXTtext} &
\multirow{2}{=} {\centering TextTextText} \\
\hline
\multicolumn{2}{|c|}{ {\centering MADM}} &
T & T \\
\hline
AAAA & AAA & T & T \\
\hline
\end{tabularx}
\end{table}
\end{document}