GeneralLinks within a document in "Wikipedia-Style"

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Godfather
Posts: 2
Joined: Mon Nov 17, 2008 10:22 am

Links within a document in "Wikipedia-Style"

Post by Godfather »

Hi, I am completely new to Latex, so I have many questions.

Let's begin with my first (I searched the board and the web and did not find any hint)

OK, I've created a Latex-document using texnic-center. Here's what I am triing to do:

First of all, I've included the "hyperref"-package. Then I've created sections and subsections so I can use "tableofcontents".
After this I've written a little test into each section:

Code: Select all

 
\documentclass{article} 
\title{Test} 
\author{Me} 
\usepackage[latin1]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage[usenames]{color} 
\usepackage[hyperref, dvips, latex2html, colorlinks, linkcolor=BlueViolet,citecolor=BrickRed, urlcolor=MidnightBlue]{hyperref} 
 
\begin{document} 
\maketitle 
 
\newpage 
\tableofcontents 
\newpage 
 
 
\section{Names} 
\subsection{Paul} 
Hello, my name is Paul 
\subsection{Peter} 
Hello, my name is Peter 
 
\end{document} 


After compiling everything works fine and looks great.

Now, I am triing to intergrate a link within a sentece (something like this): In 1983 [Paul] was born.

When I click on [Paul] I want to get redirected to the subsection of [Paul]

Nothing works like I want it to. The ref-tag create only the section-number, footnotes are embedded at the end of a site, bibitem creates another anchor. Is there something like the wikipedia-style or something like in HTML

--> subsection{<a name="Paul">Paul</a>}
I know, that this does not work - but if you understand HTML, you might understand what I am triing to do

Thanks a lot

Godfather

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Links within a document in "Wikipedia-Style"

Post by gmedina »

Hi Godfather,

you could use the \hypertarget and \hyperlink commands provided by the hyperref package, as the following simple example suggests:

Code: Select all

\documentclass{article}
\usepackage{hyperref}
\usepackage{lipsum}%just to generate some text

\begin{document}

As \hyperlink{paul}{Paul} has shown...

\lipsum[1-30]

\hypertarget{paul}{Here's what Paul has shown}:

\end{document}
Please refer to the hyperref manual for further information.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Godfather
Posts: 2
Joined: Mon Nov 17, 2008 10:22 am

Re: Links within a document in "Wikipedia-Style"

Post by Godfather »

Thanks a lot.

This seems to be the solution for my "problem".

Godfather
Post Reply