我制作了一个 latex 模板,其中我想有 4 列。在其中一列中,我尝试制作一个有三列的表格。但我的代码有点问题。你能帮我吗?
% page setup
\documentclass[]{article}
\pagestyle{headings}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
% geometry
\usepackage[landscape]{geometry}
\geometry{headsep=\baselineskip}
% colums / paragraphs
\usepackage{paracol}
\usepackage{parskip}
% table
\usepackage{ragged2e}
\usepackage{booktabs, tabularx}
\renewcommand{\tabularxcolumn}[1]{m{#1}}
\newcolumntype{C}{>{\small\raggedright\arraybackslash}X}
\newcolumntype{P}[1]{>{\RaggedRight\hspace{0pt}}m{#1}}
%----------------------------------------------------------------------------------------------
\begin{document}
%----------------------------------------------------------------------------------------------
\newgeometry{top=0.55in,bottom=0.55in,right=0.3in,left=0.3in}
\begin{paracol}{4}
\begin{table}[h]
\settowidth\colwidth{hellohe}
\begin{tabularx}{0.3\textwidth}{@{} P{\colwidth} *{2}{C} @{}}
\toprule
Lane
& 1 & 2 \\
\addlinespace
Sample
& P4 & P3 \\
\bottomrule
\end{tabularx}
\end{table}
\end{paracol}
\end{document}
答案1
不确定你为什么要这样做,但这显示了如何重叠列。最好停止 paracol 并更改列宽。
\documentclass[]{article}
\pagestyle{headings}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
% geometry
\usepackage[landscape]{geometry}
\geometry{headsep=\baselineskip}
% colums / paragraphs
\usepackage{paracol}
\usepackage{parskip}
% table
\usepackage{ragged2e}
\usepackage{booktabs, tabularx}
\renewcommand{\tabularxcolumn}[1]{m{#1}}
\newcolumntype{C}{>{\small\raggedright\arraybackslash}X}
\newcolumntype{P}[1]{>{\RaggedRight\hspace{0pt}}m{#1}}
\newlength{\colwidth}
%----------------------------------------------------------------------------------------------
\begin{document}
%----------------------------------------------------------------------------------------------
\newgeometry{top=0.55in,bottom=0.55in,right=0.3in,left=0.3in}
\begin{paracol}{4}
\begin{table}[h]
\settowidth\colwidth{hellohe}
\rlap{\begin{tabularx}{0.3\textwidth}{@{} P{\colwidth} *{2}{C} @{}}
\toprule
Lane
& 1 & 2 \\
\addlinespace
Sample
& P4 & P3 \\
\bottomrule
\end{tabularx}}
\end{table}
\switchcolumn
\noindent second column
\switchcolumn
\noindent third column
\switchcolumn
\noindent fourth column
\switchcolumn[0]*
\noindent continue from here
\switchcolumn
\noindent second column
\switchcolumn
\noindent third column
\switchcolumn
\noindent fourth column
\end{paracol}
\end{document}