如何修复默认表格编号和描述分隔符

如何修复默认表格编号和描述分隔符

我有 2 个使用不同包的表,但标题不同:

当我使用带有的表格时tabularx

表 1 – 一个简单的例子

当我使用时longtable

表 2:一个简单的例子

\documentclass[a4paper,11pt,final]{article}

\usepackage[english,french]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{longtable}

\begin{document}
    \begin{longtable}{|p{0.4in}|p{2in}|p{3.3in}|}
    % first head
        \caption{caption.\label{tab:table1}} \\
        \hline a & b \\
    \endfirsthead
    \endhead
    \endfoot
    \endlastfoot
        \hline a1 & b1 \\ \hline
    \end{longtable}

    \begin{table}[htb]
        \caption{caption.\label{tab:table2}}
        \begin{tabularx}{\textwidth}{|l|X|}
        \hline a & b \\
        \hline a1 & b1 \\
        \hline
        \end{tabularx}
    \end{table}
\end{document}

答案1

这是一个解决方法。使用

\usepackage[labelsep=colon]{caption}

\usepackage[english,french]{babel}

\documentclass[a4paper,11pt,final]{article}
\usepackage[T1]{fontenc}
\usepackage[english,french]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage[labelsep=colon]{caption}

\begin{document}
    \begin{longtable}{|p{0.4in}|p{2in}|p{3.3in}|}
    % first head
        \caption{caption.\label{tab:table1}} \\
        \hline a & b \\
    \endfirsthead
    \endhead
    \endfoot
    \endlastfoot
        \hline a1 & b1 \\ \hline
    \end{longtable}

    \begin{table}[htb]
        \caption{caption.\label{tab:table2}}
        \begin{tabularx}{\textwidth}{|l|X|}
        \hline a & b \\
        \hline a1 & b1 \\
        \hline
        \end{tabularx}
    \end{table}
\end{document}

在此处输入图片描述

相关内容