表格未出现在 LaTex 文档中

表格未出现在 LaTex 文档中

我确实想在 LaTex/Overleaf 中创建此表格。但是,表格根本就没有出现在文档中。任何帮助都非常感谢。

谢谢!

\begin{table}[ht]
    \centering
    \caption{Variables description}
    \label{variables_description}
\begin{tabularx}{\textwidth}{l X}
\midrule\midrule
Variable & Definition \\
\midrule
$ROE$ & Net income (loss) before taxes divided by capital and surplus of insurer \textit{i} in year \textit{t}. \\
\addlinespace
$ROA$ & Net income (loss) before taxes divided by total assets of insurer \textit{i} in year \textit{t}. \\
\addlinespace
$RAROE$ & Return on equity before taxes of insurer \textit{i} in year \textit{t} divided by the 3-year standard deviation of return on equity before taxes of insurer \textit{i} from year \textit{t-2} to year \textit{t}. \\
\addlinespace
$RAROA$ & Return on assets before taxes of insurer \textit{i} in year \textit{t} divided by the 3-year standard deviation of return on assets before taxes of insurer \textit{i} from year \textit{t-2} to year \textit{t}. \\
\addlinespace
$TotalAssets$ & Total assets of insurer \textit{i} in year \textit{t-1}. \\
\addlinespace
$GPW$ & Gross premiums written of insurer \textit{i} in year \textit{t-1}. \\
\addlinespace
$\Delta GPW$ & Gross premiums written of insurer \textit{i} in year \textit{t} divided by gross premiums written of insurer \textit{i} in year \textit{t-1}. \\
\addlinespace
$Solvency$ & Capital and surplus divided by total assets of insurer \textit{i} in year \textit{t}. & \\
\addlinespace
$Combined$ & Sum of the loss ratio and expense ratio of insurer \textit{i} in year  \textit{t}. Loss ratio is defined as net claims incurred divided by earned premiums. Expense ratio is defined as net operating expenses divided by net premiums written. \\
\addlinespace
$Reinsurance$ & Reinsurance ceded divided by the sum of direct premiums and reinsurance assumed of insurer \textit{i} in year \textit{t}. \\
\addlinespace
$Liquidity$ & Liquid assets divided by total liabilities of insurer \textit{i} in year \textit{t}. \\
\addlinespace
$Public$ & Binary variable, equal to one if insurer \textit{i} is publicly listed in year \textit{t}, and zero otherwise. \\
\addlinespace
$Group$ & Binary variable, equal to one if insurer \textit{i} is affiliated to an insurance group in year \textit{t}, and zero otherwise. \\
\midrule\midrule
\multicolumn{2}{@{}p{\linewidth}@{}}{\footnotesize{\textit{Note:} This table defines all variables used in this paper. The source for the data of all variables is Bureau van Dijk’s Orbis Insurance Focus database.}} \\
\end{tabularx}\\ 
\end{table}

答案1

请始终展示最小的工作示例,而不是仅展示代码片段。并且始终显示您收到的错误消息。如果我扩展您的代码进行编译,我会收到错误消息:

Extra alignment tab has been changed to \cr.
<recently read> \endtemplate 
                             
l.40 \end{tabularx}

这是因为这里:

$Solvency$ & Capital and surplus divided by total assets of insurer \textit{i} in year \textit{t}. & \\

&你之前有 一个 额外 的\\

修复这个问题:

\documentclass{article}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{caption}% Because of using \caption before tabular.
\begin{document}
\begin{table}[ht]
    \centering
    \caption{Variables description}
    \label{variables_description}
\begin{tabularx}{\textwidth}{l X}
\midrule\midrule
Variable & Definition \\
\midrule
$ROE$ & Net income (loss) before taxes divided by capital and surplus of insurer \textit{i} in year \textit{t}. \\
\addlinespace
$ROA$ & Net income (loss) before taxes divided by total assets of insurer \textit{i} in year \textit{t}. \\
\addlinespace
$RAROE$ & Return on equity before taxes of insurer \textit{i} in year \textit{t} divided by the 3-year standard deviation of return on equity before taxes of insurer \textit{i} from year \textit{t-2} to year \textit{t}. \\
\addlinespace
$RAROA$ & Return on assets before taxes of insurer \textit{i} in year \textit{t} divided by the 3-year standard deviation of return on assets before taxes of insurer \textit{i} from year \textit{t-2} to year \textit{t}. \\
\addlinespace
$TotalAssets$ & Total assets of insurer \textit{i} in year \textit{t-1}. \\
\addlinespace
$GPW$ & Gross premiums written of insurer \textit{i} in year \textit{t-1}. \\
\addlinespace
$\Delta GPW$ & Gross premiums written of insurer \textit{i} in year \textit{t} divided by gross premiums written of insurer \textit{i} in year \textit{t-1}. \\
\addlinespace
$Solvency$ & Capital and surplus divided by total assets of insurer \textit{i} in year \textit{t}. \\
\addlinespace
$Combined$ & Sum of the loss ratio and expense ratio of insurer \textit{i} in year  \textit{t}. Loss ratio is defined as net claims incurred divided by earned premiums. Expense ratio is defined as net operating expenses divided by net premiums written. \\
\addlinespace
$Reinsurance$ & Reinsurance ceded divided by the sum of direct premiums and reinsurance assumed of insurer \textit{i} in year \textit{t}. \\
\addlinespace
$Liquidity$ & Liquid assets divided by total liabilities of insurer \textit{i} in year \textit{t}. \\
\addlinespace
$Public$ & Binary variable, equal to one if insurer \textit{i} is publicly listed in year \textit{t}, and zero otherwise. \\
\addlinespace
$Group$ & Binary variable, equal to one if insurer \textit{i} is affiliated to an insurance group in year \textit{t}, and zero otherwise. \\
\midrule\midrule
\multicolumn{2}{@{}p{\linewidth}@{}}{\footnotesize{\textit{Note:} This table defines all variables used in this paper. The source for the data of all variables is Bureau van Dijk’s Orbis Insurance Focus database.}} \\
\end{tabularx}\\ 
\end{table}

\end{document}

结果是

在此处输入图片描述

因此,即使 Overleaf 产生了输出,你也应该始终查看错误消息。

答案2

除了删除&“偿付能力”行中的虚假字符外,您还应该 (a) 使用数学模式,而不是\textit诸如tt-1t-2和之类的变量i,以及 (b) 对于多字母变量名,使用 或\mathit\mathrm但不要使用纯数学模式。表格底部的图例不必是材料的一部分tabularx。哦,请不要生成双重规则,因为单个规则同样有效。

在此处输入图片描述

\documentclass{book} 
\usepackage{amsmath,tabularx,booktabs}
\newcommand\vn[1]{\ensuremath{\mathit{#1}}} % or "\mathrm"
\begin{document} 

\begin{table}[ht]
\setlength\extrarowheight{3pt}

    \caption{Variable definitions\strut}
    \label{variables_description}
    
\begin{tabularx}{\textwidth}{@{} l X @{}}
\toprule
Variable & Definition \\
\midrule

\vn{ROE} & Net income (loss) before taxes divided by capital and surplus of insurer $i$ in year~$t$. \\

\vn{ROA} & Net income (loss) before taxes divided by total assets of insurer $i$ in year~$t$. \\

\vn{RAROE} & Return on equity before taxes of insurer $i$ in year~$t$ divided by the 3-year standard deviation of return on equity before taxes of insurer $i$ from year $t-2$ to year~$t$. \\

\vn{RAROA} & Return on assets before taxes of insurer $i$ in year~$t$ divided by the 3-year standard deviation of return on assets before taxes of insurer $i$ from year $t-2$ to year~$t$. \\

\vn{TotalAssets} & Total assets of insurer $i$ in year $t-1$. \\

\vn{GPW} & Gross premiums written of insurer $i$ in year $t-1$. \\

$\Delta\vn{GPW}$ & Gross premiums written of insurer $i$ in year~$t$ divided by gross premiums written of insurer $i$ in year $t-1$. \\

\vn{Solvency} & Capital and surplus divided by total assets of insurer $i$ in year~$t$.  \\

\vn{Combined} & Sum of the loss ratio and expense ratio of insurer $i$ in year  $t$. Loss ratio is defined as net claims incurred divided by earned premiums. Expense ratio is defined as net operating expenses divided by net premiums written. \\

\vn{Reinsurance} & Reinsurance ceded divided by the sum of direct premiums and reinsurance assumed of insurer $i$ in year~$t$. \\

\vn{Liquidity} & Liquid assets divided by total liabilities of insurer $i$ in year~$t$. \\

\vn{Public} & Binary variable, equal to one if insurer $i$ is publicly listed in year~$t$, and zero otherwise. \\

\vn{Group} & Binary variable, equal to one if insurer $i$ is affiliated to an insurance group in year~$t$, and zero otherwise. \\

\bottomrule
\end{tabularx}

\medskip
\textit{Note:} This table defines all variables used in this paper. 
The source for the data of all variables is Bureau van Dijk's 
Orbis Insurance Focus database. 

\end{table}
\end{document}

答案3

您应该始终注意错误,并且在出现意外的 PDF 或错误结果时应阅读 LaTeX 生成的日志。

编辑。第二列中有数学表达式,我没注意到。建议使用数学模式才能实现正确的排版。为了进行比较,请查看我的屏幕截图和米科的答案。您会看到数学模式给出了更好的结果。

我想补充几点建议卡博哈的答案,主要是为了方便。我还删去了与表格无关的不必要的部分。

为了避免每个单元格中重复的代码,您可以将格式移至列定义。在您的情况下,>{\itshape}l我认为您希望文本为斜体。如果您确实希望单元格处于数学模式,请将规范更改为>{$}l<{$};需要array包但它也由加载tabularx。但是,第一行(标题)应该不受影响。可以通过\normalfont或取消效果\multicolumn{1}{l}{...}

您可以将 的所有实例更改为\textit{...}\emph{...}这也会使文本变为斜体。然后,如果您改变主意,可以通过重新定义正在使用的宏在一个地方更改整个文本的样式,例如

\RenewDocumentCommand\emph{m}{\ifmmode\mathbf{#1}\else\textbf{#1}\fi}

如果将此行添加到表格或任何其他环境中,它只会影响该环境内的宏(参见上面的编辑)

\addlinespace也可以通过使用等于 1.25 左右的因子来实现 的多个副本的效果\renewcommand\arraystretch{<factor>}。 效果是不对称的,并且 越高, 就越明显<factor>。 这已在代码中得到纠正。

另外,除了&一行中的额外内容外,还有\\之后的内容\end{tabularx}。我认为它是一种类型。

以下是表格

\documentclass{article}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{blindtext}


\begin{document}
\begin{table}[ht]
  \renewcommand\arraystretch{1.5}
  \setlength\extrarowheight{-1pt} % Corrects asymmetric effect of arraystretch
  % \RenewDocumentCommand\emph{m}{\ifmmode\mathbf{#1}\else\textbf{#1}\fi}
  \centering
  \caption{Variables description}
  \label{variables_description}
  \begin{tabularx}{\textwidth}{>{\itshape}l X}
    \midrule\midrule
    \multicolumn{1}{l}{Variable} & Definition \\
    \midrule
    ROE         & Net income (loss) before taxes divided by capital and surplus of insurer \emph{i} in year \emph{t}. \\
    ROA         & Net income (loss) before taxes divided by total assets of insurer \emph{i} in year \emph{t}. \\
    RAROE       & Return on equity before taxes of insurer \emph{i} in year \emph{t} divided by the 3-year standard deviation of return on equity before taxes of insurer \emph{i} from year \emph{t-2} to year \emph{t}. \\
    RAROA       & Return on assets before taxes of insurer \emph{i} in year \emph{t} divided by the 3-year standard deviation of return on assets before taxes of insurer \emph{i} from year \emph{t-2} to year \emph{t}. \\
    TotalAssets & Total assets of insurer \emph{i} in year \emph{t-1}. \\
    GPW         & Gross premiums written of insurer \emph{i} in year \emph{t-1}. \\
    $\Delta$GPW & Gross premiums written of insurer \emph{i} in year \emph{t} divided by gross premiums written of insurer \emph{i} in year \emph{t-1}. \\
    Solvency    & Capital and surplus divided by total assets of insurer \emph{i} in year \emph{t}. \\
    Combined    & Sum of the loss ratio and expense ratio of insurer \emph{i} in year  \emph{t}. Loss ratio is defined as net claims incurred divided by earned premiums. Expense ratio is defined as net operating expenses divided by net premiums written. \\
    Reinsurance & Reinsurance ceded divided by the sum of direct premiums and reinsurance assumed of insurer \emph{i} in year \emph{t}. \\
    Liquidity   & Liquid assets divided by total liabilities of insurer \emph{i} in year \emph{t}. \\
    Public      & Binary variable, equal to one if insurer \emph{i} is publicly listed in year \emph{t}, and zero otherwise. \\
    Group       & Binary variable, equal to one if insurer \emph{i} is affiliated to an insurance group in year \emph{t}, and zero otherwise. \\
    \midrule\bottomrule[\lightrulewidth]
    \multicolumn{2}{@{}p{\linewidth}@{}}{\footnotesize{\emph{Note:} This table defines all variables used in this paper. The source for the data of all variables is Bureau van Dijk’s Orbis Insurance Focus database.}}
  \end{tabularx}
\end{table}
\end{document}

在此处输入图片描述

相关内容