我已经删除了此表中的一列,但当我删除列中的最后一个值时,整个表就乱了。有人知道原因吗?我应该怎么做?
其次,我想在表格前添加标题和一些文本。但是,由于我的知识有限,我不知道该怎么做。
非常感谢您的帮助!
\documentclass[a4paper]{article}
\usepackage[left=2.50cm, right=2.50cm, top=4.00cm, bottom=3.00cm]{geometry}
\usepackage{array, booktabs, multirow}
\usepackage{nicematrix}
\begin{document}
\begin{table}
\centering
\begin{NiceTabular}{@{}llcccc@{}}
\toprule \toprule
\Block{}<\bfseries>{Admission \\requirements \\ for Economics \\(MSc)} &
\Block{}<\bfseries>{Courses \\ completed} &
\Block{}<\bfseries>{Date of \\ completion} &
\textbf{ECTS} &
\Block{}<\bfseries>{Degree program \\ (B.A. Economics) }
\\ \midrule
\Block{4-1}{Microeconomics \\ (30 ECTS)}& Microeconomics 1 & 22.11.2019 & 10 & UiO \\
& Welfare Economics & 15.02.2013 &7& 12 & SDU \\
& Strategy and Markets & 01.07.2015 & 15 & SDU \\
& Behavioral Economics & 01.07.2015 & 15 & SDU \\ \midrule
\Block{2-1}{Macroeconomics \\(30 ECTS)} & Macroeconomics 1 & 22.04.2014 & 7.5& UiO \\
& Macroeconomics 2 & 15.02.2013 & 12 & SDU \\ \midrule
\Block{}{Mathematics \\(30 ECTS)} & Mathematics I & 22.04.2014 & 7.5& UiO \\ \midrule
\Block{4-1}{Interdiciplinary \\ (30 ECTS)}& International Economics & 22.11.2019 & 10 & SDU \\
& Economics of European Integration & 15.02.2013 & 12 & SDU \\
& Applied Economics & 01.07.2015 & 15 & SDU \\ \midrule
\Block{2-1}{Statistics \\ (30 ECTS)} & Statistics 1 & 22.04.2014 & 7.5& UiO \\
& Regression Analysis & 15.02.2013 & 12 & SDU \\
\midrule \bottomrule
\end{NiceTabular}
\caption{\label{tab:table-name} The following table...}
\end{table}
\end{document}
答案1
您忘记删除“福利经济学”行中的条目,也忘记删除相应的列规范。
请记住,NiceTabular
通常需要多次运行 LaTeX 才能稳定下来。
这是一个不太令人困惑的输入,其中我也实现了黄金法则绝不使用双重规则。
表格上方的文字可以正常输入,如下代码所示。
\documentclass[a4paper]{article}
\usepackage[left=2.50cm, right=2.50cm, top=4.00cm, bottom=3.00cm]{geometry}
\usepackage{array, booktabs, multirow}
\usepackage{nicematrix}
\begin{document}
\begin{table}
Here I add some text before the table, long enough to split across lines;
it should be enough to add some more words, hopefully.
\bigskip
\centering
\begin{NiceTabular}{@{}llccc@{}}
\toprule
\Block{}<\bfseries>{Admission \\requirements \\ for Economics \\(MSc)} &
\Block{}<\bfseries>{Courses \\ completed} &
\Block{}<\bfseries>{Date of \\ completion} &
\textbf{ECTS} &
\Block{}<\bfseries>{Degree program \\ (B.A. Economics)} \\
\midrule
\Block{4-1}{Microeconomics \\ (30 ECTS)}
& Microeconomics 1 & 22.11.2019 & 10 & UiO \\
& Welfare Economics & 15.02.2013 & 12 & SDU \\
& Strategy and Markets & 01.07.2015 & 15 & SDU \\
& Behavioral Economics & 01.07.2015 & 15 & SDU \\
\midrule
\Block{2-1}{Macroeconomics \\(30 ECTS)}
& Macroeconomics 1 & 22.04.2014 & 7.5 & UiO \\
& Macroeconomics 2 & 15.02.2013 & 12 & SDU \\
\midrule
\Block{}{Mathematics \\(30 ECTS)}
& Mathematics I & 22.04.2014 & 7.5 & UiO \\
\midrule
\Block{3-1}{Interdisciplinary \\ (30 ECTS)}
& International Economics & 22.11.2019 & 10 & SDU \\
& Economics of European Integration & 15.02.2013 & 12 & SDU \\
& Applied Economics & 01.07.2015 & 15 & SDU \\
\midrule
\Block{2-1}{Statistics \\ (30 ECTS)}
& Statistics 1 & 22.04.2014 & 7.5 & UiO \\
& Regression Analysis & 15.02.2013 & 12 & SDU \\
\bottomrule
\end{NiceTabular}
\caption{\label{tab:table-name}The table shows something}
\end{table}
\end{document}