diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/morehype/texlinks.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/morehype/texlinks.sty | 86 |
1 files changed, 71 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/latex/morehype/texlinks.sty b/Master/texmf-dist/tex/latex/morehype/texlinks.sty index 6ab5bca6b06..ed9bbf1a58a 100644 --- a/Master/texmf-dist/tex/latex/morehype/texlinks.sty +++ b/Master/texmf-dist/tex/latex/morehype/texlinks.sty @@ -1,5 +1,5 @@ \NeedsTeXFormat{LaTeX2e}[1994/12/01] %% \newcommand* etc. -\ProvidesPackage{texlinks}[2011/01/24 v0.1 TeX-related links (UL)] +\ProvidesPackage{texlinks}[2011/01/27 v0.2 TeX-related links (UL)] %% copyright (C) 2011 Uwe Lueck, %% http://www.contact-ednotes.sty.de.vu %% -- author-maintained in the sense of LPPL below. @@ -38,11 +38,14 @@ %% troublesome. I consider it a good idea to present %% links with their URL as the displayed text in \emph{footnotes} %% (or endnotes). It may even be useful with HTML to present -%% the URLs displayed in some "appendix". -%% -%% I tend to introduce something for this ... and there might be a -%% package option forcing `\httpref' to use this style. -%% Well, better \emph{not today} ... [2011/01/24, TODO] +%% the URLs displayed in some +%% 2011/01/27: +%% ``appendix."---This idea has been resumed in v0.2 only, +%% |\urlfoot|. +%% % +%% % I tend to introduce something for this ... and there might be a +%% % package option forcing `\httpref' to use this style. +%% % Well, better \emph{not today} ... [2011/01/24, TODO] %% %% == Package Options == %% Somebody may want to suppress a definition of `\httpref' @@ -63,29 +66,78 @@ }{\newcommand*{\httpref}[1]{\href{http://#1}}}} %% %% == Variants of &\httpref == +%% |\NormalHTTPref| may be used as an alias for `\httpref' +%% in situations where the latter has been redefined: %% v0.2 +\AtBeginDocument{%% TODO: options, guarded \let (mine, HO) + \@ifdefinable\NormalHTTPref{\let\NormalHTTPref\httpref}} %% |\ithttpref{<url>}{<text>}| displays <text> in italics: -\newcommand*{\ithttpref}[2]{\httpref{#1}{\textit{#2}}} %% 2010/12/03 -%% With |\urlhttpref{<host-path[#frag]>}|, that URL -%% is displayed: -\newcommand* \urlhttpref [1] {\httpref{#1}{\urlfmt{\httpprefix#1}}} +\newcommand*{\ithttpref}[2]{\NormalHTTPref{#1}{\textit{#2}}} +%% With |\urlhttpref{<url>}|, that URL is displayed: +\newcommand*{\urlhttpref}[1]{% + \NormalHTTPref{#1}{\urlfmt{\httpprefix#1}}} %% |\httpprefix| is an idea that was missing in 'blog.sty' up to v0.3. %% It may be used to determine generally whether a display of an %% URL should include `http://'. I choose as default what was default -%% in 'blog.sty': -\newcommand\httpprefix{} \let\httpprefix\@empty +%% in 'blog.sty' +%% (i.e., ``don't include"): %% add. 2011/01/27 +\@ifdefinable\httpprefix{\let\httpprefix\@empty} %% TODO cf. above %% `\let\httpprefix\relax' would be bad for 'blog.sty' %% (would display `\relax'), %% while it would be somewhat more efficient.%%%---%%% %% %% Now you may customize `\httpprefix' by -%% \[`\renewcommand{\httpprefix}{http://}'.\] -%% +%% \[`\renewcommand{\httpprefix}{http://}'\] +%% %% v0.2: +%% ---or by `\let\httpprefix'|\theHTTPprefix|: +\newcommand*{\theHTTPprefix}{http://} %% |\urlfmt{<url>}| is chosen as `\texttt' here and may be %% customized, e.g., with the 'breakurl' package. -\newcommand* \urlfmt [1] {} \let\urlfmt\texttt +\@ifdefinable\urlfmt{\let\urlfmt\texttt} %% In 'blog.sty' (as of 2010/05/26), there was a command %% `\urlref' instead of `\urlhttpref'. It did not provide `\urlfmt'. %% +%% |\foothttpurlref{<url>}| just is like +%% `\footnote{\urlhttpref{<url>}}': +\newcommand*{\foothttpurlref}[1]{\footnote{\urlhttpref{#1}}} +%% |\urlfoot{<short>}{<id>}| +%% redefines `\httpref' so that you can use all the shorthand +%% macros based on `\httpref' to get the according URL +%% display (as provided by `\urlhttpref') +%% in a footnote without the need to include the +%% entire URL in your source code. `\urlfoot' is available +%% with <short> and <id> +%% when a shorthand |\<short>{<id>}{<text>}| has been defined +%% where `\<short>' is the macro name and <id> is the target +%% identifier (usually part of the URL generated from <id>) +%% according to the syntax declaration of `\<short>'. +\newcommand*{\urlfoot}[2]{{% + \let\httpref\foothttpurlref + \let\httpprefix\theHTTPprefix %% TODO customizable!? + \csname #1\endcsname{#2}{}}} +%% \strong{Example:} +%% \[`\CtanPkgRef{morehype}{MoreHype}' +%% \mbox{\quad and\quad } `\ctanpkgref{morehype}'\] +%% are provided below for linking to +%% `http://ctan.org/pkg/morehype'. +%% \begin{itemize} +%% \item Try `CtanPkgRef' \emph{here}: +%% \CtanPkgRef{morehype}{MoreHype},\\ +%% for the \emph{footnote} try +%% `\urlfoot{CtanPkgRef}{morehype}';%%% +%% \urlfoot{CtanPkgRef}{morehype} +%% \item try `ctanpkgref' \emph{here}: \ctanpkgref{morehype},\\ +%% for the \emph{footnote} try +%% `\urlfoot{ctanpkgref}{morehype}'.%%% +%% \urlfoot{ctanpkgref}{morehype} +%% \end{itemize} +%% The lonely \qtd{\pkgnamefmt{morehype}} demonstrates that +%% it doesn't work with `ctanpkgref' because +%% `\ctanpkgref' doesn't have separate arguments for +%% <id> and <text>, it actually doubles <id>. +%% A local `\let\ctanpkgref\CtanPkgRef' could help, +%% but right now I prefer waiting for a better idea. +%% [TODO] %% 2011/01/27 +%% %% == Wikipedia == %% |\Wikideref{<lemma>}| refers to article <lemma> in the German %% Wikipedia. (The next considerations apply to English @@ -259,3 +311,7 @@ %% %% == VERSION HISTORY == v0.1 2011/01/24 new file, code from blog.sty v0.3 +v0.2 2011/01/27 \urlfoot, \NormalHTTPref, \foothttpurlref, + "outline" adjusted; + more consistent use of \newcommand and + \@ifdefinable (TODO: guarded \let) |