6

I've made one command so as to not polluate text with web links. I would like to improve my command so as to do the following things.

  1. I would like that the footnotes used for URL have their own behavior, their own counter, and also one special formatting for the number of the footnotes.
  2. The other kinds of footnotes must keep there usual behavior.

Is it possible ?

Here is my code.

\documentclass[10pt]{article}
    \usepackage{hyperref}
    \usepackage{xcolor}

    \newcounter{UrlCounter}
    \setcounter{UrlCounter}{1}
    \newcommand{\myUrl}[1]{%
        \textcolor{blue}{\url{http://link/\#\theUrlCounter/}} \footnote{\url{#1}} %
        \addtocounter{UrlCounter}{1}%
    }

    \usepackage{lipsum}


\begin{document}

Let's try to indicate one URL \myUrl{http://www.google.fr/}
and another \myUrl{http://tex.stackexchange.com/}.
I would like to indicate something \footnote{... but here !}.

\lipsum

Let's try to indicate one URL \myUrl{http://www.google.fr/}
and another \myUrl{http://tex.stackexchange.com/}.
I would like to indicate something \footnote{... but here !}.

\end{document}

ONE SOLUTION

Thanks to the following answer, here is one functional code. I've used another tricky command so as to use \texttt with automatic back return because I cannot use \url for the not poluatting URLS in the text which are not real URLS.

% Sources : 
%   * http://tex.stackexchange.com/questions/35095/special-footnotes-for-url/35097#35097
%   * http://forum.mathematex.net/latex-f6/forcer-le-retour-a-la-ligne-dans-texttt-t13246.html#p127511
%   * http://tex.stackexchange.com/questions/33465/changing-the-catcode-of-in-one-command

\documentclass[10pt]{article}
    \usepackage[svgnames]{xcolor}
    \usepackage{manyfoot}
    \usepackage{hyperref}
    \hypersetup{urlcolor=blue}

% Beakable texttt command.
    \makeatletter
        \newcommand\breakabletexttt[1]{%
            \begingroup\ttfamily
            \scantokens{\catcode`\_12\makeatletter\breakable@texttt#1\@nil}%
            \endgroup%
        }
        \def\@gobble@fi#1\fi{\fi#1}
        \def\breakable@texttt#1#2\@nil{%
            #1\hspace{0pt plus 0.1pt minus 0.1pt}%
            \ifx\relax#2\relax
            \else
                \@gobble@fi\breakable@texttt#2\@nil
            \fi
        }
    \makeatother

% Special footnote
    \newfootnote{Url}

    \newcounter{footnoteUrl}
    \newcommand{\footnoteUrl}{%
%       \renewcommand\thefootnoteUrl{\Alph{footnoteUrl}}
        \stepcounter{footnoteUrl}%
        \Footnotemark{\textcolor{DarkRed}{\textbf{\#\thefootnoteUrl}}}\FootnotetextUrl{}%
    }

% Special url
    \newcommand{\myUrl}[1]{%
        \textcolor{DarkRed}{\textbf{\breakabletexttt{http://link/}}}\footnoteUrl{\, \url{#1}}%
    }

    \usepackage{lipsum}


\begin{document}

Let's try to indicate one URL \myUrl{http://www.google.fr/}
and another \myUrl{http://tex.stackexchange.com/}.
Let's try to indicate one URL \myUrl{http://www.google.fr/}
and one more \myUrl{http://tex.stackexchange.com/}.
I would like to indicate something \footnote{... but here !}.

\lipsum

Let's try to indicate one URL \myUrl{http://www.google.fr/}
and another \myUrl{http://tex.stackexchange.com/}.
Let's try to indicate one URL \myUrl{http://www.google.fr/}
and one more \myUrl{http://tex.stackexchange.com/}.
I would like to indicate something \footnote{... but here !}.

\end{document}

1 Answer 1

9

Using the manyfoot package you can easily create "new" footnotes; a littl example:

\documentclass[10pt]{article}
\usepackage{xcolor}
\usepackage{manyfoot}
\usepackage{hyperref}
\hypersetup{urlcolor=blue}

\newfootnote{A}

\newcounter{footnoteA}
\newcommand{\footnoteA}{%
  \renewcommand\thefootnoteA{\Alph{footnoteA}}
  \stepcounter{footnoteA}%
  \Footnotemark\thefootnoteA \FootnotetextA{}}

\newcommand{\myUrl}[1]{%
    \footnoteA{\url{#1}}}

\begin{document}

\footnote{standard footnote one}
\myUrl{http://tex.stackexchange.com}
\footnote{standard footnote two}
\myUrl{http://math.stackexchange.com}

\end{document}

enter image description here

0

You must log in to answer this question.

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