方法 1

方法 1

我只知道在 LaTeX 中创建表格的基本概念。我想知道是否可以轻松制作如下所示的表格以及如何制作:

桌子

答案1

首先:

方法 1

除非真的需要,否则我不会真正使用这种方法。但是,您可能会发现您必须这样做。因此:

\documentclass[a4paper,british]{article}
\usepackage[scale=.85]{geometry}% probably you need a larger area than LaTeX defaults to
\usepackage{babel}% get hyphenation etc. right for UK English
\usepackage{array,longtable}% I assume your table may need to break across multiple pages
\usepackage{kantlipsum}% Just for filler text for the example


\begin{document}

\begin{longtable}{|>{\bfseries\sffamily}p{.2\textwidth}|>{\sffamily}p{.75\textwidth}|}
    \hline\endhead
    \hline\endfoot
    Something   &   Great things\\\hline
    Something Else  & One thing\newline Another thing\newline A third thing\\\hline
    A Somewhat Longer Something Else    &   More stuff\\\hline
    \multicolumn{2}{|l|}{\textbf{\textsf{Section N: Section Title}}}\\\hline
    \multicolumn{2}{|p{.95\textwidth}|}{%
      \kant[1]\medskip\par
      \textbf{Key Things}\medskip\par
        \begin{itemize}
            \item Thing 1
            \item Thing 2
            \item A non-Dr.\ Seuss Thing which is here just to make the place look untidy and dispel the myth that Seuss was a true Kantian. There is nothing to see here. Please restore your hat to normality.
            \item Thing 3
        \end{itemize}
      \kant[4]
      }\\\hline
    \multicolumn{2}{|l|}{\textbf{\textsf{Section N+1: Another Exciting Title}}}\\\hline
    \multicolumn{2}{|p{.95\textwidth}|}{%
      \kant[5]}\\
\end{longtable}

\end{document}

带有垂直线的表格

方法 2

根据文档booktabs,这在排版上完全是错误的。使用该软件包一段时间后,我确实发现自己更喜欢它的方法。话虽如此,非 booktabs 默认的间距实际上比 Word 似乎管理的要差一些,所以也许这是问题的一部分。无论如何,这是我将要使用的框架形式实际上更有可能使用(这保留在表格内但改变了呈现方式):

\documentclass[a4paper,british]{article}
\usepackage[scale=.85]{geometry}
\usepackage{babel}
\usepackage{array,longtable,booktabs}% add booktabs
\usepackage{kantlipsum}


\begin{document}

\begin{longtable}{>{\bfseries\sffamily}p{.2\textwidth}>{\sffamily}p{.725\textwidth}}% note the loss of vertical rules throughout
    \toprule\endhead% \toprule, \bottomrule and \midrule replace \hline
    \bottomrule\endfoot
    Something   &   Great things\\\midrule
    Something Else  & One thing\newline Another thing\newline A third thing\\\midrule
    A Somewhat Longer Something Else    &   More stuff\\\midrule
    \multicolumn{2}{l}{\textbf{\textsf{Section N: Section Title}}}\\\midrule
    \multicolumn{2}{p{.95\textwidth}}{%
      \kant[1]\medskip\par
      \textbf{\sffamily Key Things}\par
        \begin{itemize}
            \item Thing 1
            \item Thing 2
            \item A non-Dr.\ Seuss Thing which is here just to make the place look untidy and dispel the myth that Seuss was a true Kantian. There is nothing to see here. Please restore your hat to normality.
            \item Thing 3
        \end{itemize}
      \kant[4]}\\\midrule
    \multicolumn{2}{l}{\textbf{\textsf{Section N+1: Another Exciting Title}}}\\\midrule
    \multicolumn{2}{p{.95\textwidth}}{%
      \kant[5]}\\
\end{longtable}

\end{document}

当然,您的审美观念是否偏爱以下内容,则由您自行判断:

带书签的桌子

相关内容