免費論壇 繁體 | 簡體
Sclub交友聊天~加入聊天室當版主
分享
Board logo

标题: 行间公式加脚注,怎么才能让脚注标号在同一行 [打印本页]

作者: abababa    时间: 2015-10-7 15:58     标题: 行间公式加脚注,怎么才能让脚注标号在同一行

$$f(x)=ax^2+bx+c$$\footnote{这是二次函数}
这个脚注标号1,怎么才能和公式放在同一行呢?
作者: kuing    时间: 2015-10-7 16:34

把 \footnote 放公式里面不行吗?
作者: abababa    时间: 2015-10-7 16:41

回复 2# kuing
原来能这样。
刚才试了,这个注释里有数学公式和汉字,放在公式里面就要用\text来把汉字括上,这挺麻烦的。
作者: kuing    时间: 2015-10-7 17:35

回复 3# abababa

不用的啊,你试试这个: footnoteinmath.tex (654 Bytes)
  1. \documentclass{article}
  2. \usepackage{amsmath}
  3. \usepackage{xeCJK}
  4. \usepackage{hyperref}
  5. \begin{document}
  6. 直接将 \verb"\footnote" 放入公式中,\verb"$" 的:
  7. $
  8. f(x)=ax^2+bx+c\footnote{这是二次函数}
  9. $
  10. \verb"\[  \]" 的:
  11. \[
  12. f(x)=ax^2+bx+c\footnote{这还是二次函数}
  13. \]
  14. \verb"equation" 的:
  15. \begin{equation}
  16. f(x)=ax^2+bx+c\footnote{这还还是二次函数}
  17. \end{equation}

  18. \verb"align" 的要复杂些,
  19. 要用到 \verb"\footnotemark" 和 \verb"\footnotetext":
  20. \begin{align}
  21. f(x)&=ax^2+bx+c\footnotemark\\
  22. &=a(x-x_1)(x-x_2)
  23. \end{align}

  24. \footnotetext{这依然还是二次函数}

  25. 就是酱紫。
  26. \end{document}
复制代码


附件: footnoteinmath.tex (2015-10-7 17:35, 654 Bytes) / 下载次数 2729
http://kuing.orzweb.net/attachment.php?aid=3207&k=c315493cc821ac1b59344765693f2749&t=1711652690&sid=9Cm49b
作者: abababa    时间: 2015-10-7 18:05

回复 4# kuing
是的,这回好了。刚才不知怎么弄的,可能是其它地方有错误,我想当然的以为是在美元符号里放了汉字的原因。
作者: abababa    时间: 2016-6-28 14:31

回复 4# kuing

今天打公式时用到这个align里的脚注了,用\footnotemark和\footnotetext就可以了,感谢。
作者: kuing    时间: 2016-6-28 14:53

回复 6# abababa

客咩气
作者: isee    时间: 2017-4-1 22:09

这也是很奇怪的事,我用word从来不用脚注,但是在XeLaX里却是经常用脚注。

公式里的脚注,我想都没想,直接跟正文的文字一样处理,一般都正常。

看到6楼才意识到有些特殊的环境里,得用6楼的代码。。。
作者: abababa    时间: 2017-5-7 10:19

今天又用了一次footnotemark,和上次隔了几页,这回这个编号不对了。
我上一次的用法是在一个align环境里连着用了三次footnotemark,然后在end align后加了footnotetext[1]{}footnotetext[2]{}footnotetext[3]{}。这次的页码在上次之前,用了一次 footnotemark,接着用了footnotetext{},发现编号都不对了。具体的使用形式如下:

第76页里是
begin align
...\footnotemark\\
...
end align
\footnotetext{}

第98页是
begin align
...\footnotemark\\
...\footnotemark\\
...\footnotemark\\
...
end align
\footnotetext[1]{}
\footnotetext[2]{}
\footnotetext[3]{}

我把那个123的编号删除后,编号全都变成3了,如果在footnotemark后面加上编号,链接就没有了。
看来我还是没学会。请教这个应该怎么弄?
作者: kuing    时间: 2017-5-7 14:54

\footnotemark:脚注计数器+1,然后贴上相应标记。
\footnotemark[]:贴出 [] 的标记,脚注计数器不变。
\footnotetext:写出脚注内容,编号由当前脚注计数器给出。
\footnotetext[]:写出脚注内容,编号由 [] 的值给出。

所以当连续三个  \footnotemark 之后,计数器已经+3,故随后的 \footnotetext 编号都是+3后的了。

解决办法看来也只好用 \footnotetext[] 来手动指定编号了,但不能直接写[1][2][3](后果就是你遇到的情况),这里应该利用当前的计数器来减回去,如:
  1. \begin {align}
  2. ...\footnotemark\\
  3. ...\footnotemark\\
  4. ...\footnotemark\\
  5. ...
  6. \end {align}
  7. \footnotetext[\numexpr\thefootnote-2\relax]{.}
  8. \footnotetext[\numexpr\thefootnote-1\relax]{..}
  9. \footnotetext{...}
复制代码
这应该就没啥大问题了,虽然写起来麻烦点,但毕竟不是常见的事,就这样吧……
作者: abababa    时间: 2017-5-7 17:49

回复 10# kuing

谢谢,不过我最后决定用[1][2]这种了,没有链接就先没有吧,注释都在最近的页上,差不了一页。这能不能算是宏包设计上的漏洞呢?
作者: kuing    时间: 2017-5-7 17:57

回复 11# abababa

提供了解决方法为啥不用……
作者: abababa    时间: 2017-5-7 18:14

回复 12# kuing

觉得这个[\numexpr\thefootnote-2\relax]是不是到时候还得记住那个号码是多少,万一要是多了,记不清,到时查找我也不会简单方法。
作者: kuing    时间: 2017-5-7 18:22

回复 13# abababa

你没看懂我的解释吗?因为连续三个,计数器+3了,所以随后输出的两个脚注要-2和-1,如果连续 n 个,后面输出时就是 -(n-1), -(n-2), ..., -1 ,并不需要知道具体的号码,只需知道连续了多少个。
事实上要新建些命令来简化它也不难,只是我觉得这样的情况应该不多,就懒得弄了。
作者: kuing    时间: 2017-5-7 20:51

好吧,我还是写一个试试看:

\newcounter{afnctr}
\newcommand\afnmark{\stepcounter{afnctr}\footnotemark}
\newcommand\afntext[1]{\addtocounter{afnctr}{-1}%
\footnotetext[\numexpr\thefootnote-\theafnctr\relax]{#1}}

用法与 \footnotemark、\footnotetext 一样。

测试文档:

附件: footnotes_in_align.tex (2017-5-7 20:51, 1.55 KB) / 下载次数 2681
http://kuing.orzweb.net/attachment.php?aid=4940&k=9aee5f321d273b0e9f189a08a888404a&t=1711652690&sid=9Cm49b
作者: abababa    时间: 2017-5-7 20:52

回复 14# kuing

哦,我以为减几那个是针对全局的第几个设置的。但我刚才又试了一下:
第76页
  1. \begin{align*}
  2. abc\\
  3. abc\footnotemark\\
  4. abc
  5. \end{align*}
  6. \footnotetext{这是abc}
复制代码
第98页
  1. \begin{align*}
  2. x\footnotemark\\
  3. y\footnotemark\\
  4. z\footnotemark\\
  5. \end{align*}
  6. \footnotetext[\numexpr\thefootnote-2\relax]{这是x}
  7. \footnotetext[\numexpr\thefootnote-1\relax]{这是y}
  8. \footnotetext{这是z}
复制代码
这样第76页那个编号仍然是3而不是1,但是第76页那个链接能链正确。而第98页的被编成了123号,链接也都有,但是只有3能正确跳到页脚,其它的12跳不过去。
作者: kuing    时间: 2017-5-7 20:58

回复 16# abababa

76页那个编号是3 说明它前面还有两个脚注呗。

跳转的问题确实存在,不过这不大要紧吧,反正在同一页。
作者: abababa    时间: 2017-5-7 21:32

回复 17# kuing

果然如此。找了半天才找出来,我还是对搜索这些不熟练。
链接有问题还是宏包设计上的问题吧?我的意思是,通过那些宏包的使用说明解决不了这个问题是不是?而不是我对宏包没用对。
作者: kuing    时间: 2017-5-7 21:38

回复 18# abababa

这我不太清楚,链接、跳转这些主要是hyperref管的,但那个包很复杂,我也不是太了解。
作者: abababa    时间: 2017-6-1 10:19

昨天找到一个脚注的方式,是紧随着命题、定理等等环境之后的形式,觉得还可以,但具体怎么弄还没明白,就是newmdtheoremenv,newframedtheorem什么的,而且命题环境是加了框的,不知道怎么弄回不加框的情况。
  1. \documentclass[11pt]{book} %
  2. \usepackage[utf8]{inputenc}
  3. \usepackage[T1]{fontenc}
  4. \usepackage{amssymb,amsmath}
  5. \usepackage{framed}
  6. \usepackage[amsmath,framed]{ntheorem}
  7. \newframedtheorem{Prop}{Propo}
  8. \usepackage[ntheorem]{mdframed}
  9. \newmdtheoremenv{proposition}[Prop]{Pro}

  10. \begin{document}

  11. \begin{proposition}
  12. Example with mdframed \footnote{Just to see! }
  13. \end{proposition}


  14. \begin{Prop}
  15. Example with mdframed \footnote{Just to see! }
  16. \end{Prop}

  17. \end{document}
复制代码

作者: kuing    时间: 2017-6-1 22:17

回复 20# abababa

只是要紧随脚注的话,其实用 minipage 也行,不过可能需要调节行距、缩进之类的一些细节。
作者: abababa    时间: 2017-6-1 23:22

本帖最后由 abababa 于 2017-6-1 23:37 编辑

回复 21# kuing

minipage 的以前也看过,这个mdtheorem可能也是用minipage做的。

现在对这个有点感觉了,用如下的方式:

\newtheorem{proof}{证明}% (*)
\theoremstyle{nonumberplain}%这个好像是表示不对证明编号
\usepackage[ntheorem]{mdframed}
\newmdtheoremenv{myproof}[proof]{证明}%这里的[proof]必须和前面(*)处的proof同名才行。

这样之后,用proof环境就是脚注在最底下,用myproof环境就是脚注随着证明之后。newmdtheoremenv还有一些选项,能调背景色之类的,但我想把边框调没。另外在myproof中的注释编号是a,可能是用英文字母编号的,还不知道怎么换成数字编号。

边框的那个找到了,是用下边的实现的:
\newmdtheoremenv[topline=false,rightline=false,leftline=false,bottomline=false]{xproof}[proof]{证明}

为了让那个白方格在myproof中也出现,还得在前面加上
\theoremsymbol{\ensuremath{\square}}




欢迎光临 悠闲数学娱乐论坛(第2版) (http://kuing.orzweb.net/) Powered by Discuz! 7.2