我和這個 MWE 有一張桌子。
\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{booktabs,makecell}
\begin{document}
\begin{table}[htb]
\captionsetup{justification=centering}
\caption{}
\makegapedcells
\centering
\begin{tabular}{ccc}
\toprule[2pt]
\thead{Osservabile} & \thead{Rappresentazione \\ delle coordinate} & \thead{Rappresentazione \\ degli impulsi} \\
\midrule
Funzione d'onda & $\Psi(\bar{r},t)$ & $\Xi(\bar{p},t)$ \\
$\hat{x}$ & $x$ & $+i\hslash\dfrac{\partial}{\partial p_x}\\
$\hat{p}$ & $-i\hslash\dfrac{\partial}{\partial x}$ & $p_x$\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
但我有很多錯誤:
This is XeTeX, Version 3.14159265-2.6-0.99992 (TeX Live 2015) (preloaded format=xelatex 2019.8.13) 13 AUG 2019 21:09
entering extended mode
\write18 enabled.
%&-line parsing enabled.
**main.tex
(./main.tex
LaTeX2e <2015/10/01> patch level 1
Babel <3.9m> and hyphenation patterns for 79 languages loaded.
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/size12.clo
File: size12.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/local/texlive/2015/texmf-dist/tex/latex/amsmath/amsmath.sty
Package: amsmath 2013/01/14 v2.14 AMS math features
\@mathmargin=\skip43
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2015/texmf-dist/tex/latex/amsmath/amstext.sty
Package: amstext 2000/06/29 v2.01
(/usr/local/texlive/2015/texmf-dist/tex/latex/amsmath/amsgen.sty
File: amsgen.sty 1999/11/30 v2.0
\@emptytoks=\toks14
\ex@=\dimen103
))
(/usr/local/texlive/2015/texmf-dist/tex/latex/amsmath/amsbsy.sty
Package: amsbsy 1999/11/29 v1.2d
\pmbraise@=\dimen104
)
(/usr/local/texlive/2015/texmf-dist/tex/latex/amsmath/amsopn.sty
Package: amsopn 1999/12/14 v2.01 operator names
)
\inf@bad=\count87
LaTeX Info: Redefining \frac on input line 210.
\uproot@=\count88
\leftroot@=\count89
LaTeX Info: Redefining \overline on input line 306.
\classnum@=\count90
\DOTSCASE@=\count91
LaTeX Info: Redefining \ldots on input line 378.
LaTeX Info: Redefining \dots on input line 381.
LaTeX Info: Redefining \cdots on input line 466.
\Mathstrutbox@=\box26
\strutbox@=\box27
\big@size=\dimen105
LaTeX Font Info: Redeclaring font encoding OML on input line 566.
LaTeX Font Info: Redeclaring font encoding OMS on input line 567.
\macc@depth=\count92
\c@MaxMatrixCols=\count93
\dotsspace@=\muskip10
\c@parentequation=\count94
\dspbrk@lvl=\count95
\tag@help=\toks15
\row@=\count96
\column@=\count97
\maxfields@=\count98
\andhelp@=\toks16
\eqnshift@=\dimen106
\alignsep@=\dimen107
\tagshift@=\dimen108
\tagwidth@=\dimen109
\totwidth@=\dimen110
\lineht@=\dimen111
\@envbody=\toks17
\multlinegap=\skip44
\multlinetaggap=\skip45
\mathdisplay@stack=\toks18
LaTeX Info: Redefining \[ on input line 2665.
LaTeX Info: Redefining \] on input line 2666.
)
(/usr/local/texlive/2015/texmf-dist/tex/latex/amsfonts/amssymb.sty
Package: amssymb 2013/01/14 v3.01 AMS font symbols
(/usr/local/texlive/2015/texmf-dist/tex/latex/amsfonts/amsfonts.sty
Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support
\symAMSa=\mathgroup4
\symAMSb=\mathgroup5
LaTeX Font Info: Overwriting math alphabet `\mathfrak' in version `bold'
(Font) U/euf/m/n --> U/euf/b/n on input line 106.
))
(/usr/local/texlive/2015/texmf-dist/tex/latex/booktabs/booktabs.sty
Package: booktabs 2005/04/14 v1.61803 publication quality tables
\heavyrulewidth=\dimen112
\lightrulewidth=\dimen113
\cmidrulewidth=\dimen114
\belowrulesep=\dimen115
\belowbottomsep=\dimen116
\aboverulesep=\dimen117
\abovetopsep=\dimen118
\cmidrulesep=\dimen119
\cmidrulekern=\dimen120
\defaultaddspace=\dimen121
\@cmidla=\count99
\@cmidlb=\count100
\@aboverulesep=\dimen122
\@belowrulesep=\dimen123
\@thisruleclass=\count101
\@lastruleclass=\count102
\@thisrulewidth=\dimen124
)
(/usr/local/texlive/2015/texmf-dist/tex/latex/makecell/makecell.sty
Package: makecell 2009/08/03 V0.1e Managing of Tab Column Heads and Cells
(/usr/local/texlive/2015/texmf-dist/tex/latex/tools/array.sty
Package: array 2014/10/28 v2.4c Tabular extension package (FMi)
\col@sep=\dimen125
\extrarowheight=\dimen126
\NC@list=\toks19
\extratabsurround=\skip46
\backup@length=\skip47
)
\rotheadsize=\dimen127
\c@nlinenum=\count103
\TeXr@lab=\toks20
)
(./2f0cb724-1acb-4cf0-bb5a-f9c31b3368ff.aux)
\openout1 = `2f0cb724-1acb-4cf0-bb5a-f9c31b3368ff.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
! Undefined control sequence.
l.6 \captionsetup
{justification=centering}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
LaTeX Font Info: Try loading font information for U+msa on input line 10.
(/usr/local/texlive/2015/texmf-dist/tex/latex/amsfonts/umsa.fd
File: umsa.fd 2013/01/14 v3.01 AMS symbols A
)
LaTeX Font Info: Try loading font information for U+msb on input line 10.
(/usr/local/texlive/2015/texmf-dist/tex/latex/amsfonts/umsb.fd
File: umsb.fd 2013/01/14 v3.01 AMS symbols B
)
! Undefined control sequence.
\mcell@agape #1->\setbox \z@ \hbox {#1}\mcell@MB@
\z@ \mcell@MBjot \null \mc...
l.10 \begin{tabular}{ccc}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
\mcell@agape ...x {#1}\mcell@MB@ \z@ \mcell@MBjot
\null \mcell@left \box \z@...
l.10 \begin{tabular}{ccc}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
\mcell@agape #1->\setbox \z@ \hbox {#1}\mcell@MB@
\z@ \mcell@MBjot \null \mc...
l.10 \begin{tabular}{ccc}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
\mcell@agape ...x {#1}\mcell@MB@ \z@ \mcell@MBjot
\null \mcell@left \box \z@...
l.10 \begin{tabular}{ccc}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
\mcell@agape #1->\setbox \z@ \hbox {#1}\mcell@MB@
\z@ \mcell@MBjot \null \mc...
l.10 \begin{tabular}{ccc}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
\mcell@agape ...x {#1}\mcell@MB@ \z@ \mcell@MBjot
\null \mcell@left \box \z@...
l.10 \begin{tabular}{ccc}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Missing number, treated as zero.
<to be read again>
\hbox
l.12 \thead{Osservabile} &
\thead{Rappresentazione \\ delle coordinate} &...
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Illegal unit of measure (pt inserted).
<to be read again>
\hbox
l.12 \thead{Osservabile} &
\thead{Rappresentazione \\ delle coordinate} &...
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
! Missing number, treated as zero.
<to be read again>
\hbox
l.12 ...d{Rappresentazione \\ delle coordinate} &
\thead{Rappresentazi...
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Illegal unit of measure (pt inserted).
<to be read again>
\hbox
l.12 ...d{Rappresentazione \\ delle coordinate} &
\thead{Rappresentazi...
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
! Missing number, treated as zero.
<to be read again>
\hbox
l.13 \midrule
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Illegal unit of measure (pt inserted).
<to be read again>
\hbox
l.13 \midrule
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
! Missing number, treated as zero.
<to be read again>
\hbox
l.14 Funzione d'onda &
$\Psi(\bar{r},t)$ & $\Xi(\bar{p},t)$ \\
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Illegal unit of measure (pt inserted).
<to be read again>
\hbox
l.14 Funzione d'onda &
$\Psi(\bar{r},t)$ & $\Xi(\bar{p},t)$ \\
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
! Missing number, treated as zero.
<to be read again>
\hbox
l.14 Funzione d'onda & $\Psi(\bar{r},t)$ &
$\Xi(\bar{p},t)$ \\
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Illegal unit of measure (pt inserted).
<to be read again>
\hbox
l.14 Funzione d'onda & $\Psi(\bar{r},t)$ &
$\Xi(\bar{p},t)$ \\
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
! Missing number, treated as zero.
<to be read again>
\hbox
l.15 $
\hat{x}$ & $x$ & $+i\hslash\dfrac{\partial}{\partial p_x}\\
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Illegal unit of measure (pt inserted).
<to be read again>
\hbox
l.15 $
\hat{x}$ & $x$ & $+i\hslash\dfrac{\partial}{\partial p_x}\\
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
! Missing number, treated as zero.
<to be read again>
\hbox
l.15 $\hat{x}$ &
$x$ & $+i\hslash\dfrac{\partial}{\partial p_x}\\
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Illegal unit of measure (pt inserted).
<to be read again>
\hbox
l.15 $\hat{x}$ &
$x$ & $+i\hslash\dfrac{\partial}{\partial p_x}\\
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
! Missing number, treated as zero.
<to be read again>
\hbox
l.15 $\hat{x}$ & $x$ &
$+i\hslash\dfrac{\partial}{\partial p_x}\\
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Illegal unit of measure (pt inserted).
<to be read again>
\hbox
l.15 $\hat{x}$ & $x$ &
$+i\hslash\dfrac{\partial}{\partial p_x}\\
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
! Missing $ inserted.
<inserted text>
$
l.16 $
\hat{p}$ & $-i\hslash\dfrac{\partial}{\partial x}$ & $p_x$\\
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
! Missing number, treated as zero.
<to be read again>
\hbox
l.16 $
\hat{p}$ & $-i\hslash\dfrac{\partial}{\partial x}$ & $p_x$\\
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Illegal unit of measure (pt inserted).
<to be read again>
\hbox
l.16 $
\hat{p}$ & $-i\hslash\dfrac{\partial}{\partial x}$ & $p_x$\\
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
! Missing number, treated as zero.
<to be read again>
\hbox
l.16 $\hat{p}$ &
$-i\hslash\dfrac{\partial}{\partial x}$ & $p_x$\\
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Illegal unit of measure (pt inserted).
<to be read again>
\hbox
l.16 $\hat{p}$ &
$-i\hslash\dfrac{\partial}{\partial x}$ & $p_x$\\
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
! Missing number, treated as zero.
<to be read again>
\hbox
l.16 ... $-i\hslash\dfrac{\partial}{\partial x}$ &
$p_x$\\
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Illegal unit of measure (pt inserted).
<to be read again>
\hbox
l.16 ... $-i\hslash\dfrac{\partial}{\partial x}$ &
$p_x$\\
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
! Missing number, treated as zero.
<to be read again>
\hbox
l.17 \bottomrule
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Illegal unit of measure (pt inserted).
<to be read again>
\hbox
l.17 \bottomrule
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
[1
] (./2f0cb724-1acb-4cf0-bb5a-f9c31b3368ff.aux) )
Here is how much of TeX's memory you used:
1373 strings out of 493668
15603 string characters out of 6145663
69683 words of memory out of 5000000
4785 multiletter control sequences out of 15000+600000
9984 words of font info for 40 fonts, out of 8000000 for 9000
1328 hyphenation exceptions out of 8191
27i,16n,26p,230b,321s stack positions out of 5000i,500n,10000p,200000b,80000s
Output written on 2f0cb724-1acb-4cf0-bb5a-f9c31b3368ff.pdf (1 page).
PS:顏色和其他包都包含在我的長序言中。
有關的:漂亮桌子的一些調整
答案1
好吧,快速修復如下:
\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{booktabs,makecell}
\usepackage{caption} % <================================================
\begin{document}
\begin{table}[htb]
\captionsetup{justification=centering}
\caption{test}
%\makegapedcells % <====================================================
\centering
\begin{tabular}{ccc}
\toprule[2pt]
\thead{Osservabile} & \thead{Rappresentazione \\ delle coordinate} & \thead{Rappresentazione \\ degli impulsi} \\
\midrule
Funzione d'onda & $\Psi(\bar{r},t)$ & $\Xi(\bar{p},t)$ \\
$\hat{x}$ & $x$ & $+i\hslash\dfrac{\partial}{\partial p_x}$\\ % <=======
$\hat{p}$ & $-i\hslash\dfrac{\partial}{\partial x}$ & $p_x$\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
也許你可以解釋一下,什麼指令\makegapedcells
該做什麼?
我添加了丟失的包,並在第二個表行的末尾caption
添加了丟失的包...$
這是我的結果:
我用目前的 MiKTeX 2.9 編譯並pdflatex
......