
我正在嘗試編寫以下“哥德式”表格,但在均勻分佈的文字間距和大小方面遇到很多麻煩。
我用表格嘗試以下操作:
\begin{table}
\begin{center}
\begin{tabular*}{\textwidth}{p{0.2\textwidth}p{0.2\textwidth}p{0.2\textwidth}p{0.2\textwidth}p{0.2\textwidth}}
\hline \hline
\rule[-1ex]{0pt}{4ex} \multirow{6}{*}{\includegraphics[width=20mm]{./Muscles/biceps.jpg}} & \bf{Origin} & \multicolumn{3}{l}{Short head: tip of coracoid process of scapula; Long head: supraglenoid tubercle of scapula}\\
\cline{2-5} \rule[-1ex]{0pt}{4ex} & \bf{Insertion} & \multicolumn{3}{l}{Tuberosity of radius and fascia of forearm via bicipital aponeurosis} \\
\cline{2-5} \rule[-1ex]{0pt}{4ex} & \bf{Action} & \multicolumn{3}{l}{Supinates forearm and, when it is supine, flexes forearm} \\
\cline{2-5} \rule[-1ex]{0pt}{4ex} & \bf{Innervation} & \multicolumn{3}{l}{Musculocutaneous nerve (C5 and C6 ) (C5, C6)} \\
\cline{2-5} \rule[-1ex]{0pt}{4ex} & $F^{max}_{iso}$ & $\alpha$ & $l^{CE}_{opt}$ & $l^{T}_{sclack}$ \\
\rule[-1ex]{0pt}{4ex} & [N] & [deg] & [m] & [m] \\
\hline \hline
\end{tabular*}
\caption{Threshold and saturation values for the experimental subject.}
\label{tabpar2}
\end{center}
\end{table}
透過此程式碼,我獲得以下內容,其中錯誤是該行在末尾沒有中斷:
另一方面,如果我嘗試以下程式碼,換行符和最後一列是均勻分佈的,但多列不起作用:
\begin{table}
\begin{center}
\begin{tabularx}{\textwidth}{clXXX}
\hline \hline
\rule[-1ex]{0pt}{4ex} \multirow{6}{*}{\includegraphics[width=20mm]{./Muscles/biceps.jpg}} & \bf{Origin} & \multicolumn{3}{X}{Short head: tip of coracoid process of scapula; Long head: supraglenoid tubercle of scapula}\\
\cline{2-5} \rule[-1ex]{0pt}{4ex} & \bf{Insertion} & \multicolumn{3}{X}{Tuberosity of radius and fascia of forearm via bicipital aponeurosis} \\
\cline{2-5} \rule[-1ex]{0pt}{4ex} & \bf{Action} & \multicolumn{3}{X}{Supinates forearm and, when it is supine, flexes forearm} \\
\cline{2-5} \rule[-1ex]{0pt}{4ex} & \bf{Innervation} & \multicolumn{3}{X}{Musculocutaneous nerve (C5 and C6 ) (C5, C6)} \\
\cline{2-5} \rule[-1ex]{0pt}{4ex} & $F^{max}_{iso}$ & $\alpha$ & $l^{CE}_{opt}$ & $l^{T}_{sclack}$ \\
\rule[-1ex]{0pt}{4ex} & [N] & [deg] & [m] & [m] \\
\hline \hline
\end{tabularx}
\caption{Threshold and saturation values for the experimental subject.}
\label{tabpar2}
\end{center}
\end{table}
這是結果:
有什麼解決方法可以解決這個問題嗎?
多謝
答案1
訣竅是基本上使用
\multicolumn{3}{>{\hsize=3\hsize}X}
稍作調整。我會為這種表定義一個新環境,以圖像資料作為參數。圖像本身是透過固定的\muscleimage
命令來放置的,以盡可能避免複雜的程式碼。
\documentclass{article}
\usepackage[demo]{graphicx} % demo is just for the example
\usepackage{tabularx,booktabs,amsmath,adjustbox}
\newcommand{\muscleimage}{}
\newenvironment{muscle}[2][]
{%
\renewcommand{\muscleimage}{%
\adjustbox{valign=t,set depth=0pt}{\includegraphics[#1]{#2}}%
}%
\tabularx{\textwidth}{clXXX}
}
{%
\endtabularx
}
\newcommand{\fulltable}[1]{%
\multicolumn{3}{>{\hsize=\dimexpr3\hsize+4\tabcolsep\raggedright\arraybackslash}X}{#1}%
}
\begin{document}
\begin{table}
\centering
\begin{muscle}[height=40mm,width=20mm]{./Muscles/biceps.jpg}
\toprule
\muscleimage
& \textbf{Origin}
& \fulltable{
Short head: tip of coracoid process of scapula; Long head: supraglenoid tubercle of scapula
} \\
\cmidrule{2-5}
& \textbf{Insertion}
& \fulltable{
Tuberosity of radius and fascia of forearm via bicipital aponeurosis
} \\
\cmidrule{2-5}
& \textbf{Action}
& \fulltable{
Supinates forearm and, when it is supine, flexes forearm
} \\
\cmidrule{2-5}
& \textbf{Innervation}
& \fulltable{
Musculocutaneous nerve (C5 and C6 ) (C5, C6)
} \\
\cmidrule{2-5}
& $F^{\textup{max}}_{\textup{iso}}$
& $\alpha$ & $l^{\textup{CE}}_{\textup{opt}}$
& $l^{T}_{\textup{sclack}}$ \\
& [N] & [deg] & [m] & [m] \\
\bottomrule
\end{muscle}
\caption{Threshold and saturation values for the experimental subject.}
\label{tabpar2}
\end{table}
\end{document}
答案2
這是一個有tabularx
和 的 解決方案booktabs
。我創建了最後三X
列,並定義了一個新的Y
列類型,其行為與 X 相同,但寬度是三倍,用於multicolumn{3}
.不需要看不見的垂直規則:它們在序言中被替換為特別指定\aboverulesep
和的值\belowrulesep
。該multirow
命令可能需要再次調整才能垂直居中,具體取決於實際影像。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage{multirow}
\usepackage{mathtools}
\usepackage{array, caption, tabularx, booktabs}
\usepackage[demo]{graphicx}
\setlength{\aboverulesep}{1ex}
\setlength{\belowrulesep}{1.5ex}
\newcolumntype{Y}{{>{\hsize=3\hsize}X}}
\begin{document}
\begin{table}
\centering
\begin{tabularx}{\linewidth}{ll*{3}{X}}
\toprule\midrule
\multirow{6}{*}[-5.25ex]{\includegraphics[width=20mm]{./Muscles/biceps.jpg}} & \bf{Origin} & \multicolumn{3}{Y}{Short head: tip of coracoid process of scapula; Long head: supraglenoid tubercle of scapula}\\
\cmidrule{2-5} & \bf{Insertion} & \multicolumn{3}{Y}{Tuberosity of radius and fascia of forearm via bicipital aponeurosis} \\
\cmidrule{2-5} & \bf{Action} & \multicolumn{3}{Y}{Supinates forearm and, when it is supine, flexes forearm} \\
\cmidrule{2-5} & \bf{Innervation} & \multicolumn{3}{Y}{Musculocutaneous nerve (C5 and C6 ) (C5, C6)} \\
\cmidrule{2-5}& $F^{\max}_\mathrm{iso}$ & $\alpha$ & $l^{CE}_\mathrm{opt}$ & $l^{T}_\mathrm{sclack}$ \\
\addlinespace[1.5ex]
& [N] & [deg] & [m] & [m] \\
\midrule \bottomrule
\end{tabularx}
\caption{Threshold and saturation values for the experimental subject.}
\label{tabpar2}
\end{table}
\end{document}