我正在尝试这样做
使用此代码。它看起来不太好,而且表格容易浮动,有时需要打破。我怎样才能做得更好?这是我的代码:
\documentclass[tikz,border=10pt]{standalone}
\begin{document}
\begin{table}[]
\begin{tabular}{llllll}
& Nearly & & Sometimes & & Rarely \\
1. When I set a goal, I write it down. & & & & & \\ \cline{2-2} \cline{4-4} \cline{6-6}
2. I describe my goal in specific, measurable terms. & & & & & \\ \cline{2-2} \cline{4-4} \cline{6-6}
3. & & & & & \\ \cline{2-2} \cline{4-4} \cline{6-6}
4. & & & & & \\ \cline{2-2} \cline{4-4} \cline{6-6}
\end{tabular}
\end{table}
\end{document}
答案1
使用tabularray
和booktabs
TblrLibrary:
\documentclass{article}
\usepackage{geometry}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\begin{table}
\begin{tblr}{colspec={r X[2.5,l] X[c,b] X[c,b] X[c,b]},
rows={font=\linespread{0.84}\selectfont},
row{1}={font=\bfseries},
}
& & {Nearly\\ Always} & Sometimes & Rarely \\
1. & When I set a goal, I write it down.
& & & \\
\cmidrule[lr]{3-3} \cmidrule[lr]{4-4} \cmidrule[lr]{5-5}
2. & I describe my goal in specific, measurable terms.
& & & \\
\cmidrule[lr]{3-3} \cmidrule[lr]{4-4} \cmidrule[lr]{5-5}
3. & I offten visualize my goals
& & & \\
\cmidrule[lr]{3-3} \cmidrule[lr]{4-4} \cmidrule[lr]{5-5}
4. & My goals are achievable
& & & \\
\cmidrule[lr]{3-3} \cmidrule[lr]{4-4} \cmidrule[lr]{5-5}
5. & I set realistic deadlines for completing my goals
& & & \\
\cmidrule[lr]{3-3} \cmidrule[lr]{4-4} \cmidrule[lr]{5-5}
6. & \dots
& & & \\
\cmidrule[lr]{3-3} \cmidrule[lr]{4-4} \cmidrule[lr]{5-5}
\end{tblr}
\end{table}
\end{document}
使用tabularx
和:booktabs
makecell
\documentclass{article}
\usepackage{geometry}
\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{}
\begin{document}
\begin{table}[ht]
\begin{tabularx}{\linewidth}{r >{\hsize=1.6\hsize}X
*{3}{>{\hsize=0.8\hsize}X}
}
& & \thead[bc]{Nearly\\ Always}
& \thead[bc]{Sometimes}
& \thead[bc]{Rarely} \\
1. & When I set a goal, I write it down.
& & & \\
\cmidrule(lr){3-3} \cmidrule(lr){4-4} \cmidrule(lr){5-5}
2. & I describe my goal in specific, measurable terms.
& & & \\
\cmidrule(lr){3-3} \cmidrule(lr){4-4} \cmidrule(lr){5-5}
3. & I offten visualize my goals
& & & \\
\cmidrule(lr){3-3} \cmidrule(lr){4-4} \cmidrule(lr){5-5}
4. & My goals are achievable
& & & \\
\cmidrule(lr){3-3} \cmidrule(lr){4-4} \cmidrule(lr){5-5}
5. & I set realistic deadlines for completing my goals
& & & \\
\cmidrule(lr){3-3} \cmidrule(lr){4-4} \cmidrule(lr){5-5}
6. & \dots
& & & \\
\cmidrule(lr){3-3} \cmidrule(lr){4-4} \cmidrule(lr){5-5}
\end{tabularx}
\end{table}
\end{document}
答案2
您期望如此吗?
\documentclass[tikz,border=10pt]{standalone}
\usepackage{tabularx}
\begin{document}
\begin{table}[]
% \begin{tabular}{llllll}
\begin{tabularx}{\textwidth}{lp{5cm}lll}
&& \textbf{Nearly} \\
&&\textbf{Always} & \textbf{Sometimes} & \textbf{Rarely} \\
1. &When I set a goal, I write it down. &\hrulefill &\hrulefill &\hrulefill\\
2. &I describe my goal in specific, measurable terms. &\hrulefill &\hrulefill &\hrulefill\\
\end{tabularx}
\end{table}
\end{document}