덧셈

덧셈

LaTeX새로운 장, 섹션 등을 삽입할 때 번호 매기기 조정(더 중요한 것은 이에 대한 참조)을 조정하는 데 매우 좋습니다.

적어도 여기 독일에서는 법률 문서(및 서적)에서 이전 번호를 그대로 유지하면서 삽입 전의 번호 뒤에 소문자(a, b, c, ...)를 사용하여 이러한 항목을 삽입하는 경향이 있습니다. 무언가 변경되었음을 나타냅니다(마지막 순간에 또는 이전 버전에서 가장 중요한 경우임).

연속된 각주가 두 개 이상 추가되는 경우는 거의 없다고 생각했기 때문에 MWE에 표시된 다음과 같은 (매우 조잡하고 더러운) 해킹을 시도했습니다.

\documentclass{article}
\newcommand{\myextrafootnote}[1]{\renewcommand{\thefootnote}{\arabic{footnote}a}\footnote[\thefootnote]{#1}\renewcommand{\thefootnote}{\arabic{footnote}}}%
\begin{document}
This is the old text\footnote{foo}, followed by the new insert\myextrafootnote{New Exciting Stuff!!}, followed by the old next one.\footnote{bar}
\end{document}

안타깝게도 제가 바라던 대로 작동하지 않습니다. 각주 자체는 다음과 같이 표시됩니다. 각주, 사이에 약간의 추가 내용 포함

텍스트는 추가 정보를 얻습니다.a 또한다음과 같이 각주 바로 앞에 추가되었습니다. 실제로 원하는 것보다 더 많은 추가 내용이 포함된 텍스트

물론 이상적으로는 a어떤 형태의 카운터에서도 나올 것입니다. (저도 그렇게 시도했지만 누락된 인수에 대한 많은 오류 메시지로 바뀌었기 때문에 이를 포기하고 전문가에게 문의하는 것이 더 나을 것으로 결정했습니다...) 그래서만약에연속해서 추가된 각주가 두 개 이상 있어도 여전히 올바르게 작동합니다[그리고 지금보다 덜 조잡합니다].

답변1

\footnote명령 의 선택적 인수는정수해당 번호의 텍스트 표현이 아닌 각주 번호를 포함합니다. 그래서, 당신은 사용해야합니다

\footnote[\value{footnote}]{#1}

대신에

\footnote[\thefootnote]{#1}

덧셈

그렇다면 여분의 "a"는 어디에서 왔습니까? 이를 이해하기 위해 잘못된 코드가 어떻게 나타나는지 단계별로 살펴보겠습니다.

\footnote[\thefootnote]{#1}

TeX로 소화됩니다. 매크로는 \thefootnote(OP가 사용하는 맥락에서) 로 확장되므로 1a(La)TeX는 다음과 같은 것을 봅니다.

\footnote[1a]{...}

그러나 이미 말했듯이 선택적 인수가 정수 값을 포함할 것으로 예상합니다. 이 정수 값은 내부 명령 내의 전용 카운터( 컨텍스트에 따라 footnote또는 )에 로컬로 할당됩니다 . 이 과제의 코드는 (와 동일)입니다.mpfootnote\@xfootnote

<counter> = #1\relax

우리의 경우에는

<counter> = 1a\relax

그러나 이는 a정수 상수를 종료  1하므로 할당도 종료됩니다. 이 시점에서 a토큰은 "a" 문자를 가로(, 현재) 모드입니다. 그리고 여기 있습니다.

답변2

다음은 사용될 extrastuff때마다 단계적으로 진행되는 카운터를 추가한 것입니다 .\myextrafootnote

그러나 이 방법으로는 추가 이상의 26추가가 불가능합니다. 왜냐하면 \alph{extrastuff}가 사용되기 때문입니다.

더 많은 추가 기능이 필요한 경우 alphalph카운터 출력을 높이는 패키지가 유용합니다!

\documentclass{book}


\newcounter{extrastuff}[chapter]

\newcommand{\myextrafootnote}[1]{%
  \stepcounter{extrastuff}%
  \begingroup
  \renewcommand{\thefootnote}{\arabic{footnote}\alph{extrastuff}}%
  \footnote[\value{footnote}]{#1}%
  \endgroup
}%
\begin{document}

This is the old text\footnote{foo}, followed by the new insert\myextrafootnote{New Exciting Stuff!!}, followed by the old next one.\footnote{bar}

New however is this text\myextrafootnote{Really new Exciting Stuff!!}, followed by the old next one.\footnote{foobar}
\end{document}

여기에 이미지 설명을 입력하세요

업데이트

extrastuff각주 카운터로 재설정 :

\documentclass{book}


\newcounter{extrastuff}[footnote]

\newcommand{\myextrafootnote}[1]{%
  \stepcounter{extrastuff}%
  \begingroup
  \renewcommand{\thefootnote}{\arabic{footnote}\alph{extrastuff}}%
  \footnote[\value{footnote}]{#1}%
  \endgroup
}%
\begin{document}

This is the old text\footnote{foo}, followed by the new insert\myextrafootnote{New Exciting Stuff!!}, now for something completely different\myextrafootnote{Other top secret content}, followed by the old next one.\footnote{bar}

New however is this text\myextrafootnote{Really new Exciting Stuff!!}, followed by the old next one.\footnote{foobar}
\end{document}

답변3

이것은 단기적인 사고의 좋은 사례입니다. 귀하의 솔루션은 해결하는 것보다 더 많은 문제를 야기합니다. 다음 개정판의 새 각주를 어떻게 표시하시겠습니까?

문서의 두 개정판 사이의 변경 사항을 표시해야 하는 경우 document-version-1.tex와 document-version-2.tex 사이에 »diff<를 제공하세요. 후자가 최신 개정판입니다.

를 살펴보십시오. 콘솔 창에 latexdiff입력하면 설명서를 얻을 수 있습니다 . texdoc latexdiff기본적으로는 그냥

latexdiff document-version-1.tex document-version-2.tex > document-diff.tex

그런 다음 document-diff.tex를 열고 컴파일합니다. PDF에는 모든 변경 사항이 포함되어 있습니다.

삭제 및 추가의 색상과 마크업을 선택할 수 있습니다. 나는 다음과 같은 것을 넣는 것을 선호합니다

\providecommand{\DIFadd}[1]{{\protect\color{blue}#1}} %DIF PREAMBLE
\providecommand{\DIFdel}[1]{{\protect\color{red}\protect\scriptsize{#1}}}

document-diff.tex의 프리앰블에 들어갑니다.

이는 문서의 두 버전 간의 차이점을 명확하게 표시할 수 있다는 장점이 있습니다. 현재와 ​​미래의 모든 개정판에 대해.

많은 개정이 예상되는 경우 git 및 latexbatchdiff와 같은 버전 제어 시스템을 사용하는 것이 좋습니다. 여기를 참조하세요.https://tex.stackexchange.com/a/44092/4736

관련 정보