我有一张包含以下代码的表格:
Table \ref{tab:2} lists all the variables in the model:
\begin{table}[htbp]
\caption{Variable Descriptions}
\label{tab:2}
\begin{center}
\begin{tabular}{|c|c|}\hline
Variables & Descriptions\\\hline
\textit{ln(wage)} & log of wage\\
\textit{educ} & years of education\\
\textit{black} & 1 if black and 0 if not\\
\textit{hisp} & 1 if hispanic and 0 if not\\
\textit{exper} & years of experience\\
\textit{exper$^{2}$} & years of experience squared\\
\textit{married} & 1 if married and 0 if not\\
\textit{union} & 1 if belongs to a union and 0 if not\\\hline
\end{tabular}
\end{center}
\end{table}
我想知道是否可以有一张更漂亮、更专业的桌子。
以下是我在序言中的内容:
\documentclass[11pt,reqno]{amsart}
% Packages
\usepackage{graphicx}
\usepackage{amssymb,amsthm}
\usepackage{amsmath}
\usepackage{dcolumn,caption}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
%% define a few struts
%% (from code by Claudio Beccari in TeX and TUG News, Vol. 2, 1993)
\newcommand\Tstrut{\rule{0pt}{2.9ex}} % "top" strut
\newcommand\Bstrut{\rule[-1.2ex]{0pt}{0pt}} % "bottom" strut
\makeatletter
\newcommand*\rel@kern[1]{\kern#1\dimexpr\macc@kerna}
\newcommand*\widebar[1]{%
\begingroup
\def\mathaccent##1##2{%
\rel@kern{0.8}%
\overline{\rel@kern{-0.8}\macc@nucleus\rel@kern{0.2}}%
\rel@kern{-0.2}%
}%
\macc@depth\@ne
\let\math@bgroup\@empty \let\math@egroup\macc@set@skewchar
\mathsurround\z@ \frozen@everymath{\mathgroup\macc@group\relax}%
\macc@set@skewchar\relax
\let\mathaccentV\macc@nested@a
\macc@nested@a\relax111{#1}%
\endgroup
}
\makeatother
\usepackage{cite}
%\usepackage{natbib}
%\bibpunct{(}{)}{;}{;}{,}{,}
\usepackage{xr-hyper}
\usepackage[
colorlinks=true,
citecolor=blue,
urlcolor=blue,
linkcolor=blue
]{hyperref}
\usepackage{bm}
\usepackage{fullpage}
\usepackage{ amssymb }
\usepackage{caption}
\captionsetup{labelfont=normalfont,
labelsep=colon}
\usepackage{mathabx}
\usepackage{subfig}
\usepackage{array,booktabs}
\makeatletter
\def\subsection{\@startsection{subsection}{1}%
\z@{.5\linespacing\@plus.7\linespacing}{-.5em}%
{\normalfont\itshape}}
\def\@sect#1#2#3#4#5#6[#7]#8{%
\edef\@toclevel{\ifnum#2=\@m 0\else\number#2\fi}%
\ifnum #2>\c@secnumdepth \let\@secnumber\@empty
\else \@xp\let\@xp\@secnumber\csname the#1\endcsname\fi
\@tempskipa #5\relax
\ifnum #2>\c@secnumdepth
\let\@svsec\@empty
\else
\refstepcounter{#1}%
\edef\@secnumpunct{%
\ifdim\@tempskipa>\z@ % not a run-in section heading
\@ifnotempty{#8}{.\@nx\enspace}%
\else
\@ifempty{#8}{.}{.\@nx\enspace}%
\fi
}%
\@ifempty{#8}{%
\ifnum #2=\tw@ \def\@secnumfont{\bfseries}\fi}{}%
\protected@edef\@svsec{%
\ifnum#2<\@m
\@ifundefined{#1name}{}{%
\ignorespaces\csname #1name\endcsname\space
}%
\fi
\@seccntformat{#1}%
}%
\fi
\ifdim \@tempskipa>\z@ % then this is not a run-in section heading
\begingroup #6\relax
\@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty\@M #8\par}%
\endgroup
\ifnum#2>\@m \else \@tocwrite{#1}{#8}\fi
\else
\def\@svsechd{#6\hskip #3\@svsec
\@ifnotempty{#8}{\ignorespaces#8\unskip
%\@addpunct.
}%
\ifnum#2>\@m \else \@tocwrite{#1}{#8}\fi
}%
\fi
\global\@nobreaktrue
\@xsect{#5}}
\makeatother
\pagestyle{plain}
\setlength{\parskip}{\baselineskip}
\setlength{\parindent}{12pt}
\setcounter{secnumdepth}{2}
\allowdisplaybreaks[4]
% Commenting/debugging
\let\IG\iffalse
\let\ENDIG\fi
%% Shortcuts
\newcommand{\td}[2]{\dfrac{d #1}{d #2}}
\newcommand{\std}[2]{\dfrac{d^2 #1}{d {#2}^2}}
\newcommand{\ctd}[3]{\dfrac{d^2 #1}{d #2 d #3}}
\newcommand{\pd}[2]{\dfrac{\partial #1}{\partial #2}}
\newcommand{\spd}[2]{\dfrac{\partial^2 #1}{\partial {#2}^2}}
\newcommand{\cpd}[3]{\dfrac{\partial^2 #1}{\partial #2 \partial #3}}
\newcommand{\pdi}[2]{\partial #1/\partial #2}
\newcommand{\LR}{\Leftrightarrow}
\newcommand{\Lg}{\mathcal{L}}
\newcommand{\half}{\tfrac{1}{2}}
\newcommand{\eqp}{\phantom{=}}
\newcommand{\eqs}{\buildrel s \over =}
\newcommand{\me}{\mathrm{e}}
%begin codes for footnotes (symbols)
\makeatletter
\newcommand*{\myfnsymbolsingle}[1]{%
\ensuremath{%
\ifcase#1% 0
\or % 1
\dagger%
\or % 2
1
\or % 3
2
\or % 4
3
\or % 5
4
\else % >= 6
\@ctrerr
\fi
}%
}
\makeatother
\newcommand*{\myfnsymbol}[1]{%
\myfnsymbolsingle{\value{#1}}%
}
% remove upper boundary by multiplying the symbols if needed
\usepackage{alphalph}
\newalphalph{\myfnsymbolmult}[mult]{\myfnsymbolsingle}{}
\renewcommand*{\thefootnote}{%
\myfnsymbolmult{\value{footnote}}%
}
%end codes for footnotes (symbols)
答案1
booktabs
建议。请参阅手册以了解更多提示。
\documentclass{article}
\usepackage{array,booktabs}
\begin{document}
Table \ref{tab:2} lists all the variables in the model.
\begin{table}
\caption{Variable Descriptions}
\label{tab:2}
\centering
\begin{tabular}{>{\itshape}ll}
\toprule
\upshape Variables & Descriptions\\\midrule
ln(wage) & log of wage\\
educ & years of education\\
black & 1 if black and 0 if not\\
hisp & 1 if hispanic and 0 if not\\
exper & years of experience\\
exper$^{2$} & years of experience squared\\
married & 1 if married and 0 if not\\
union & 1 if belongs to a union and 0 if not\\\bottomrule
\end{tabular}
\end{table}
\end{document}
如果您希望表格内联,如其前面的冒号所示,则根本不要使用。您可以使用包或类似包table
获取标题。caption