diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/morehype/texlinks.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/morehype/texlinks.sty | 169 |
1 files changed, 115 insertions, 54 deletions
diff --git a/Master/texmf-dist/tex/latex/morehype/texlinks.sty b/Master/texmf-dist/tex/latex/morehype/texlinks.sty index ac546b89f67..8ca6e2da521 100644 --- a/Master/texmf-dist/tex/latex/morehype/texlinks.sty +++ b/Master/texmf-dist/tex/latex/morehype/texlinks.sty @@ -1,6 +1,6 @@ \NeedsTeXFormat{LaTeX2e}[1994/12/01] %% \newcommand* etc. -\ProvidesPackage{texlinks}[2011/10/21 v0.5 TeX-related links (UL)] -%% copyright (C) 2011 Uwe Lueck, +\ProvidesPackage{texlinks}[2012/05/13 v0.6 TeX-related links (UL)] +%% copyright (C) 2011 2012 Uwe Lueck, %% http://www.contact-ednotes.sty.de.vu %% -- author-maintained in the sense of LPPL below. %% @@ -158,7 +158,7 @@ %% With |\urlhttpsref{<url>}|, we \emph{force} displaying \qtd{`https://'}: \newcommand*{\urlhttpsref}[1]{\httpsref{#1}{\urlfmt{https://#1}}} %% -%% === Linking \URL s in Footnotes === %% 2011/08/27 +%% === Linking \URL s in Footnotes === %% 2011/08/27 %% \label{sec:urlfoot} %% |\foothttpurlref{<url>}| just is like %% `\footnote{\urlhttpref{<url>}}': @@ -207,31 +207,56 @@ %% we get |\urlpkgfoot{<package-id>}|, abbreviating %% `\urlfoot{CtanPkgRef}{<package-id>}': \newcommand* {\urlpkgfoot} {\urlfoot{CtanPkgRef}} +%% === \URL\ Bases === %% 2012/03/09 +%% \label{sec:bases} +%% We typically refer to many web pages under a certain domain, +%% or in certain subdirectories there. Before v0.6, +%% I made many definitions like +%% \[`\newcommand*{\myref}[1]{\httpref{<my-base>/#1}}'\] +%% for this purpose. +%% Storing the definition of such a `\myref' uses 6 tokens +%% (including parameter text---TODO) in addition to those from <my-base>. +%% With +%% \[`\newcommand*{\myref}{\httpbaseref{<my-base>}'\] +%% we need 3 tokens instead, using |\httpbaseref{<base>}{<rest>}| +%% defined as follows: +\newcommand*{\httpbaseref}[2]{\httpref{#1/#2}} +%% We change many definitions in ensuing sections accordingly. +%% +%% The situation is similar with (many) anchors of a (large) web page. +%% With v0.6, we introduce |\httpancref{<page-url>}{<anchor>}|---perhaps, +%% with `\mirrorctanref' (Sec.~\ref{sec:bytopic}) etc.? TODO +% \newcommand*{\httpancref}[2]{\httpref{#1\##2}} %% %% == Wikipedia == %% %% TODO separate wikilink.sty? https:!? %% === Backbones === -%% As of v0.4, we have a \dqtd{backbone} macro -%% \[|\wikiref{<language-code>}{<lemma>}{<text>}|\] -%% for links to Wikipedia. <language-code> consists of +%% As of v0.6, we have a \dqtd{backbone} macro +%% \[|\wikilangref{<language-code>}{<lemma>}{<text>}|\] +%% for links to Wikipedia. +%% (It was |\wikiref| before, starting with v0.4---sorry!) +%% <language-code> consists of %% two characters like \lq`de'\rq\ for German Wikipedia articles %% or \lq`en'\rq\ for English ones. <lemma> is the identifier of %% the article, and <text> is displayed as the link: -\newcommand*{\wikiref}[2]{\httpref{#1.wikipedia.org/wiki/#2}} -%% There is |\Wikiref{<language-code>}{<lemma>}| +% \newcommand*{\wikilangref}[2]{\httpref{#1.wikipedia.org/wiki/#2}} +%% <- 2012/03/09 etc. with Sec.~\ref{sec:bases} -> +\newcommand*{\wikilangref}[1]{\httpbaseref{#1.wikipedia.org/wiki}} +%% There is |\Wikilangref{<language-code>}{<lemma>}| %% for the case that <lemma> and <text> are the same: -\newcommand*{\Wikiref}[2]{\wikiref{#1}{#2}{#2}} -%% We could have `\wikiref{<lang>}[<id>]{<text>}' instead, then -%% `\Wikiref' would not be needed; however, the present code is to -%% work with 'blog.sty', where optional arguments fail.%%%--- +\newcommand*{\Wikilangref}[2]{\wikilangref{#1}{#2}{#2}} +%% `\wikilangref{<lang>}[<lemma>]{<text>}' would be nicer; +%% %% <- shortened 2012/01/06 -> +%% however, the present code is to work with 'blog.sty' +%% which does not support optional arguments.%%%--- %% %% Quite often, programs share their names with movies, %% biological species, etc., then lemma disambiguation is required. %% Usually, we don't want to display the disambiguation. -%% \[|\Wikidisambref{<language-code>}{<term>}{<suffix>}|\] +%% \[|\Wikilangdisambref{<language-code>}{<term>}{<suffix>}|\] %% will link to -%% \[`http://en.wikipedia.org/wiki/<term>_(<suffix>)'\] -\newcommand*{\Wikidisambref}[3]{\wikiref{#1}{#2 (#3)}{#2}} +%% \[`http://<language-code>.wikipedia.org/wiki/<term>_(<suffix>)'\] +\newcommand*{\Wikilangdisambref}[3]{\wikilangref{#1}{#2 (#3)}{#2}} %% There %% was `Their' 2011/07/23 %% was something like a more general variant |\wikidisambref|, %% now I doubt its usefulness and \textcolor{blue}{omit} it @@ -241,30 +266,45 @@ %% even with 'hyperref'. %% \par\smallskip\noindent %% \strong{Example:}\quad -%% `\wikienref{TeX#History}{\TeX}' +%% `\wikilangref{en}{TeX#History}{\TeX}' %% was wikilangenref 2012/05/13 %% \ for \ -%% \wikienref{TeX#History}{\TeX}. +%% \wikilangref{en}{TeX#History}{\TeX}. %% %% === English and German === %% The next macros just save you from typing braces around %% the language codes for English and German: %% |\wikienref{<lemma>}{<text>}| refers to the English Wikipedia, %% |\wikideref{<lemma>}{<text>}| refers to the German one. -\newcommand*{\wikideref}{\wikiref{de}} -\newcommand*{\wikienref}{\wikiref{en}} +\newcommand*{\wikideref}{\wikilangref{de}} +\newcommand*{\wikienref}{\wikilangref{en}} %% |\Wikideref{<lemma>}| refers to article <lemma> in the German %% Wikipedia and displays <lemma> as <text>: -\newcommand*{\Wikideref}{\Wikiref{de}} +\newcommand*{\Wikideref}{\Wikilangref{de}} %% |\Wikienref{<lemma>}| is `\Wikideref''s analogue for English: -\newcommand*{\Wikienref}{\Wikiref{en}} +\newcommand*{\Wikienref}{\Wikilangref{en}} %% |\Wikidedisambref{<lemma>}{<suffix>}| chooses a disambiguation %% according to <suffix> for the German Wikipedia, %% |\Wikiendisambref{<lemma>}{<suffix>}| for the English one: -\newcommand*{\Wikidedisambref}{\Wikidisambref{de}} -\newcommand*{\Wikiendisambref}{\Wikidisambref{en}} +\newcommand*{\Wikidedisambref}{\Wikilangdisambref{de}} +\newcommand*{\Wikiendisambref}{\Wikilangdisambref{en}} +%% +%% === ``Implicit" Choice of Language === %% 2012/01/06 +%% With v0.6, |\wikiref{<lemma>}{<text>}| works like +%% \[|\wikilang{<lc>}{<lemma>}{<text>}|\] when |\langcode| expands to <lc> +%% (the two-letter language code according to \Wikiref{ISO 639-1}). +%% The default for <lc> is `en' for English. +%% It can be overridden even before loading 'texlinks' +%% (e.g., by an earlier `\newcommand\langcode{de}'): +\providecommand*{\langcode}{en} +%% For the German versions, use `\renewcommand\langcode{de}'. +%% You may find a package 'langcode' providing a command +%% `\uselangcode{<lc>}' that adjusts a number of other settings. +\newcommand*{\wikiref}{\wikilangref\langcode} +%% |\Wikiref| and |Wikidisambref| are the obvious analogues: +\newcommand*{\Wikiref}{\Wikilangref\langcode} +\newcommand*{\Wikidisambref}{\Wikilangdisambref\langcode} %% -%% \pagebreak %% 2011/10/21 -%% === Blanks and Umlauts in \URL s and Anchors === +%% === Blanks and Umlauts in \URL s and Anchors === %% %% <- renamed 2011/05/17 reworked: %% |\underscorechar| seemed to be useful in macro %% definitions. The name was inspired by \LaTeX's @@ -301,28 +341,28 @@ \@namedef{ancuml:o}{.C3.B6} \@namedef{ancuml:u}{.C3.BC} \@namedef{ancuml:s}{.C3.9F} -%% What you read in the rest of the section is -%% \textcolor{blue}{wrong}, the commands are -%% \textcolor{blue}{dropped} for testing as of 2011/05/13. -%% |\itwikideref| is an italic variant of `\wikideref': +%% %% comments removed 2012/01/11: +%% % What you read in the rest of the section is +%% % \textcolor{blue}{wrong}, the commands are +%% % \textcolor{blue}{dropped} for testing as of 2011/05/13. +%% % |\itwikideref| is an italic variant of `\wikideref': % \newcommand*{\itwikideref}[2]{\wikideref{#1}{\textit{#2}}} -%% By analogy to `\Wikideref', -%% The following macros save you from typing the underscore -%% (didn't spaces suffice sometimes?) %% TODO 2011/01/24 -%% and the round parantheses. -%% Italic variant |\itwikienref| of `\wikienref' -%% ('blog.sty' had `\emwikienref' instead): +%% % By analogy to `\Wikideref', +%% % The following macros save you from typing the underscore +%% % (didn't spaces suffice sometimes?) %% TODO 2011/01/24 +%% % and the round parantheses. +%% % Italic variant |\itwikienref| of `\wikienref' +%% % ('blog.sty' had `\emwikienref' instead): % \newcommand*{\itwikienref}[2]{\wikienref{#1}{\textit{#2}}} -%% |\urluml{<ascii-char>}| as of 2010/05/25 -%% (not sure if it ever worked or was actually needed): +%% % |\urluml{<ascii-char>}| as of 2010/05/25 +%% % (not sure if it ever worked or was actually needed): % \newcommand*{\urluml}[1]{\csname urluml:#1\endcsname} % \@namedef{urluml:a}{\#C3\#A4} % \@namedef{urluml:o}{\#C3\#B6} % \@namedef{urluml:u}{\#C3\#BC} % \@namedef{urluml:s}{\#C3\#9F} %% 2010/08/09 %% -%% \pagebreak %% 2011/10/21 -%% == \TeX-related == %% 2010/08/24 +%% == \TeX-related == %% 2010/08/24 %% === \CTAN === %% ==== Directories and Files in a \TeX\ Archive ==== %% % `\newcommand*{\ctanref}[1]{\httpref{ctan.org/#1}}' @@ -330,15 +370,14 @@ %% |\tugctanref{<path>}{<text>}| %% makes <text> a link %% to a \TeX~Archive directory or file <path>: -\newcommand*{\tugctanref}[1]{% - \httpref{tug.ctan.org/tex-archive/#1}} +\newcommand*{\tugctanref}{\httpbaseref{tug.ctan.org/tex-archive}} %% Alternatively, you can refer to an (automatically chosen) %% \CTAN\ \emph{mirror} %% using %% \[|\mirrorctanref{<path>}{<text>}|.\] %% 2011/10/10 :->.2011/10/21: %% (I prefer the \emph{appearance} of the %% \tugctanref{}{\acro{TUG} archive}, designed by Jim Hefferon.) -\newcommand*{\mirrorctanref}[1]{\httpref{mirror.ctan.org/#1}} +\newcommand*{\mirrorctanref}{\httpbaseref{mirror.ctan.org}} %% You may actually want to ``open" a file <file-name> in <path> %% on \CTAN, %% <file-name> displayed as the link text, %% 2011/10/21 @@ -377,6 +416,7 @@ %% accessing your favourite mirror. %% %% ==== J\"urgen Fenn's Topical \TeX\ Catalogue ==== +%% \label{sec:bytopic} %% 2012/03/09 %% |\bytopicref{<anchor>}{<text>}| %% \ %% 2011/10/21 %% makes <text> a link to <anchor> of J\"urgen Fenn's @@ -384,11 +424,17 @@ %% by clicking at the respective \acro{TOC} entry on top of the page %% and then read the \URL\ from the browser's navigation display. \newcommand*{\bytopicref}[1]{% - \httpref{mirror.ctan.org/help/Catalogue/bytopic.html\##1}} + \mirrorctanref{help/Catalogue/bytopic.html\##1}} +%% %% <- \mirrorctanref 2012/03/09 %% (Example:\quad `\bytopicref{html}{\acro{HTML}}' \ for \ %% \bytopicref{html}{\acro{HTML}}.) %% %% ==== Jim Hefferon's Package Descriptions ==== +%% For v0.6 %% 2012/04/09 +%% and in the spirit of Sec.~\ref{sec:bases}, +%% we introduce an auxiliary +%% \[|\ctanorgbaseref{<more-path>}{<text>}|:\] +\newcommand*{\ctanorgbaseref}{\httpbaseref{ctan.org}} %% |\ctanpkgref{<pkg-name>}| %% makes <text> a link to the \CTAN\ package info page for %% the package <pkg-name>. @@ -401,13 +447,18 @@ %% Also, <Name> may be a package from a \emph{bundle} <name> %% where <name> has a description page while <Name> %% doesn't have its \emph{own} description page -%% (such as \CtanPkgRef{nicetext}{makedoc}). +%% (such as \CtanPkgRef{nicetext}{makedoc}---before 2012/04/10!). %% %% <- was `fifinddo' 2011/10/20, no with own id. \newcommand*{\CtanPkgRef}[2]{% - \httpref{ctan.org/pkg/#1}{\pkgnamefmt{#2}}} + \ctanorgbaseref{pkg/#1}{\pkgnamefmt{#2}}} \newcommand*{\ctanpkgref}[1]{\CtanPkgRef{#1}{#1}} +%% Jim Hefferon also offers pages listing all the packages +%% of a given author, accessible by her/his <id>. +%% |\ctanpkgauref{<id>}{<text>}| makes <text> a link to that page: +\newcommand*{\ctanpkgauref}[1]{\ctanorgbaseref{author/id/#1}} +%% E.g., see \ctanpkgauref{lueck}{\emph{my}} packages. %% -%% === \CTAN\ Announcements === %% 2011/06/27 +%% === \CTAN\ Announcements === %% 2011/06/27 %% |\ctanannref{<id>}{<text>}| makes <text> a link %% to the DANTE web page displaying a \CTAN\ %% announcement. You find <id> by searching @@ -437,7 +488,7 @@ %% === \acro{TUG} === %% |\tugref{<path>}{<text>}| makes <text> a link %% to <path> on domain `tug.org': -\newcommand*{\tugref}[1]{\httpref{tug.org/#1}} +\newcommand*{\tugref}{\httpbaseref{tug.org}} %% ==== texhax ==== %% |\texhaxref{<id>}{<text>}| makes <text> a link %% to the \acro{TUG} web page displaying @@ -484,19 +535,19 @@ \newcommand*{\ukfaqref}[1]{\httpref{% www.tex.ac.uk/cgi-bin/texfaq2html?label=#1}} %% === Wikibooks === -%% |\wikibooks{<language-code>}{<file>}{<text>}|: -\newcommand*{\wikibooksref}[2]{\httpref{#1.wikibooks.org/wiki/#2}} +%% |\wikilangbooks{<language-code>}{<file>}{<text>}| +\newcommand*{\wikilangbooksref}[1]{% %% `lang' 2012/01/06 + \httpbaseref{#1.wikibooks.org/wiki}} %% |\latexwikibookref{<file>}{<subject>}{<text>}| refers to the %% (English) \LaTeX\ Wikibook: -\newcommand*{\latexwikibookref}[1]{\wikibooksref{en}{LaTeX/#1}} +\newcommand*{\latexwikibookref}[1]{\wikilangbooksref{en}{LaTeX/#1}} %% The German -%% \wikibooksref{de}{LaTeX-Kompendium}{\dqtd{\LaTeX-Kompendium}} +%% \wikilangbooksref{de}{LaTeX-Kompendium}{\dqtd{\LaTeX-Kompendium}} %% is somewhat difficult, I leave it for now~... %% -%% == Leaving == %% 2011/01/24 +%% == Leaving and Version HISTORY == %% 2012/03/09 \endinput -%% -%% == VERSION HISTORY == +%% 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; @@ -525,3 +576,13 @@ v0.5 2011/10/19 doc. fix LaTeX Wikibook doc. uses \URL 2011/10/21 re-order CTAN, \pagebreak's, \ctanref and choice for it, doc. modified; rm. \ithttpref +uploaded with MOREHYPE r0.52 +v0.6 2012/01/06 \wikilangref etc., \wikiref etc. depend on + \langcode + 2012/01/11 removed old comments for Wikipedia; (C) + 2012/03/09 "URL bases" (\httpbaseref etc.), applied; + \bytopicref uses \mirrorctanref + 2012/03/12 fixed \texhaxref + 2012/04/09 \ctanorgbaseref, \ctanpkgauref + 2012/04/10 makedoc link works! + 2012/05/13 example for \wikilangref corrected |