如何在表格中输入长段落而不超出文档范围

如何在表格中输入长段落而不超出文档范围

下面的图片显示了文本的显示方式,我需要添加更多文本,基本上是长描述

在此处输入图片描述

\documentclass[12pt]{article}
\usepackage{fontspec}
\setmainfont{CharisSIL}
\setlength{\parindent}{0pt}
\usepackage[top=1in,bottom=1in,right=0.5in,left=0.5in]{geometry}
\begin{document}
\begin{table}
    \centering
    \begin{tabular}{|c|c|c|}
        \hline
        Speaker 1 & Speaker 2 & Speaker 3\\
        \hline
        Central Gujarat & North Gujarat & East Gujarat\\
        The first speaker is talking about the language in a more constricted manner & The second speaker does not really care about the pronunciation but you can see the variation in the vowels & WHat about the third speaker to make sure that her rules are nor interchanging with someone else\\
        \hline  
    \end{tabular}
\end{table}
\end{document}

我该如何修复这个问题并在列中添加更多文本?此外,我如何根据文本宽度调整整个内容?

答案1

具有指定宽度的列的标准表格环境 用作p{width}列说明符。

在此处输入图片描述

\documentclass{article}
\setlength{\parindent}{0pt}
\begin{document}
    \begin{tabular}{|p{3cm}|p{3cm}|p{3cm}|}
        \hline
        Speaker 1 & Speaker 2 & Speaker 3\\
        \hline
        Central Gujarat & North Gujarat & East Gujarat\\
        The first speaker is talking about the language in a more constricted manner & The second speaker does not really care about the pronunciation but you can see the variation in the vowels & What about the third speaker to make sure that her rules are nor interchanging with someone else\\
        \hline  
    \end{tabular}
\end{document}

tabularx 环境具有最大宽度的列,自动扩展 加载tabularx包,添加表格的宽度(可能\textwidth)并使用列说明符X

在此处输入图片描述

\documentclass{article}
\usepackage{tabularx}
\setlength{\parindent}{0pt}
\begin{document}
    \begin{tabularx}{\textwidth}{|X|X|X|}
        \hline
        Speaker 1 & Speaker 2 & Speaker 3\\
        \hline
        Central Gujarat & North Gujarat & East Gujarat\\
        The first speaker is talking about the language in a more constricted manner & The second speaker does not really care about the pronunciation but you can see the variation in the vowels & What about the third speaker to make sure that her rules are nor interchanging with someone else\\
        \hline  
    \end{tabularx}
\end{document}

您可以使用 将标题居中\multicolumn{1}{c}{...}

在此处输入图片描述

\documentclass{article}
\usepackage{tabularx}
\setlength{\parindent}{0pt}
\begin{document}
    \begin{tabularx}{\textwidth}{|X|X|X|}
        \hline
        \multicolumn{1}{|c|}{Speaker 1} &
        \multicolumn{1}{c|}{Speaker 2} &
        \multicolumn{1}{c|}{Speaker 3}\\
        \hline
        Central Gujarat & North Gujarat & East Gujarat\\
        The first speaker is talking about the language in a more constricted manner & The second speaker does not really care about the pronunciation but you can see the variation in the vowels & What about the third speaker to make sure that her rules are nor interchanging with someone else\\
        \hline  
    \end{tabularx}
\end{document}

相关内容