6

I didn't find any option with the footmisc package to align the footnotes on the left (in otherwords, some kind of auto-\raggedright). Could I do it without any package, namely with some \newcommand\isFootnote trick? Or maybe with another package?

I need this as some web references I put in footnotes look very strange when they are justified, gaining spaces in inapproriate places e.g. http : //www...). Or should I possibly use another formating feature to force the urls not to be split with spaces?

Update: I now understand this is related to my other footmisc hang & multiple issue, which now redirects to another post. So it has something to do with the babel package (the order, either [english,french] or [french,english] doesn't make a difference about the url splitting / hyphentation issue, putting french in the first place only fixes hanging and multiple!). When using french language, there is no hyphenation on the footnote and the url looks very ugly (adding a space between http and ://webaddress). No problem with the footnote linked to the english text.

\documentclass{article}
\usepackage[hang,multiple]{footmisc}
\usepackage[hyperfootnotes=false]{hyperref}
\newcommand\ftnote[1]{\footnote{\raggedright#1}}
\usepackage[english,french]{babel}
\begin{document}
\selectlanguage{french}
\og texte en fran�ais \fg{} %
\footnote{celaaaaaaaaaaaaaaa <http://www.address.net/long/path/to/filename.html>
cellllllllllllllllllla%
}%
\footnote{v�rification%
}
\selectlanguage{english}
english text%
\footnote{thisssssssssssssss <http://www.address.net/long/path/to/filename.html>
thiiiiiiiiiiiiiiiiiiiiis%
}%
\footnote{multiple check%
}
\end{document}

One way -- not necessarily the best way -- to deal with that would simply be left alignment. And the newcommand raggedright trick provided in the first answer, and which I included in this code, doesn't seem to work.

Besides, this may be a newbie LaTeX question but how to write < and > signs around the url (it is a standard here at least)? When I do \lt and \gt the compiler says the fontenc package is missing and then, when added, it complains about an undefined control sequence. I don't have this issue with LyX but I am switching to TeX for those footnote troubleshootings.

At last, although 'hang' and 'multiple' do succesfully work here (english and french text need to be on seperate lines in the body, though), as I am mixing french and english languages on the same page, it doesn't mean it's going to work fine on several pages with only french as language. I should try that in that another subject.

Thank you for the help!

Second update: thanks to everyone for those inputs. Now there is one additional difficulty. I would like to use the para option with footmisc. This options allows to have multiple footnotes added one after the other just like a paragraph and this obviously affects the raggedright behaviour. This option conflicts with the 'ragged' footmisc option (which seems to be enabled by default? As it just works without para...), by the way.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french,english]{babel}
\frenchbsetup{FrenchFootnotes=false}
\usepackage[para,hang,multiple]{footmisc}
\renewcommand{\footnotelayout}{\raggedright} % for having raggedright footnotes
\usepackage[hyperfootnotes=false]{hyperref}

\begin{document}
\selectlanguage{french}
\og texte en français \fg{}%
\footnote{celaaaaaaaaaaaaaaa \url{http://www.address.net/long/path/to/filename.html}
cellllllllllllllllllla%
}%
\footnote{vérification%
}
\end{document}

Note. I checked with more usual french words and hyphentation now seems to work. Note. Ok \frenchbsetup is needed when english comes at first when calling the babel package. I need to call french first, though, otherwise the little comma (footmisc multiple) doesn't appear in the body, and then \selectlanguage{french}, so I guess I could remove it.

1
  • Firstly, you should code urls as \url{<http://....>}, otherwise LaTeX is trying to treat them as ordinary text. Secondly, you example contains long "words" that don't have standard letter combinations and so have few hyphenation points. Replacing them by ordinary text should give LaTeX more places to break the lines. I also suggest you use \usepackage[babel]{csquotes} and its command \enquote for your quotations. Aug 30, 2013 at 8:43

2 Answers 2

8

footmisc has no effect with the french option to babel enabled as the main language, unless one issues

\frenchbsetup{FrenchFootnotes=false}

because, otherwise, the code for “French footnotes” is used, which is not influenced by footmisc.

It's also better to use the \url command that makes delimiters <...> useless.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,french]{babel}
\frenchbsetup{FrenchFootnotes=false}

\usepackage[hang,multiple]{footmisc}

\renewcommand{\footnotelayout}{\raggedright} % for having raggedright footnotes

\usepackage[hyperfootnotes=false]{hyperref}

\begin{document}

\og texte en français \fg{}%
\footnote{celaaaaaaaaaaaaaaa \url{http://www.address.net/long/path/to/filename.html}
cellllllllllllllllllla%
}%
\footnote{vérification%
}

\selectlanguage{english}
english text%
\footnote{thisssssssssssssss \url{http://www.address.net/long/path/to/filename.html}
thiiiiiiiiiiiiiiiiiiiiis%
}%
\footnote{multiple check%
}
\end{document}

enter image description here

1
  • Thank you, this works but note that 'multiple' doesn't work in the body. One has to invert to [french,english] to enable english and only then, in the body, switch back to french with \selectlanguage. Also, I would like to use the para option with footmisc, which disables the riggedright effect. Any idea why?
    – elge
    Aug 30, 2013 at 13:28
2

You can create a separate macro, that inserts \raggedright as the first command to the footnote:

\documentclass{article}
\newcommand\ftnote[1]{\footnote{\raggedright#1}}
\begin{document}
A\ftnote{this this this this this this this this this this this this
this this this this this this this this this this this this this this
this this thi this this this this this this this this this this this
this this thisss this this this this this this this this this this this
this this this this this this this this this this this this this this
this this this}
\end{document}
8
  • Thanks, I believe it could work, but it really doesn't: I still got a wide kind of alignment with the urls splitted up
    – elge
    Aug 29, 2013 at 17:00
  • @elge It would help if you posted a minimum working example (MWE), starting with \documentclass to demonstrate the problem for the readers. Aug 29, 2013 at 17:12
  • @elge: If the URLs are splitting up, then I guess you're using the url package and setting them via \url{...}? Do you not want them to break?
    – Werner
    Aug 29, 2013 at 17:23
  • I couldn't reproduce the weired < http : //www... > issue in this remake but the
    – elge
    Aug 29, 2013 at 17:27
  • I am unable to reproduce the issue I am having in a shorter tex document. Especially the < http : // issue (which the url packages fixes, by the way -- thanks!).
    – elge
    Aug 29, 2013 at 17:45

You must log in to answer this question.

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