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.

I realize that this may be a subjective question, but I think this site is the best place for this.


I am trying to determine if any trailing punctuation should be part of the link text. The typical style for quotes is to include any trailing punctuation as part of the quote, so am wondering if the same should apply to links.

Here is an example of a case where (in my opinion) it looks better if the punctuation is part of the link only for the case where a box is used to indicate the link, but for the case where color, or underlining is used to indicate the link then perhaps it is best to leave it out. That is, for the box style, use the second version, but use the first version for ther other two styles.

enter image description here

Notes:

I am not yet decided on the style to use for various reasons:

  • One of the problems with colored links is that is not apparent if there are two links: One to "the" and another to "yahoo" in this example. Granted in this case it is clear from the English text, but consider that the link was instead to refer to a compound word where both words could have their own link or a link to the compound word. Perhaps a better example would be a colored link such as:

    enter image description here

    So, is this two links: one to "normal", and one to "force", or just one link to "normal force"?

  • The underlined links have other issues in that it is not easy to get underlining completely working as I want it as per Using soul with indirect formatting applied (using macro with 2 parameters, one possibly optional).

  • All three have problems when the link text starts on one line and ends on the subsequent line. The box version is the only solution that I am aware of that has a chance to remedy this by leaving an open box on the right hand side on the first line, and an open box on the left hand side on the 2md line (of course this is still to be implemented)

References:

Code:

% The following allows to have one version of this code for this questions,
% and the follow up at:
% 
%   http://tex.stackexchange.com/questions/125358/automating-processing-of-trailing-punctuation-if-any-for-hyperlinks
%
%\def\SmartVersion{}%  Leave commented for this question.

\documentclass{article}
\usepackage{xparse}
\usepackage{xcolor}
\usepackage{soul}
\usepackage{xstring}
\usepackage{xspace}
\usepackage[colorlinks=true]{hyperref}

%% ----------------------------------------------------------------
%%                http://tex.stackexchange.com/questions/36894/
%%                    underline-omitting-the-descenders
%%
%%
\makeatletter
\ExplSyntaxOn
    \cs_new:Npn \white_text:n #1
      {
        \fp_set:Nn \l_tmpa_fp {.01}
        \fp_mul:Nn \l_tmpa_fp {#1}
        \llap{\textcolor{white}{\the\SOUL@syllable}\hspace{\fp_to_decimal:N \l_tmpa_fp em}}
        \llap{\textcolor{white}{\the\SOUL@syllable}\hspace{-\fp_to_decimal:N \l_tmpa_fp em}}
      }
    \NewDocumentCommand{\whiten}{ m }
        {
          \int_step_function:nnnN {1}{1}{#1} \white_text:n
        }
\ExplSyntaxOff

\NewDocumentCommand{ \varul }{ D<>{5} O{0.2ex} O{0.1ex} +m } {%
\begingroup
\setul{#2}{#3}%
\def\SOUL@uleverysyllable{%
   \setbox0=\hbox{\the\SOUL@syllable}%
   \ifdim\dp0>\z@
      \SOUL@ulunderline{\phantom{\the\SOUL@syllable}}%
      \whiten{#1}%
      \llap{%
        \the\SOUL@syllable
        \SOUL@setkern\SOUL@charkern
      }%
   \else
       \SOUL@ulunderline{%
         \the\SOUL@syllable
         \SOUL@setkern\SOUL@charkern
       }%
   \fi}%
    \ul{#4}%
\endgroup
}%
\makeatother
%% ----------------------------------------------------------------

\newcommand{\CreateLinkA}[2]{%
    \hypersetup{pdfborder={0 0 1}, urlcolor=.}%
    \href{#1}{#2}%
}%
\newcommand{\CreateLinkB}[2]{%
    \hypersetup{pdfborder={0 0 0}, urlcolor=red}%
    \href{#1}{#2}%
}%
\newcommand{\CreateLinkC}[2]{%
    \hypersetup{colorlinks=false,urlcolor=.}%
    \setulcolor{blue}%
    \href{#1}{\varul[0.5pt][1.0pt]{#2}}%
}%

\makeatletter
\newcommand{\CreateLink}[3]{%
    \IfStrEqCase{#1}{%
        {1}{\CreateLinkA{#2}{#3}}%
        {2}{\CreateLinkB{#2}{#3}}%
        {3}{\CreateLinkC{#2}{#3}}%
    }%
    \ifdefined\SmartVersion% "If" clause is unused in this question
        % If the next character is anything other than a space, 
        % include that char as part of the text. 
        % The "-" is supposed to whatever the next character is,
        % but don't know how to get that character.  
        % Note that the "-" is shown in all cases, so this is NOT working.
        \@ifnextchar{\space}{\space}{-}%
    \else
        \xspace%
    \fi
}%
\makeatother


\begin{document}
\textbf{Punctuation NOT part of link:}\medskip
\par Go and check out \CreateLink{1}{www.yahoo.com}{the yahoo}, and also\ldots
\par Go and check out \CreateLink{2}{www.yahoo.com}{the yahoo}, and also\ldots
\par Go and check out \CreateLink{3}{www.yahoo.com}{the yahoo}, and also\ldots

\bigskip
\textbf{Punctuation part of link:}\medskip
\par Go and check out \CreateLink{1}{www.yahoo.com}{the yahoo,} and also\ldots
\par Go and check out \CreateLink{2}{www.yahoo.com}{the yahoo,} and also\ldots
\par Go and check out \CreateLink{3}{www.yahoo.com}{the yahoo,} and also\ldots
\end{document}
share|improve this question
7  
don't make the trailing punctuation part of the link, and don't use a box. –  David Carlisle Jul 24 '13 at 23:37
    
@DavidCarlisle: Yep an leaning against using boxed links, but see "Notes" section as to why I have not yet ruled that out entirely yet. –  Peter Grill Jul 25 '13 at 0:02
1  
There might be an American English / British English divide on this topic. AE writes quotations "with the punctuation inside the quotation," but BE writes quotations "with the punctuation outside". Hyperlinks might be analogous to this. –  John Wickerson Jul 25 '13 at 7:13
add comment

2 Answers

You say "The typical style for quotes is to include any trailing punctuation as part of the quote". Some linguists strongly reject this commonly-held view. Larry Trask is one of them, and in his guide to punctuation he mentions the following:

The linguist Geoff Pullum, a fervent advocate of the logical view, once got so angry at copy-editors who insisted on reshuffling his carefully placed punctuation that he wrote an article called `Punctuation and human freedom' (Pullum 1984). Here is one of his examples, first with logical punctuation:

Shakespeare's play Richard III contains the line "Now is the winter of our discontent".

This is true. Now try it with conventional punctuation:

Shakespeare's play Richard III contains the line "Now is the winter of our discontent."

This is strictly false, since the line in question is only the first of two lines making up a complete sentence, and hence does not end in a full stop, as apparently suggested by the conventional punctuation:

Now is the winter of our discontent

Made glorious summer by this sun of York.
share|improve this answer
    
Good point, but I didn't intend this to become a discussion of quote styles, but rather on hyperlinks. Clearly with the boxed style of link, allowing the punctuation to be after the box just look wrong (IMHO). –  Peter Grill Jul 25 '13 at 0:04
add comment

The punctuation preferably should not be part of the link, think for consistency quotation marks rather than commas:

The project's preference for cohesiveness, even if it requires compromise that includes disregard of credentials, has been referred to as "anti-elitism".

In Greek: «εισαγωγικά».1

I wouldn't suggest that you have the "Guillemets" coloured.

In general, my own personal preference is to put all links in footnotes or better sidenotes. You don't really want the reader to click away while in the middle of reading a paragraph.

[1] Markdown does not allow unicode characters in links!

share|improve this answer
    
I agree, except if boxed links are used -- looks wrong if the punctuation is not part of the link (but perhaps quotes is an exception). I initially had all links as footnotes were all the problems I mention above disappear. But everyone I got feedback for on my particular application asked for inline links - so now I have the ability to do both (and switch one off if so desired). Am deferring the final decision on the link style, but just want all the flexibility for now. –  Peter Grill Jul 25 '13 at 1:01
    
@PeterGrill Show me one website that uses boxed links and I will agree with you:) For links, I quite like the way wikipedia evolved. Also it can be instructive, if you print some text and see how it looks. –  Yiannis Lazarides Jul 25 '13 at 1:16
    
sadly, u.s. style books usually say that the punctuation should be placed inside the quotes. i disagree, vehemently. but i know several copyeditors who would mark your quoted passage for change in that regard. (i agree that punctuation should not be part of the link, but you might have a hard time selling your reasoning to someone who insists on always "following the book".) –  barbara beeton Jul 25 '13 at 12:23
    
I don't plan to use the boxed version for the final product, but do use it in the version for proof reading as it is clearer what the links are -- colors won't work for me. I have several types/modes of links that need to be considered during the review process and boxes is the only way to do it (to be consistent with the rest of the symbols/markup in the review version). Not sure if that makes sense, but I am definitely using boxed links for now, and will be migrating to underlining the links -- but underlining is not trivial. –  Peter Grill Jul 27 '13 at 9:00
    
@PeterGrill I can understand your dilemma. Are you writing with the view that the publication will only be read on screen? –  Yiannis Lazarides Jul 27 '13 at 10:22
show 1 more comment

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.