我的桌子有些问题。
我设法从这篇文章中汲取了一些想法:制作表格中的句子列表正常中断并创建了这个 longtable(未使用 tabularx)。它运行正常……还行。
以下是我希望获得帮助的问题:
- 第一列中的月份数字右对齐。我希望它们居中。
- “第二列”中的单词未正确对齐。
- 在第二个屏幕截图中,第四列的句子之间有很大的间隙。这是因为第一句话(“我告诉他,等等”)很短。当然,我可以手动修复它,但有没有办法让这个调整更自动化?
谢谢。
% PREAMBLE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[oneside,centered,twocolumn]{book}
%\documentclass[a4paper,oneside,centered,twocolumn]{book}
\special{papersize=215.9mm,279.4mm}
%\usepackage[top=3cm, bottom=3.2cm, left=2.5cm, right=2.5cm]{geometry}
\usepackage[english]{babel}
\usepackage{tocloft} % Customization of TOC LOF LOT
\usepackage[table,xcdraw]{xcolor} % For shading in tables
\usepackage{pdfcolmk}
\usepackage{multirow}
%\usepackage{lscape} %to put the long table of dwellings sideways
%\usepackage{wallpaper}
\usepackage{showframe}
\usepackage{textcomp}
\usepackage{pdfpages}
\usepackage{ltablex}
\usepackage{nicefrac} % to write fractions
\usepackage{attrib} % For source of quotations
\usepackage{lettrine} % For NewThought formatting
\usepackage{array} % To define width of columns in long table
\usepackage{booktabs} % Nicer spacing in columns
\usepackage{siunitx} % To write Celsius, etc.
\usepackage{enumitem} % To create item lists
\usepackage{caption} % To change way captions are labelled
\usepackage{scrextend}
\usepackage{threeparttable} % For table notes + To allow footnote material to stay with the tabular environment
\usepackage{etoolbox} % To make table footnote font smaller
\usepackage{threeparttablex}
\appto\TPTnoteSettings{\footnotesize}
\usepackage{textcomp} % For Numero symbol
\usepackage[T1]{fontenc}
\usepackage{titlesec,color}
\usepackage{blindtext}
\usepackage[linguistics,edges]{forest}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{titling}
\usepackage{fontspec}
\usepackage{newpxtext} % Font for document instead of obsolete Palatino
\usepackage{hyperref} % Hyperlinks
\begin{document}
{\small
\onecolumn\begin{longtable}
{
>{\raggedright\arraybackslash}p{1.2cm}
>{\raggedright\arraybackslash}p{4.5cm}
>{\raggedright\arraybackslash}p{2cm}
>{\raggedright\arraybackslash}p{7.15cm}
}
\caption{This is a test.}\label{test} \\
\toprule
Month number & Months in the languages of the Five Empires & Date of the month & Deity or group celebrating the event, location, name of the
celebration, and notes \\
\midrule
\endfirsthead
\caption*{\autoref{test} (\textit{Continued})} \\
\toprule
Month & Months in the languages of the Five Empires & Date & Events \\
\midrule
\endhead
1 &\begin{tabular}[t]{l}
French: Bonjour\\
German: Hallo\\
French: Bonjour\\
German: Hallo\\
\end{tabular}
& 1st & Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. \\
& \begin{tabular}[t]{l}
French: Bonjour\
\end{tabular}
& '' & What of it, if some old hunks of a sea-captain orders me to get a broom and sweep down the decks? \\
&& '' & Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. \\
&& '' & What of it, if some old hunks of a sea-captain orders me to get a broom and sweep down the decks? \\
&& '' & Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. \\
&& 15th-16th & What of it, if some old hunks of a sea-captain orders me to get a broom and sweep down the decks? \\
&& 23rd & But no more of this blubbering now, we are going a-whaling, and there is plenty of that yet to come. Let us scrape the ice from our frosted feet, and see what sort of a place this Spouter may be. \\
2 &\begin{tabular}[t]{l}
French: Bonjour\\
German: Hallo\\
French: Bonjour\\
German: Hallo\\
German: Hallo\\
\end{tabular} & 2nd & Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. \\
&& '' & Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. \\
&& '' & What of it, if some old hunks of a sea-captain orders me to get a broom and sweep down the decks? \\
&& '' & Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. \\
&& 23rd & What of it, if some old hunks of a sea-captain orders me to get a broom and sweep down the decks? \\
&& 28th & But no more of this blubbering now, we are going a-whaling, and there is plenty of that yet to come. Let us scrape the ice from our frosted feet, and see what sort of a place this Spouter may be. \\
3 &\begin{tabular}[t]{l}
French: Bonjour\\
German: Hallo\\
French: Bonjour\\
German: Hallo\\
German: Hallo\\
\end{tabular} & 4th & I told him that I never liked to sleep two in a bed; \\
&& '' & Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. \\
&& '' & What of it, if some old hunks of a sea-captain orders me to get a broom and sweep down the decks? \\
&& '' & Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. \\
&& 7th & What of it, if some old hunks of a sea-captain orders me to get a broom and sweep down the decks? \\
&& 31st & But no more of this blubbering now, we are going a-whaling, and there is plenty of that yet to come. Let us scrape the ice from our frosted feet, and see what sort of a place this Spouter may be. \\
\bottomrule
% \insertTableNotes
\end{longtable}\twocolumn
}
%\end{ThreePartTable}
\end{document}
答案1
在下面的 MWE 中,我替换了>{\raggedright\arraybackslash}p{1.2cm}
in>{\centering\arraybackslash}p{1.2cm}
来解决第一个问题。为了消除第二个和第三个问题,我使用了\multirow
。
\documentclass[oneside,twocolumn]{book}
\special{papersize=215.9mm,279.4mm}
\usepackage[top=3cm, bottom=3.2cm, left=2.5cm, right=2.5cm]{geometry}
\usepackage{showframe}
\usepackage{ltablex}
\usepackage{array}
\usepackage{booktabs}
\usepackage{hyperref}
\usepackage{multirow}
\begin{document}
{\small
\onecolumn\begin{longtable}
{
>{\centering\arraybackslash}p{1.2cm}
>{\raggedright\arraybackslash}p{4.5cm}
>{\raggedright\arraybackslash}p{2cm}
>{\raggedright\arraybackslash}p{7.1cm}
}
\caption{This is a test.}\label{test} \\
\toprule
Month number & Months in the languages of the Five Empires & Date of the month & Deity or group celebrating the event, location, name of the
celebration, and notes \\
\midrule
\endfirsthead
\caption*{\autoref{test} (\textit{Continued})} \\
\toprule
Month & Months in the languages of the Five Empires & Date & Events \\
\midrule
\endhead
1 &\multirow{5}{=}{%
French: Bonjour\\
German: Hallo\\
French: Bonjour\\
German: Hallo\\
French: Bonjour
}
& 1st & Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. \\
& & '' & What of it, if some old hunks of a sea-captain orders me to get a broom and sweep down the decks? \\
&& '' & Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. \\
&& '' & What of it, if some old hunks of a sea-captain orders me to get a broom and sweep down the decks? \\
&& '' & Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. \\
&& 15th-16th & What of it, if some old hunks of a sea-captain orders me to get a broom and sweep down the decks? \\
&& 23rd & But no more of this blubbering now, we are going a-whaling, and there is plenty of that yet to come. Let us scrape the ice from our frosted feet, and see what sort of a place this Spouter may be. \\
2 &\multirow{5}{=}{%
French: Bonjour\\
German: Hallo\\
French: Bonjour\\
German: Hallo\\
German: Hallo\\
} & 2nd & Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. \\
&& '' & Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. \\
&& '' & What of it, if some old hunks of a sea-captain orders me to get a broom and sweep down the decks? \\
&& '' & Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. \\
&& 23rd & What of it, if some old hunks of a sea-captain orders me to get a broom and sweep down the decks? \\
&& 28th & But no more of this blubbering now, we are going a-whaling, and there is plenty of that yet to come. Let us scrape the ice from our frosted feet, and see what sort of a place this Spouter may be. \\
3 &\multirow{5}{=}{%
French: Bonjour\\
German: Hallo\\
French: Bonjour\\
German: Hallo\\
German: Hallo\\
} & 4th & I told him that I never liked to sleep two in a bed; \\
&& '' & Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. \\
&& '' & What of it, if some old hunks of a sea-captain orders me to get a broom and sweep down the decks? \\
&& '' & Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. \\
&& 7th & What of it, if some old hunks of a sea-captain orders me to get a broom and sweep down the decks? \\
&& 31st & But no more of this blubbering now, we are going a-whaling, and there is plenty of that yet to come. Let us scrape the ice from our frosted feet, and see what sort of a place this Spouter may be. \\
\bottomrule
\end{longtable}\twocolumn
}
\end{document}