我已经搜索了一些解决方案来使这个简单的表格适合页面大小,但每当我使用 resizebox 或 adjustbox 时,文本大小就会变得太小。所以我尝试使用 tabular 和 tabularx 来解决这个问题,但到目前为止还没有成功:
以下是 MWE:
\begin{table}[ht]
\centering
\begin{tabularx}{1.0\textwidth}{|l|l|l|}
\hline
\rowcolor[HTML]{C0C0C0}
\textbf{Step} &
\textbf{EBSE} &
\textbf{Correlation with current study} \\ \hline
1 &
\begin{tabular}[c]{@{}l@{}}Converting the need for information (about\\ development and maintenance methods, management\\ procedures etc.) into an answerable question.\end{tabular} &
What do software practitioners need to be aware when doing architectural software decisions? \\ \hline
2 &
\begin{tabular}[c]{@{}l@{}}Tracking down the best evidence with which to answer\\ that question.\end{tabular} &
Literature research suggests that the best way to provide answers to these questions is to investigate how these decisions are made and in what conditions. \\ \hline
3 &
\begin{tabular}[c]{@{}l@{}}Critically appraising that evidence for its validity\\ (closeness to the truth), impact (size of the effect), and\\ applicability (usefulness in software development\\ practice).\end{tabular} &
Survey research is one of the best methods for appraising such hypotheses and collecting information about software development practices. \\ \hline
4 &
\begin{tabular}[c]{@{}l@{}}Integrating the critical appraisal with our software\\ engineering expertise and with our stakeholders’\\ values and circumstances.\end{tabular} &
By combining EBSE with the survey research, we provide a formal way to investigate the current phenomena. \\ \hline
5 &
\begin{tabular}[c]{@{}l@{}}Evaluating our effectiveness and efficiency in\\ executing Steps 1-4 and seeking ways to improve them\\ both for next time.\end{tabular} &
Further the evaluation phase of this study, we reassess the benefits of EBSE with survey results and shed some light on future findings. \\ \hline
\end{tabularx}
\caption{Five step used in EBSE}
\label{tab:ebse-correlation}
\end{table}
我试过表格生成器以便更快地完成任务,但现在我陷入困境。有什么建议可以给这个新手吗?
答案1
因此,扩展 David 的评论,我将删除所有换行宏\\
,保留原样的文本,并让 LaTeX 在必要时添加换行符。对于文本,您可以使用常规段落列p{}
或X
避免必须指定宽度。
考虑添加\RaggedRight
from ragged2e
,这也能改善较窄环境(如表格)内的文本
\documentclass{article}
\usepackage{tabularx}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{ragged2e}
\usepackage{kantlipsum}
\begin{document}
\begin{table}[ht]
\renewcommand*{\arraystretch}{1.35}
\setlength\tabcolsep{4pt}
\RaggedRight
\centering
\begin{tabularx}{\textwidth}{lXX}
\hline
\rowcolor[HTML]{C0C0C0}
\textbf{Step}
& \textbf{EBSE}
& \textbf{Correlation with current study}
\\ \hline
1
& Converting the need for information (about development and maintenance methods, management procedures etc.) into an answerable question.
& What do software practitioners need to be aware when doing architectural software decisions? \\
\hline
2
& Tracking down the best evidence with which to answer that question.
& Literature research suggests that the best way to provide answers to these questions is to investigate how these decisions are made and in what conditions. \\
\hline
3
& Critically appraising that evidence for its validity (closeness to the truth), impact (size of the effect), and applicability (usefulness in software development practice).
& Survey research is one of the best methods for appraising such hypotheses and collecting information about software development practices. \\
\hline
4
& Integrating the critical appraisal with our software engineering expertise and with our stakeholders’ values and circumstances.
& By combining EBSE with the survey research, we provide a formal way to investigate the current phenomena. \\
\hline
5
& Evaluating our effectiveness and efficiency in executing Steps 1-4 and seeking ways to improve them both for next time.
& Further the evaluation phase of this study, we reassess the benefits of EBSE with survey results and shed some light on future findings. \\
\hline
\end{tabularx}
\caption{Five step used in EBSE}
\label{tab:ebse-correlation}
\end{table}
\end{document}
答案2
除了X
对表格的 3 列中的 2 列使用列类型并去掉tabular
包装器之外,我还将通过去掉所有垂直线和大部分水平线,让表格呈现出更加开放的“外观”。
\documentclass{article}
\usepackage[english]{babel}
\usepackage{tabularx} % for "tabularx" env. and "X" col. type
\usepackage{ragged2e} % for "\RaggedRight" macro
\newcolumntype{L}{>{\RaggedRight}X} % ragged-right appearance
\usepackage{booktabs} % for well-spaced horizontal lines: \toprule, \midrule, ...
\begin{document}
\begin{table}[ht]
\setlength\tabcolsep{4pt} % default: 6pt
\begin{tabularx}{\textwidth}{@{} lLL @{}}
\toprule
Step & EBSE & Correlation with current study \\
\midrule
1 & Converting the need for information (about development and maintenance methods, management procedures etc.) into an answerable question.
& What do software practitioners need to be aware when doing architectural software decisions? \\
\addlinespace
2 & Tracking down the best evidence with which to answer that question.
& Literature research suggests that the best way to provide answers to these questions is to investigate how these decisions are made and in what conditions. \\
\addlinespace
3 & Critically appraising that evidence for its validity (closeness to the truth), impact (size of the effect), and applicability (usefulness in software development practice).
& Survey research is one of the best methods for appraising such hypotheses and collecting information about software development practices. \\
\addlinespace
4 & Integrating the critical appraisal with our software engineering expertise and with our stakeholders’ values and circumstances.
& By combining EBSE with the survey research, we provide a formal way to investigate the current phenomena. \\
\addlinespace
5 & Evaluating our effectiveness and efficiency in executing Steps 1--4 and seeking ways to improve them both for next time.
& Further the evaluation phase of this study, we reassess the benefits of EBSE with survey results and shed some light on future findings. \\
\bottomrule
\end{tabularx}
\caption{Five steps used in EBSE}
\label{tab:ebse-correlation}
\end{table}
\end{document}