From CIRCA

Jump to: navigation, search

LaTeX code for Links

Click here for a plain text version of this LaTeX code.
\documentclass[a4paper,11pt]{article}
\usepackage{ulem}
\usepackage{a4wide}
\usepackage[dvipsnames,svgnames]{xcolor}
\usepackage[pdftex]{graphicx}

\usepackage{hyperref}
% commands generated by html2latex


\begin{document}

There are four sorts of links in MediaWiki: 
\begin{enumerate}
	\item  internal links to other pages in the wiki
	\item  external links to websites
	\item \hyperlink{Interwiki_links}{interwiki links} (links to other wikis)
	\item  inter-language links to other language versions of the same wiki
\end{enumerate}

To add an internal link, enclose the name of the page you want to link to in double square brackets. When you save the page, you'll see the new link pointing to your page. If the page exists already, it is displayed in blue, empty pages are displayed in red. Selflinks to the current page are not transformed in URLs but displayed in bold.

The first letter of the target page is automatically capitalized and spaces are represented as underscores (typing an underscore in the link will have a similar effect as typing a space, but is not recommended, since the underscore will also be shown in the text).
\begin{tabular}

\subsection{Contents}
\begin{itemize}
	\item \hyperlink{How_to_link}{1How to link}
\begin{itemize}
	\item \hyperlink{More_advanced}{1.1More advanced}
\end{itemize}
	\item \hyperlink{How_to_avoid_auto-links}{2How to avoid auto-links}
	\item \hyperlink{Interwiki_links}{3Interwiki links}
	\item \hyperlink{See_also}{4See also}
\end{itemize}
\end{tabular}\hypertarget{How_to_link}{}

\subsection{ How to link }
\begin{tabular}\href{/index.php?title=Template:Hl3&action=edit&redlink=1}{Template:Hl3}|\textbf{Description} & \href{/index.php?title=Template:Hl3&action=edit&redlink=1}{Template:Hl3}|\textbf{You type} & \href{/index.php?title=Template:Hl3&action=edit&redlink=1}{Template:Hl3}|\textbf{You get} \\ 
Internal link & \texttt{[[Main Page]]} & \href{/index.php/Main_Page}{Main Page} \\ 
Piped link & \texttt{[[Main Page|different text]]} & \href{/index.php/Main_Page}{different text} \\ 
External link & \texttt{http://mediawiki.org} & \href{http://mediawiki.org}{http://mediawiki.org} \\ 
External link,
\\

different title & \texttt{[http://mediawiki.org MediaWiki]} & \href{http://mediawiki.org}{MediaWiki} \\ 
External link,
\\

numbered & \texttt{[http://mediawiki.org]} & \href{http://mediawiki.org}{[1]} \\ 
Anchor link & \texttt{[[\#See also]]} & \hyperlink{See_also}{\#See also} \\ 
Anchor link at another page & \texttt{[[Help:Images\#See also]]} & \href{/index.php?title=Help:Images&action=edit&redlink=1}{Help:Images\#See also} \\ 
Category link & \texttt{[[:Category:Help]]} & \href{/index.php?title=Category:Help&action=edit&redlink=1}{Category:Help} \\ 
Internal link to image file & \texttt{[[media:example.jpg]]} & \href{/index.php?title=Special:Upload&wpDestFile=Example.jpg}{media:example.jpg} \\ 
Internal link to pdf file & \texttt{[[media:example.pdf]]} & \href{/index.php?title=Special:Upload&wpDestFile=Example.pdf}{media:example.pdf} \\ 
Interwiki link & \texttt{[[Wikipedia:MediaWiki]]} & \href{http://en.wikipedia.org/wiki/MediaWiki}{Wikipedia:MediaWiki} \\ 
mailto link & \texttt{[mailto:info@example.org email me]} & \href{mailto:info@example.org}{email me} \\ 
redirect & \texttt{\#REDIRECT [[Main Page]]} &  $\rightarrow$ \href{/index.php/Main_Page}{Main Page}
\end{tabular}\hypertarget{More_advanced}{}

\subsubsection{ More advanced }
\begin{tabular}\href{/index.php?title=Template:Hl3&action=edit&redlink=1}{Template:Hl3}|\textbf{Description} & \href{/index.php?title=Template:Hl3&action=edit&redlink=1}{Template:Hl3}|\textbf{You type} & \href{/index.php?title=Template:Hl3&action=edit&redlink=1}{Template:Hl3}|\textbf{You get} \\ 
Piped link,
\\

different title & \texttt{[[Main Page|$<$span title="different title"$>$different text$<$/span$>$]]} & \href{/index.php/Main_Page}{different text} \\ 
External link,
\\

same host unnamed & \texttt{[http://\{\{SERVERNAME\}\}/pagename]} & \href{http://circa.cs.ualberta.ca/pagename}{[2]} \\ 
mailto named with subject line and body & \texttt{[mailto:info@example.org?Subject=URL\%20Encoded\%20Subject\&body=Body\%20Text info]} & \href{mailto:info@example.org?Subject=URL%20Encoded%20Subject&body=Body%20Text}{info}
\end{tabular}


\\

\line(1,0){300}


\href{/index.php?title=Template:Admin_tip&action=edit&redlink=1}{Template:Admin tip}

\href{/index.php?title=Template:Admin_tip&action=edit&redlink=1}{Template:Admin tip}\hypertarget{How_to_avoid_auto-links}{}

\subsection{ How to avoid auto-links }

By default, when you write a URL as is, it will be transformed to an external link.

To avoid that effect, put the URL between $<$nowiki$>$ start \& end tags as in:
\begin{verbatim}
$<$nowiki$>$http://mediawiki.org$<$/nowiki$>$
\end{verbatim}\hypertarget{Interwiki_links}{}

\subsection{ Interwiki links }

Interwiki links are links from the local wiki to another wiki. For example you can link to the Sunflower article on wikipedia.org by typing \texttt{[[wikipedia:Sunflower]]}. This results in a link like this: \href{http://en.wikipedia.org/wiki/Sunflower}{wikipedia:Sunflower}

Similar to internal page links, you can create piped links, with alternate link text. e.g. \texttt{[[wikipedia:Sunflower|big yellow flower]]}

Basically this is an abbreviation for longer URLs. A very similar link could be created as a normal external link by typing \texttt{[http://en.wikipedia.org/wiki/Sunflower Sunflower]}, but interwiki links allow you to type out an easy and compact link, almost as if you are linking to a page on your own wiki.

Some interesting things to note:
\begin{itemize}
	\item  Interwiki links are displayed slightly differently to external links, without the little external link icon.
	\item  Complex page names with spaces and other characters are handled elegantly, just as they would be for an internal page link, making this more tidy than creating an external link to a full URL. For example \texttt{[[wikipedia:Sunflower County, Mississippi]]} is in some ways tidier and more elegant than the full URL\nolinebreak: \texttt{\href{http://en.wikipedia.org/wiki/Sunflower_County%2C_Mississippi}{http://en.wikipedia.org/wiki/Sunflower\_County\%2C\_Mississippi}}
\end{itemize}\hypertarget{See_also}{}

\subsection{ See also }
\begin{itemize}
	\item \href{/index.php?title=Help:Linked_images&action=edit&redlink=1}{Linked images}
\end{itemize}

\href{/index.php?title=Template:Languages&action=edit&redlink=1}{Template:Languages}

\end{document}
Personal tools