CTeX-org / forum

A temporarily alternate forum of `bbs.ctex.org`
https://t.me/chinesetex
Apache License 2.0
210 stars 16 forks source link

希望在同一 tabular 的多个 cell 内生成不同的多个脚注 #303

Closed Mikachu2333 closed 6 months ago

Mikachu2333 commented 6 months ago

检查

编译环境

  1. 在试图在同一tabular的不同单元格内生成内容不同的脚注时失败
  2. 表现为 \footnote 无法使用,\footnotemark\footnotetext{} 只能生成序号相同的脚注
  3. 已经尝试了通过 % 分隔的方法然而无效。
  4. 未能找到与之相关的其他可行方法

图片

最小工作示例(MWE)

\documentclass[a4paper]{ctexrep}
\usepackage{ulem,float}
\usepackage{multirow,booktabs,makecell}
\begin{document}
\begin{table}[H]
    \centering
    \begin{tabular}{|c|c|}
        \Xhline{1.2pt}
        地点  & 习惯称呼                            \\
        \Xhline{1.2pt}
        XXX & A啊啊AA       \footnotemark   \\
        \Xhline{1.2pt}
        \multirow{3}{*}{YYY}
            & BBBB斌BBBBBB \footnote{2贰2222222} \\
        \cline{2-2}
            & C草CC      \footnotemark        \\
        \cline{2-2}
            & D贷D \footnotemark                %
        \footnotetext{444肆4444}                \\
        \Xhline{1.2pt}
    \end{tabular}
\end{table}
\footnotetext{1111壹111111}
\footnotetext{3333333叁3}
\end{document}

其他尝试

  1. footnotes-in-tabulars ,但是均无法在中文环境下工作,而我也不想把我所有的tabular换成其他的例如 supertabular 之类……因为过大的工作量

其他:

  1. 脚注位于表格底部或页面底部均可,脚注内容支持使用 \href 超链接
  2. 单元格与脚注均为中英混杂
muzimuzhi commented 6 months ago

描述问题 2. [...] \footnotemark\footnotetext{} 只能生成序号相同的脚注

传统上,(要为多个 \footnotemark 添加对应的 \footnotetext 时),得使用 \footnotetext[<number>]{<text>} 手动指定序号。 https://latexref.xyz/_005cfootnotetext.html

其他尝试 1. footnotes-in-tabulars ,但是均无法在中文环境下工作

好像至少 https://tex.stackexchange.com/a/35327 里提到的 tablefootnote 包就能在中文环境下工作。

其他: 1. 脚注位于表格底部或页面底部均可,脚注内容支持使用 \href 超链接

没懂后半句。

% !TeX TS-program = xelatex
\documentclass{ctexart}
\usepackage{float}
\usepackage{multirow,makecell}
\usepackage{tablefootnote}

\usepackage[colorlinks]{hyperref}

\begin{document}
\begin{table}[H]
    \centering
    \begin{tabular}{|c|c|}
        \Xhline{1.2pt}
        地点  & 习惯称呼          \\ \Xhline{1.2pt}
        XXX & A啊A\footnotemark \\ \Xhline{1.2pt}
        \multirow{3}{*}{YYY}
            & B斌B\footnotemark \\ \cline{2-2}
            & C草C\footnotemark \\ \cline{2-2}
            & D贷D\footnotemark \\ \Xhline{1.2pt}
    \end{tabular}
\end{table}
\footnotetext[1]{1壹1}
\footnotetext[2]{2贰2}
\footnotetext[3]{3叁3}
\footnotetext[4]{4肆4}

\begin{table}[H]
    \centering
    \begin{tabular}{|c|c|}
        \Xhline{1.2pt}
        地点  & 习惯称呼                \\ \Xhline{1.2pt}
        XXX & A啊A\tablefootnote{A啊A} \\ \Xhline{1.2pt}
        \multirow{3}{*}{YYY}
            & B斌B\tablefootnote{B斌B} \\ \cline{2-2}
            & C草C\tablefootnote{C草C} \\ \cline{2-2}
            & D贷D\tablefootnote{D贷D} \\ \Xhline{1.2pt}
    \end{tabular}
\end{table}

\newpage
content % 为了点击超链接后有跳转空间
\end{document}

image image

Mikachu2333 commented 6 months ago

啊,发现了问题所在,昨天在生成的时候虽然没有报错,但是实际上并没有安装 tablefootnote 宏包,估计是由于忘记清理缓存文件所致。 今天清除缓存并重新安装宏包生成以后问题解决!

muzimuzhi commented 6 months ago

昨天在生成的时候虽然没有报错,但是实际上并没有安装 tablefootnote 宏包

怎么会呢……