我的表格出了问题,因为第二个单元格的内容与顶部单元格重叠。我假设我必须扩大单元格的宽度或将单元格的内容向下对齐,但我不知道该怎么做。谢谢你的帮助。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{amsmath, amsfonts, empheq}
\usepackage{caption}
\usepackage[a4paper]{geometry}
\usepackage{tabularx}
\begin{document}
\begin{table}[ht]
\centering
\begin{adjustbox}{width=.8\textwidth}
\begin{tabular}[b]{clll}
\hline
Performance Variables \\
\hline
$\begin{aligned}
Annual Return &= \frac{Stock\,Price_t\,-\,Stock\,Price_{t-1}}{Stock\,Price_{t-1}} \\[20pt]
Tobin's\,Q &= \frac{Equity\,Market\,Value\,+\,Liabilities\,Book\,Value}{Equity\,Book\,Value \,+\,Liabilities\,Book\,Value}\\[20pt]
ROA &= \frac{Net\,Income}{Total\,Assets} \\[20pt]
\hline
\end{aligned}$
\end{tabular}
\end{adjustbox}
\end{table}
\end{document}
答案1
这是一个非常简单的解决方案booktabs
,它在其规则周围添加了一些(可调整的)垂直填充,并有一个addlinespace
命令。我自由地将分数参数置于文本模式,以获得正确的字母间距(否则,字母间距为变量的乘积,并以数学斜体输入):
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{amsfonts, empheq}
\usepackage{caption}
\usepackage[a4paper, showframe]{geometry}
\usepackage{tabularx, booktabs}
\begin{document}
\begin{table}[ht]
\centering
\begin{adjustbox}{width=.8\textwidth}
\begin{tabular}[b]{c*{3}{l}}
\toprule
Performance Variables \\
\midrule
\addlinespace
$\begin{aligned}
\text{Annual Return} &= \frac{\text{Stock\,Price}_t-\text{Stock Price}_{t-1}}{\text{Stock Price}_{t-1}} \\
\addlinespace
\text{Tobin's Q} &= \frac{\text{Equity Market Value} + \text{Liabilities Book Value}}{\text{Equity Book Value} + \text{Liabilities Book Value}}\\
\addlinespace
\text{ROA} &= \frac{\text{Net Income}}{\text{Total Assets}} \\
\addlinespace
\bottomrule
\end{aligned}$
\end{tabular}
\end{adjustbox}
\end{table}
\end{document}
答案2
您是新来的。通常,这里的人们希望获得完整的代码,其中包含重现问题所需的最少代码。在您的情况下,这当然只是一个包和
adjustbox
。amsmath
\documentclass
我添加了一条不可见的垂直线\rule
并且我\text{}
在方程式中使用 ty 对变量进行适当排版(但这与您的问题无关)。$Stock$
意思是S \times t \times o ...
等等,而 $\text{Stock}$ 是一个变量,至少这是我所知道的惯例(请咨询您的主管)。
\documentclass{article}
\usepackage{amsmath}
\usepackage{adjustbox}
\begin{document}
% nothing changed
\begin{equation}
\boxed{\frac{\text{Stock\,Price}_{t-1}}{\text{Stock\,Price}_t - \text{Stock\,Price}_{t-1}}}
\end{equation}
% visible \rule, width = 1 pt
\begin{equation}
\boxed{\frac{\rule[0pt]{1pt}{12pt}\text{Stock\,Price}_{t-1}}{\text{Stock\,Price}_t - \text{Stock\,Price}_{t-1}}}
\end{equation}
% invisible \rule
\begin{equation}
\boxed{\frac{\rule[0pt]{0pt}{12pt}\text{Stock\,Price}_{t-1}}{\text{Stock\,Price}_t - \text{Stock\,Price}_{t-1}}}
\end{equation}
\begin{table}[ht]
\centering
\begin{adjustbox}{width=.8\textwidth}
\begin{tabular}[b]{clll}
\hline
Performance Variables \\
\hline
$\begin{aligned}
Annual Return &= \frac{\rule[0pt]{0pt}{12pt}Stock\,Price_t\,-\,Stock\,Price_{t-1}}{Stock\,Price_{t-1}} \\[20pt]
Tobin's\,Q &= \frac{Equity\,Market\,Value\,+\,Liabilities\,Book\,Value}{Equity\,Book\,Value \,+\,Liabilities\,Book\,Value}\\[20pt]
ROA &= \frac{Net\,Income}{Total\,Assets} \\[20pt]
\hline
\end{aligned}$
\end{tabular}
\end{adjustbox}
\end{table}
\end{document}
答案3
对美好的补充Manuel Kuehner 博士答案。我强调的是:
- 在您的表格中使用一列,而不是四列,正如您在表格序言中声明的那样
- 显示的方程式和列类型
c
,l
并且r
彼此不太喜欢,正确的是使用parbox
列类型作为`p{} 和类似的 - 方程中的是文本而不是变量集合。因此,更正确的写法是例如
$\textit{some text}$
as
some\,text$` - 使用
booktabs
包中的规则可以获得更漂亮的结果
考虑到以上情况,我建议使用tabularx
包:
\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts, empheq}
\usepackage{booktabs,tabularx}
\begin{document}
\begin{table}[ht]
\centering
\begin{tabularx}{0.8\textwidth}{X}
\toprule
Performance Variables \\
\midrule
\addlinespace
$\begin{aligned}
\textit{Annual Return} & = \frac{\textit{Stock Price}_t - \textit{Stock Price}_{t-1}}
{\textit{Stock Price}_{t-1}} \\[1ex]
\textit{Tobin's Q} & = \frac{\textit{Equity Market Value} + \textit{Liabilities Book Value}}
{\textit{Equity Book Value} + \textit{Liabilities Book Value}} \\[1ex]
\textit{ROA} & = \frac{\textit{Net Income}}
{\textit{Total Assets}}
\end{aligned}$ \\
\addlinespace
\bottomrule
\end{tabularx}
\end{table}
\end{document}
注意:对于上述公式中的罗马字体,只需将其替换\textit
为\text