1

I have a KOMA-based document where section footnotes and text footnotes are formatted differently:

\documentclass{scrartcl}

\setlength\parindent{24pt}

\usepackage[symbol]{footmisc}
\usepackage{hyperref}

\begin{document}
    \protected\def\hidefootnoteSec{\MakeUppercase{Section footnote.}} % https://tex.stackexchange.com/a/46532)
    \begingroup%
    \deffootnote[1em]{1.5em}{1em}{{\Large\thefootnotemark}\hspace*{.5em}}
    \section[A section]{A section{\protect\NoHyper\protect\footnote[1]{\hidefootnoteSec}\protect\endNoHyper}}
    \endgroup%

    Test paragraph: should not be indented, but~due to~\verb|group| enclosing section it is.

    Second test paragraph~\footnote{text footnote.}:~should be indented.
\end{document}

In general, first paragraph of a section in such document is not indented, but in this case, the \begingroup\endgroup declaration causes LaTeX to fail on detecting that there is section declared just above the first paragraph. Simply removing the group would make the formatting affect the next footnotes too.

Of course, it is possible to manually force \noindent in the first paragraph. Yet here I am looking for a more automated solution, so that in a bigger document one does not need to always remember about such additions when adding/removing new footnotes or changing the global indentation.

Documents

Is it possible to automatically detect first paragraph after such footnoted–grouped sections for the purpose of (not) indenting it?

1
  • 3
    don't put a group and footnote redefinition in the document, just redefine footnotes within the group already used for setting up the heading fonts. Commented Jul 25, 2019 at 10:47

1 Answer 1

2

You can patch the footnote redefinition into \sectionlinesformat (KOMA-Script command provided by scrartcl):

\documentclass{scrartcl}
\setlength\parindent{24pt}

\usepackage{xpatch}
\xpretocmd{\sectionlinesformat}
  {\ifstr{#1}{section}{\deffootnote[1em]{1.5em}{1em}{{\Large\thefootnotemark}\hspace*{.5em}}}{}}
  {}{\PatchFailed}

\usepackage[symbol]{footmisc}
\usepackage{hyperref}

\begin{document}
\protected\def\hidefootnoteSec{\MakeUppercase{Section footnote.}} % https://tex.stackexchange.com/a/46532)
\section[A section]{A section{\protect\NoHyper\protect\footnote[1]{\hidefootnoteSec}\protect\endNoHyper}}

Test paragraph: should not be indented, but~due to~\verb|group| enclosing section it is.

Second test paragraph~\footnote{text footnote.}:~should be indented.
\end{document}

enter image description here

Or without the \hidefootnoteSec:

\documentclass{scrartcl}
\setlength\parindent{24pt}

\usepackage{xpatch}
\xpretocmd{\sectionlinesformat}
  {\ifstr{#1}{section}{\deffootnote[1em]{1.5em}{1em}{{\Large\thefootnotemark}\hspace*{.5em}}}{}}
  {}{\PatchFailed}

\usepackage[symbol]{footmisc}
\usepackage{hyperref}

\begin{document}
\section[A section]{A section{\NoHyper\footnote[1]{\MakeUppercase{Section footnote.}}\endNoHyper}}

Test paragraph: should not be indented, but~due to~\verb|group| enclosing section it is.

Second test paragraph~\footnote{text footnote.}:~should be indented.
\end{document}

With the prerelease of KOMA-Script version 3.27 (available here) you can also use \AddtoDoHook

\documentclass{scrartcl}[2019/07/23]% needs at least prerelease 3.27.3175
\setlength\parindent{24pt}

\newcommand\sectionfootnote[1]{\deffootnote[1em]{1.5em}{1em}{{\Large\thefootnotemark}\hspace*{.5em}}}
\AddtoDoHook{heading/begingroup/section}{\sectionfootnote}

\usepackage[symbol]{footmisc}
\usepackage{hyperref}

\begin{document}
\section[A section]{A section{\NoHyper\footnote[1]{\MakeUppercase{Section footnote.}}\endNoHyper}}

Test paragraph: should not be indented, but~due to~\verb|group| enclosing section it is.

Second test paragraph~\footnote{text footnote.}:~should be indented.
\end{document}

or \AddtoOneTimeDoHook:

\documentclass{scrartcl}[2019/07/23]% needs at least prerelease 3.27.3175
\setlength\parindent{24pt}

\newcommand*\sectionfootnote[1]{\deffootnote[1em]{1.5em}{1em}{{\Large\thefootnotemark}\hspace*{.5em}}}

\usepackage[symbol]{footmisc}
\usepackage{hyperref}

\begin{document}

\AddtoOneTimeDoHook{heading/begingroup/section}{\sectionfootnote}% only for the next \section
\section[A section]{A section{\NoHyper\footnote[1]{\MakeUppercase{Section footnote.}}\endNoHyper}}

Test paragraph: should not be indented, but~due to~\verb|group| enclosing section it is.

Second test paragraph~\footnote{text footnote.}:~should be indented.
\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .