如何使用 latex \input 插入脚注?

如何使用 latex \input 插入脚注?

我有两个 tex 文件,并使用命令\input将表格包含在我的主文件中,如下所示:

主文本

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{inconsolata}
\usepackage{url}
\usepackage{hyperref}
\usepackage{color}
\usepackage{graphicx}
\usepackage[table,xcdraw]{xcolor}

\usepackage{minted}
\usepackage{listings}


\begin{document}

Eos ea harum labores scaevola, mea autem vivendo interesset ne, vis verterem patrioque at. Et adhuc malis perpetua quo. Aperiri deseruisse qui in, sea nihil aperiri et. Per tale dolore apeirian at, nam reque liber meliore id.

\input{table}

Euismod meliore duo te, at vivendo officiis per. Ea verterem lucilius urbanitas duo, nibh autem tamquam eu sea. Feugait mediocrem vel an, eu graecis tibique vulputate pro. Ne aperiri facilis scriptorem vix. Ad sed causae virtute antiopam, te usu suas sale neglegentur, tation quidam delenit has ne.

\end{document}

表格.tex

\begin{table}[ht]
\begin{center}
\caption{My caption}
\label{my-label}
\begin{tabular}{|l|}
\hline
\rowcolor[HTML]{C0C0C0} 
\multicolumn{1}{|c|}{\cellcolor[HTML]{C0C0C0}\textbf{Saucelabs\footnote{\textit{Saucelabs}: \url{https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options/}}}} \\ \hline
Browser Name                                                        \\ \hline
Browser Version                                                     \\ \hline
Platform Name                                                       \\ \hline
\end{tabular}
\end{center}
\end{table}

结果

在此处输入图片描述

如何使表格标题中的脚注出现在主页上?

答案1

您的 MWE 对我不起作用,所以我注释掉了\usepackage{minted}。对我来说,解决您的问题的最简单方法是将脚注顺序分为两个顺序:\footnotemark\footnotetext{Some text to indicate a reference.}

%In main.tex add:
\input{table}\footnotetext{{\textit{Saucelabs}: \url{https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options/}}}

%In table.tex change to:
\multicolumn{1}{|c|}{\cellcolor[HTML]{C0C0C0}\textbf{Saucelabs\footnotemark}} \\ \hline

也许有更好的方法来实现这一点。但对于快速解决方案来说,它可能有效。如果你使用几个不同的脚注,你可以调用一个\footnotemark[17]论点\footnotetext[17]{Some Text that will be footnote with the number 17.}

最好的

答案2

以下是您想要的吗(请注意,该问题与\input命令无关,请参见下文):

\documentclass{article}
\usepackage{url}
\usepackage{hyperref}
\usepackage{color}
\usepackage[table,xcdraw]{xcolor}
\begin{document}

Eos ea harum labores scaevola, mea autem vivendo interesset ne, vis.

\begin{table}[ht]
\begin{center}
\caption{My caption}
\label{my-label}
\begin{tabular}{|l|}
\hline
\rowcolor[HTML]{C0C0C0}
\multicolumn{1}{|c|}{\cellcolor[HTML]{C0C0C0}\textbf{Saucelabs}\footnotemark}      \\ \hline
Browser Name                                                                       \\ \hline
Browser Version                                                                    \\ \hline
Platform Name                                                                      \\ \hline
\end{tabular}
\end{center}
\end{table}

Euismod meliore duo te, at vivendo officiis per. Ea verterem lucilius. 

\footnotetext{\url{https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options/}}
\end{document}

\input使用命令的相同示例

\documentclass{article}
\usepackage{url,filecontents}
\usepackage{hyperref}
\usepackage{color}
\usepackage[table,xcdraw]{xcolor}
\begin{filecontents}{ifil}
\begin{table}[ht]
\begin{center}
\caption{My caption}
\label{my-label}
\begin{tabular}{|l|}
\hline
\rowcolor[HTML]{C0C0C0}
\multicolumn{1}{|c|}{\cellcolor[HTML]{C0C0C0}\textbf{Saucelabs}\footnotemark}      \\ \hline
Browser Name                                                                       \\ \hline
Browser Version                                                                    \\ \hline
Platform Name                                                                      \\ \hline
\end{tabular}
\end{center}
\end{table}
\end{filecontents}
\begin{document}

Eos ea harum labores scaevola, mea autem vivendo interesset.

\input{ifil}

Euismod meliore duo te, at vivendo officiis per. 

\footnotetext{\url{https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options/}}
\end{document}

相关内容