TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For some reason I get a linebreak when using my \textlabel command in the table cell. It seems to work fine for everything else.

\usepackage[pdftex,bookmarks=true,bookmarksnumbered,colorlinks=true]{hyperref} % http://ctan.org/pkg/hyperref


        \edef\@currentlabel{#1}% Set target label
        \phantomsection% Correct hyper reference link
        #1\label{#2}% Print and store label

    \textbf{Col 1} & \textbf{Col 2} \\ \hline
    Bla1 & \textlabel{Blubb1}{reference1} \\
    & Description1 \\ 
    Bla2 & \textlabel{Blubb2}{reference2} \\
    & Description2 \\ \hline
share|improve this question
up vote 5 down vote accepted

Avoid doing things in vertical mode, especially at the start of table cells.

        \edef\@currentlabel{#1}% Set target label
        \leavevmode\phantomsection% Correct hyper reference link
        #1\label{#2}% Print and store label
share|improve this answer
Excuse me, but could you elaborate a little further? What exactly does 'vertical mode' mean? I have to admit that I haven't written the command by myself, therefore don't really know how it works, however, am very eager to learn. – cherrung Jun 9 '12 at 21:14
(very simple and somehow incorrect explanation) At the beginning of a cell, LaTeX is in "vertical" mode, which means that things "tend to be put atop each other", which makes \phantomsection occupy its own line, even though it does not print anything. By \leavevmode you "leave vertical mode" and enter "horizontal mode", where things are put next to each other and \phantomsection occupies zero horizontal space then. – yo' Jun 9 '12 at 21:25
I was away from machine but @tohecz gives a good explanation. Searching for "mode" on this site or other tutorials will give other examples of this distinction. – David Carlisle Jun 9 '12 at 21:59

Your Answer


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.