Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When using href{} inside a longtable, its simply printed out in a verbatim way. How can I make it behave like expected (produce a working link in the pdf file that shows the href label?

Here is a MWE:


\documentclass[graybox,envcountchap,sectrefs]{svmono}

\usepackage{mathptmx}
\usepackage{helvet}
\usepackage{courier}
%
\usepackage{type1cm}         

\usepackage{makeidx}         % allows index generation
\usepackage{graphicx}        % standard LaTeX graphics tool
                             % when including figure files
\usepackage{multicol}        % used for the two-column index
\usepackage[bottom]{footmisc}% places footnotes at page bottom
\usepackage{parskip}
\usepackage[breaklinks]{hyperref}

\usepackage{ctable}
\usepackage{fixltx2e}
\usepackage{here}
\usepackage{caption}

\usepackage{fancybox}
\usepackage{longtable}

% define detailled toc
\usepackage[explicit]{titlesec}
\usepackage{titletoc}

% longtable
\usepackage{longtable,lscape}
\usepackage{rotating}
% \usepackage{multirow,multicol}


\begin{document}


\chapter{Links}
\label{cha:tasks} % Always give a unique label
% use \chaptermark{}
% to alter or adjust the chapter heading in the running head

\section*{Tabular Depiction }
\label{sec:tabular-depiction}

\begin{landscape}

\begin{longtable}{ll}
\caption{Caption} \\
\hline
Task & URI \\
\hline\hline\endfirsthead
\caption{Caption (cont.)}  \\
Task & URI \\
\hline\endhead
\hline
 & www.uri.org \\
\hline\endfoot
\hline
Web Site  & www.uri.org \\
\hline\endlastfoot

doors & href{http://code.org/wiki/doors}{http://code.org/wiki/doors} \\
game & href{http://code.org/wiki/game}{http://code.org/game} \\
Solve & href{http://code.org/wiki/Solve}{http://code.org/wiki/Solve} \\


\end{longtable}
\end{landscape}

\end{document}







share|improve this question
2  
shouldn't you enter \href{http://code.org/wiki/doors}{http://code.org/wiki/doors} instead of href{http://code.org/wiki/doors}{http://code.org/wiki/doors}. Note the missing backslash in your href link. –  mythealias Sep 5 '12 at 0:58
2  
just wondering any reason to include longtable package twice? –  mythealias Sep 5 '12 at 1:00
    
Oh yes, I should probably enter the backslash ... sigh (no, longtable appears 2 times only by accident). Thanks. –  user17106 Sep 5 '12 at 1:19

1 Answer 1

up vote 2 down vote accepted

The command is \href but you are using href (the backslash is missing):

\documentclass{article}
\usepackage{mathptmx}
\usepackage{helvet}
\usepackage{courier}
\usepackage{type1cm}         
\usepackage{makeidx}         % allows index generation
\usepackage{graphicx}        % standard LaTeX graphics tool
                             % when including figure files
\usepackage{multicol}        % used for the two-column index
\usepackage[bottom]{footmisc}% places footnotes at page bottom
\usepackage{parskip}
\usepackage{ctable}
\usepackage{fixltx2e}
\usepackage{here}
\usepackage{caption}
\usepackage{fancybox}
\usepackage{longtable}% longtable

% define detailled toc
\usepackage[explicit]{titlesec}
\usepackage{titletoc}

\usepackage{lscape}
\usepackage{rotating}
% \usepackage{multirow,multicol}
\usepackage[breaklinks]{hyperref}

\begin{document}

\chapter{Links}
\label{cha:tasks} % Always give a unique label
% use \chaptermark{}
% to alter or adjust the chapter heading in the running head

\section*{Tabular Depiction }
\label{sec:tabular-depiction}

\begin{landscape}
\begin{longtable}{ll}
\caption{Caption} \\
\hline
Task & URI \\
\hline\hline\endfirsthead
\caption{Caption (cont.)}  \\
Task & URI \\
\hline\endhead
\hline
 & www.uri.org \\
\hline\endfoot
\hline
Web Site  & www.uri.org \\
\hline
\endlastfoot
doors & \href{http://code.org/wiki/doors}{http://code.org/wiki/doors} \\
game & \href{http://code.org/wiki/game}{http://code.org/game} \\
Solve & \href{http://code.org/wiki/Solve}{http://code.org/wiki/Solve} \\
\end{longtable}
\end{landscape}

\end{document}

enter image description here

I used article instead of svmono since I don't have the later class. You were loading twice the longtable package, so I suppressed one of them; also I moved hyperref to be the last package loaded (this is usually recommended except for some packages).

share|improve this answer
    
Thanks, sometimes one is blind for the apparently obvious. –  user17106 Sep 5 '12 at 1:20
    
@user17106 You're welcome! I updated my answer with two remarks. –  Gonzalo Medina Sep 5 '12 at 1:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.