开发者

LaTeX blank after number and before text

开发者 https://www.devze.com 2022-12-13 18:05 出处:网络
How could I make a blank after the number in my footnotes? In a general way, for ALL footnotes! Exampl开发者_开发知识库e:

How could I make a blank after the number in my footnotes? In a general way, for ALL footnotes!

Exampl开发者_开发知识库e:

good: 1 Hello World

bad : 1Hello World


The correct answer is not to redefine \thefootnote, because that adds space wherever the footnote is referenced; for example:

\documentclass{article}
\renewcommand{\thefootnote}{\arabic{footnote}~}
\begin{document}
hello\footnote{test\label{foo}} but don't forget about fn.\,\ref{foo}.
\end{document}

Note the extra space when the footnote number is referred to!

The footnote itself (including the number) is placed by the macro \@makefntext, whose default definition is

\parindent 1em\noindent \hb@xt@ 1.8em{\hss \@makefnmark }#1

Here's an example of a replacement that adds some space after the footnote number:

\documentclass{article}
\makeatletter
\long\def\@makefntext#1{%
  \parindent 1em\noindent\hb@xt@ 1.8em{\hss\@makefnmark}~#1%
}
\makeatother
\begin{document}
hello\footnote{test\label{foo}} but don't forget about fn.\,\ref{foo}.
\end{document}

You might also wish to reduce the indent on the left, for example.


EDIT: Ok, redesigned. Ugly hack, but hey, isn't LaTeX just a whole bunch of those?

Put the following into your preamble:

\let\myfootnote\footnote
\renewcommand{\footnote}[1]{\myfootnote{~#1}}

This will simply prefix your footnote text automagically with a non-breaking space, therefore creating a space after the foot note mark at the bottom of the page. And it won't touch the footnote mark in the middle of the text which is why it still works properly directly before punctuation.


\hspace 

can always supply horizontal spacing somewhere.

\footnote{\ insert footnote here}
\footnote{~insert footnote here}

Work, but I do not know if it is the official way to do it. The "~" is officially used in cases like:

Mr.~Smith 

To provide the usual whitespace after the abbreviation "." The "\ " I do not know, I just happend to see its use some time ago after accidently putting it in a sentence.


You could try ~ a non-breakable space


I made myself an account, but now I couldn't comment the answers, so I posed my solution. I tried Will's version, but I have problems if the footnote is to long and needed a new line.

So based on his work I find this:

\makeatletter
 \renewcommand{\@makefntext}[1]{%
    \setlength{\parindent}{0pt}
    \begin{list}{}{%
        \setlength{\topsep}{0pt}
        \setlength{\partopsep}{0pt}
        \setlength{\labelwidth}{1em} % Space from number to border
        \setlength{\labelsep}{0.3em} % Space from number to text
        \setlength{\leftmargin}{\labelwidth}
        \addtolength{\leftmargin}{\labelsep}
        \footnotesize}\item[{\makebox[\labelwidth][r]{\@makefnmark}}]#1%
    \end{list}
 }
\makeatother

Thanks for all of your help, now it is looking very nice and I haven account ;).

0

精彩评论

暂无评论...
验证码 换一张
取 消