我\usepackage[para]{threeparttable}
按照这里的建议使用(https://tex.stackexchange.com/a/160113/231568) 尝试在一行中显示表格脚注。脚注的大小由 控制\appto\TPTnoteSettings{\footnotesize}
。但脚注实际上并没有显示在一行中,如下图所示。例如,[a] 和 [c] 之后仍有空格。
为了在一行中显示注释,我还尝试了命令[flushleft]
。
% Preview source code
%% LyX 2.3.6 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,english]{article}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=3cm,rmargin=2.5cm}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{array}
\usepackage{setspace}
\onehalfspacing
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage[para,flushleft]{threeparttable} % threeparttable: to support table footnote, but this does not work correctly, looks ugly and footnotes are not displayed with fontsize footnotesize
\usepackage{booktabs} % booktabs: to support centering of table
\usepackage{etoolbox} % to support footnotesize within table
\appto\TPTnoteSettings{\footnotesize} % footnote font size within table
\def\tnote#1{\protect\TPToverlap{\textsuperscript{[\TPTtagStyle{#1}]}}} % brackets in table footnotes
\makeatother
\usepackage{babel}
\begin{document}
\section{Section one}
\begin{table}[h]
\caption{Lorem ipsum.\label{tab:Lorem-ipsum.}}
\centering
\begin{threeparttable}
\begin{tabular}{>{\centering}m{1.2cm}>{\centering}m{3.5cm}>{\centering}m{2.5cm}>{\centering}m{2.5cm}>{\centering}m{2cm}}
\hline
\noalign{\vskip0.1cm}
\textbf{\footnotesize{}a\tnote{a}} & \textbf{\footnotesize{}b} & \textbf{\footnotesize{}c} & \textbf{\footnotesize{}d\tnote{b}} & \textbf{\footnotesize{}g}\tabularnewline[0.1cm]
\hline
\noalign{\vskip\doublerulesep}
\noalign{\vskip0.2cm}
\textbf{\footnotesize{}1\tnote{c}} & & & & {\footnotesize{}1\tnote{d}}{\footnotesize\par}
{\footnotesize{}2\tnote{d}}\tabularnewline[\doublerulesep]
\noalign{\vskip\doublerulesep}
\noalign{\vskip\doublerulesep}
\textbf{\footnotesize{}2\tnote{e}} & & & & {\footnotesize{}1\tnote{d}}{\footnotesize\par}
{\footnotesize{}2\tnote{d}}\tabularnewline[\doublerulesep]
\noalign{\vskip\doublerulesep}
\noalign{\vskip\doublerulesep}
\textbf{\footnotesize{}3\tnote{f}} & & & & {\footnotesize{}1\tnote{d}}\tabularnewline[\doublerulesep]
\noalign{\vskip\doublerulesep}
\noalign{\vskip\doublerulesep}
\textbf{\footnotesize{}4\tnote{e}} & & & & \tabularnewline[\doublerulesep]
\noalign{\vskip\doublerulesep}
\noalign{\vskip\doublerulesep}
\textbf{\footnotesize{}5} & & & & \tabularnewline[\doublerulesep]
\noalign{\vskip\doublerulesep}
\noalign{\vskip\doublerulesep}
\textbf{\footnotesize{}6\tnote{g}} & & & & {\footnotesize{}1\tnote{h}}\tabularnewline[\doublerulesep]
\noalign{\vskip\doublerulesep}
\noalign{\vskip\doublerulesep}
\textbf{\footnotesize{}7\tnote{i}} & & & & {\footnotesize{}1\tnote{h}}\tabularnewline[\doublerulesep]
\hline
\noalign{\vskip\doublerulesep}
\end{tabular}
\begin{tablenotes}
\item [a] Lorem 0.00 mmol sit amet, consetetur 0.00 mmol sed diam nonumy.
\item [b] Lorem ipsum dolor sit.
\item [c] Lorem 00 mol\% sit amet, consetetur 00 h elitr.
\item [d] Lorem ipsum dolor sit amet.
\item [e] Lorem ipsum 00 mol\% sit amet, consetetur 00 h elitr.
\item [f] Lorem dolor dolor sit amet.
\item [g] Lorem ipsum 00 mol\% sit amet, consetetur sadipscing elitr.
\item [h] Lorem ipsum dolor.
\item [i] Lorem ipsum 00 mol\% sit amet, consetetur lorem ipsum dolor 000h sadipscing elitr.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
这样,注释可以在一行中更好地显示,但注释具有标准文本大小,而不再是脚注大小。
我该如何纠正这个问题?脚注是否整齐地排列在一行中,并带有脚注大小?
答案1
我认为现在他们已经足够接近了。
flushleft
将此代码添加到您的序言中并从包选项中删除。
\makeatletter
\renewcommand{\TPT@doparanotes}{\par
\prevdepth\z@ \TPT@hsize
\TPTnoteSettings
\parindent\z@ \pretolerance 8
\linepenalty 200
\renewcommand\item[1][]{\relax\ifhmode \begingroup
\unskip
\advance\hsize 10em % \hsize is scratch register, based on real hsize
\penalty -45 \hskip\z@\@plus\hsize \penalty-19
\hskip .15\hsize \penalty 9999 \hskip-.15\hsize
\hskip .01\hsize\@plus-\hsize\@minus.01\hsize
\hskip -0.5em\@plus .3em %% changed from 1em to -0.5em
\endgroup\fi
\tnote{##1}\,\ignorespaces}%
\let\TPToverlap\relax
\def\endtablenotes{\par}%
}
\makeatother
更加紧凑。尽管还是五行。
\makeatletter
\renewcommand{\TPT@doparanotes}{\par
\prevdepth\z@ \TPT@hsize
\TPTnoteSettings
\parindent\z@ \pretolerance 8
\linepenalty 200
\renewcommand\item[1][]{\relax\ifhmode \begingroup
\unskip
\advance\hsize 10em % \hsize is scratch register, based on real hsize
\penalty -45 \hskip\z@\@plus\hsize \penalty-19
\hskip .15\hsize \penalty 9999 \hskip-.15\hsize
\hskip .008\hsize\@plus-\hsize\@minus.01\hsize %% changed
\hskip -0.2em\@plus .1em %% changed
\endgroup\fi
\tnote{##1}\,\ignorespaces}%
\let\TPToverlap\relax
\def\endtablenotes{\par}%
}
\makeatother