我需要编写一份包含 2 列(每种语言一列)的技术翻译,并附上图表、参考文献和脚注。我尝试过 paracol,但总是遇到各种问题,例如跨两列的图表出现在文本末尾等。有什么建议吗?或者更好的是,也许有一个模板可以作为起点?下面是一个示例(使用 Word 制作),其中突出显示了(红色)我需要做的事情:
- 引用其他专栏的脚注
- 页面上的图,而不是文本末尾的图
- 图表和表格标题中的脚注和参考资料
- 跨多页的脚注连续编号
- 脚注和表格中脚注的引用
- (同一)页面底部的脚注跨越两栏
正如所说,我现在很绝望,因为当我解决上述问题之一时,我经常发现它与另一个问题相冲突。例如,我可以通过 \end{paracol} 将图片放置在我想要的位置 (2.),但脚注会出现在页面中间,等等……我根本无法让所有东西同时工作 :-(
非常感谢您的帮助!提前致谢 :-)
附言:我是不是我是 LaTeX 专家,所以请耐心听我提问。
更新:通过 John 的以下建议和一些额外的调整,我现在可以创建我想要的东西:-) 再次感谢大家!
具体来说,我添加了一个自定义命令来结束 paracols 并保存脚注索引(\globalcounter 由于未知原因无法工作)。这允许自定义跨越 2 列的标题。
这是工作副本:
\documentclass[a4paper,11pt]{scrartcl}
\usepackage{graphicx}
\usepackage{paracol}
\usepackage[german,english]{babel}
\usepackage[utf8]{inputenc} % for umlaut support (üöäß)
\usepackage[pdfborder={0 0 0}]{hyperref} % references & TOC with links
\usepackage{tabularx}
\usepackage{caption}
\usepackage{longtable}
%\usepackage{nonfloat} % allows captions without float environment
\usepackage{lipsum}
% footnotes span both text columns
\footnotelayout{m}
% save footnote index after \end{paracols}
\newcounter{foo}
\globalcounter{foo}
\newcommand{\startcolumns}{\begin{paracol}{2}}
\newcommand{\stopcolumns}{%
\setcounter{foo}{\value{footnote}}%
\end{paracol}%
\setcounter{footnote}{\value{foo}}%
}
% define environment for floating figures accross columns
% see https://tex.stackexchange.com/questions/545214/2-column-text-with-floating-figures/545286#545286
\globalcounter{figure}
\makeatletter
\newenvironment{Figure}{\switchcolumn[0]*% synchronize columns
\vskip\intextsep
\noindent\minipage{\textwidth}
\def\@captype{figure}}% body goes here
{\endminipage\hskip-\textwidth
\newline\vskip\intextsep
\switchcolumn[0]*}% synchronize columns
\makeatother
% define environment for floating tables accross columns
% see https://tex.stackexchange.com/questions/545214/2-column-text-with-floating-figures/545286#545286
\globalcounter{table}
\makeatletter
\newenvironment{Table}{\switchcolumn[0]*% synchronize columns
\vskip\intextsep
\noindent\minipage{\textwidth}
\def\@captype{table}}% body goes here
{\endminipage\hskip-\textwidth
\newline\vskip\intextsep
\switchcolumn[0]*}% synchronize columns
\makeatother
% define footnote with label which can be referenced by \footref. Required for captions and paracols
% see https://tex.stackexchange.com/questions/10102/multiple-references-to-the-same-footnote-with-hyperref-support-is-there-a-bett
\newcommand{\footnotelabel}[2]{%
\addtocounter{footnote}{1}%
\footnotetext[\thefootnote]{%
\addtocounter{footnote}{-1}%
\refstepcounter{footnote}\label{#1}%
#2%
}%
$^{\ref{#1}}$%
}
% define footnote text with label. Required for footnotes in tables
\newcommand{\footnotetextlabel}[2]{%
\addtocounter{footnote}{1}%
\footnotetext[\thefootnote]{%
\addtocounter{footnote}{-1}%
\refstepcounter{footnote}\label{#1}%
#2%
}%
}
% refer to a footnote defined by \footnotelabel or \footnotetextlabel
\renewcommand{\footref}[1]{%
\textsuperscript{{\ref{#1}}}%
}
\begin{document}
\small\sloppy
\section{this is a heading which is too long for 2 columns}
\startcolumns
\switchcolumn[0]
Lorem ipsum dolor sit amet, consectetuer\footnotelabel{note1}{First footnote (accross both columns)} adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris.
\switchcolumn[1]
Nulla malesuada porttitor diam. Donec felis\footref{note1} erat, congue non, volutpat at, tincidunt tristique, libero. Vivamus viverra fermentum felis.
\begin{Figure}
\centering
%\includegraphics[width=0.5\textwidth]{panda.jpg}
\includegraphics[width=0.5\textwidth]{example-image}
\label{figure: panda}
\captionof{figure}{caption of figure\footref{note2}}
\end{Figure}% now in left column
\footnotetextlabel{note2}{Second footnote, reference to figure \ref{figure: panda}}
\switchcolumn[0]*
See figure \ref{figure: panda}. Nam dui ligula, fringilla a, euismod sodales\footnotelabel{note3}{Third footnote}, sollicitudin vel, wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus.
\switchcolumn[1]
Integer non enim. Praesent euismod nunc\footref{note3} eu purus. Donec bibendum quam in tellus. Nullam cursus pulvinar lectus.
\begin{Table}
\centering
\begin{tabularx}{\textwidth}{| X | X | X |}
\hline
Parameter & Value & Unit \\
\hline
humidity\footref{note4} & 80 & \% \\
\hline
temperature\footref{note4} & 27 & $^\circ$C \\
\hline
\end{tabularx}
\captionof{table}{caption of table\footref{note2}}
\label{table: table1}
\end{Table}
\footnotetextlabel{note4}{Fourth footnote}
\switchcolumn[0]*
See table \ref{table: table1}. Nam dui ligula, fringilla a, euismod sodales\footnotelabel{note5}{Fifth footnote} sollicitudin vel, wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi.
\switchcolumn[1]
Integer non enim. Praesent euismod nunc\footref{note5} eu purus. Donec bibendum quam in tellus. Nullam cursus pulvinar lectus. Donec et mi. Nam vulputate metus eu enim. Vestibulum pellentesque felis eu massa.
\stopcolumns
\end{document}
答案1
这将创建环境图形和表格,以便在段落之间插入两列的图形或表格。
\documentclass[12pt]{article}
\usepackage{paracol}
\usepackage{graphicx}
\usepackage{caption}% for \captionof
\usepackage{lipsum}
\globalcounter{figure}
\globalcounter{table}
\makeatletter
\newenvironment{Figure}{\switchcolumn[0]*% synchronize columns
\vskip\intextsep
\noindent\minipage{\textwidth}
\def\@captype{figure}}% body goes here
{\endminipage\hskip-\textwidth
\newline\vskip\intextsep
\switchcolumn[0]*}% synchronize columns
\newenvironment{Table}{\switchcolumn[0]*% synchronize columns
\vskip\intextsep
\noindent\minipage{\textwidth}
\def\@captype{table}}% body goes here
{\endminipage\hskip-\textwidth
\newline\vskip\intextsep
\switchcolumn[0]*}% synchronize columns
\makeatother
\begin{document}
\small\sloppy
\begin{paracol}{2}
\lipsum[1]
\switchcolumn
\lipsum[2]
\begin{Figure}
\centering
\includegraphics[height=2cm]{example-image}
\caption{Test}
\end{Figure}% now in left column
\lipsum[3]
\switchcolumn
\lipsum[4]
\begin{Table}
\centering
\begin{tabular}{|c|c|}
\hline
some & table \\
\hline
\end{tabular}
\caption{Test}
\end{Table}
\lipsum[5]
\switchcolumn
\lipsum[6]
\end{paracol}
\end{document}