3

Using the \hypersetup{} of \usepackage[tex4ht]{hyperref} (as seen in the MWE below) I am trying to format the hyperlinks of links such as glossary entries so they are less noticeable.

On two different computers (which I would have thought had identical MiKTeX2.9 installations, the packages of which are both up-to-date) give different results...

  • On one computer I see blue underlined hyperlinks despite the citecolor options set as seen below
  • on the other computer I see nicely formatted black text, no underline, but a mouse change when you hover over the hidden hyperlink which bounces you to the glossary, reference, etc.
  • I have tested this computer specific but consistent formatting appearance on Internet Explorer, opera, and google chrome.
  • no problems generating the pdf in xelatex on either computer.

Since I don't think it's quite a code problem I am hoping I can get some advice from any of the experts who may know about the underlying system requirements or anything that may interfere:

  1. Do I possibly have an installed but not used package that is incompatible with the \hypersetup{}
  2. Is there a font library or html dll that could be different across the windows installations providing different instructions?
  3. I don't know much about html so I am open to suggestions.

MWE

\documentclass{article}
\usepackage[utf8]{inputenc}
%=========================================================================================================================================
% PACKAGES REQUIRED FOR HYPERLINKS AND HYPER-REFERENCES
%=========================================================================================================================================
    \usepackage{csquotes}
    \usepackage{url}
    \usepackage[nottoc]{tocbibind}
    \usepackage{bookmark}
    %http://tex.stackexchange.com/questions/214718/override-scshape-in-fancyhdr
    %\RequirePackage[overload]{textcase} %keeps all math in the heading lowercase  
    %\RequirePackage{linegoal}

    %http://tex.stackexchange.com/questions/42927/converting-from-latex-to-html-using-htlatex
    \ifdefined\HCode
        \usepackage[tex4ht]{hyperref}
        \hypersetup{
            hypertexnames=false,
            colorlinks=true,       % false: boxed links; true: colored links
            linkcolor=black,          % color of internal links (change box color with linkbordercolor)
            citecolor=black,        % color of links to bibliography
            filecolor=black,      % color of file links
            urlcolor=black          % color of external links
        }
    \else
        \usepackage{hyperref}   %\usepackage{hyperref}
        \hypersetup{
            hypertexnames=false,
            %bookmarks=false,         % show bookmarks bar?
            unicode=true,          % non-Latin characters in Acrobat's bookmarks
            pdftoolbar=true,        % show Acrobat's toolbar?
            pdfmenubar=true,        % show Acrobat's menu?
            pdffitwindow=true,     % window fit to page when opened
            pdfstartview={FitV},    % fits the height of the page to the window:  or fits the width of the page to the window  FitH
            pdftitle={My title},    % title
            pdfauthor={Author},     % author
            pdfsubject={Subject},   % subject of the document
            pdfcreator={Creator},   % creator of the document
            pdfproducer={Producer}, % producer of the document
            pdfkeywords={keyword1} {key2} {key3}, % list of keywords
            pdfnewwindow=true,      % links in new window
            colorlinks=true,       % false: boxed links; true: colored links
            linkcolor=black,          % color of internal links (change box color with linkbordercolor)
            citecolor=black,        % color of links to bibliography
            filecolor=black,      % color of file links
            urlcolor=black          % color of external links
        }
    \fi


    \bookmarksetup{
        numbered,
        open
    }

    \usepackage[noabbrev]{cleveref}
    %\AtEndPreamble{\RequirePackage[noabbrev]{cleveref}}
    %\AtBeginDocument{\RequirePackage[noabbrev]{cleveref}}  % this package must be one of the last packages loaded - certainly put it after hyperref

%
%_________________________________________________________________________________________________________________________________________
\setlength\parindent{0pt}

%=========================================================================================================================================
% PACKAGES REQUIRED FOR GLOSSARIES
%=========================================================================================================================================

% Glossaries must be loaded before amsmath as per details in the following forum answer
% http://tex.stackexchange.com/questions/85696/what-causes-this-strange-interaction-between--and-amsmath
\usepackage[nogroupskip,toc,acronym]{glossaries} % must come after href   
\usepackage{scrwfile}%http://www.dickimaw-books.com/cgi-bin/faq.cgi?action=view&categorylabel=glossaries#glsnewwriteexceeded

\makeglossaries

\newglossaryentry{ICPMS}{ type={acronym}, sort={inductively coupled plasma-mass spectrometry},  name={ICPMS}, short={ICPMS}, long={inductively coupled plasma-mass spectrometry}, first={inductively coupled plasma-mass spectrometry (ICPMS)}, description={inductively coupled plasma mass spectrometry} }

\begin{document}

    \begin{itemize}
        \item \gls{ICPMS}
        \item this term is fully expanded and summarized on first use which displays \gls{ICPMS}
        \item I expected these hyperlinks to be invisible - not blue with underlines...
    \end{itemize}

\end{document} 
4

The result should be the same on all computers. glossaries package does have it's own configuration for tex4ht and doesn't use hyperref at all when compiled with tex4ht. But even links produced by hyperref don't seem to support colors, which you can test with simple example:

\href{http://tex.stackexchange.com}{TeX.sx}
\url{http://tex.stackexchange.com}

this produces:

<a 
href="http://tex.stackexchange.com" >TeX.sx</a> <a 
href="http://tex.stackexchange.com" class="url" ><span 
class="cmtt-10">http://tex.stackexchange.com</span></a>

so \href command produces plain <a> element, \url produces <a> with url class and <span> element with font formatting. In the css file, there is no color property, so it is technically impossible that any of your color declarations in \hypersetup were used. Moreover, exactly same output is produced regardless if you use \usepackage{hyperref} and \usepackage[tex4ht]{hyperref}:

%     \ifdefined\HCode
%         \usepackage[tex4ht]{hyperref}
%         \hypersetup{
%             hypertexnames=false,
%             colorlinks=true,       % false: boxed links; true: colored links
%             linkcolor=black,          % color of internal links (change box color with linkbordercolor)
%             citecolor=black,        % color of links to bibliography
%             filecolor=black,      % color of file links
%             urlcolor=black          % color of external links
%         }
%     \else
        \usepackage{hyperref}   %\usepackage{hyperref}
        \hypersetup{
            hypertexnames=false,
            %bookmarks=false,         % show bookmarks bar?
            unicode=true,          % non-Latin characters in Acrobat's bookmarks
            pdftoolbar=true,        % show Acrobat's toolbar?
            pdfmenubar=true,        % show Acrobat's menu?
            pdffitwindow=true,     % window fit to page when opened
            pdfstartview={FitV},    % fits the height of the page to the window:  or fits the width of the page to the window  FitH
            pdftitle={My title},    % title
            pdfauthor={Author},     % author
            pdfsubject={Subject},   % subject of the document
            pdfcreator={Creator},   % creator of the document
            pdfproducer={Producer}, % producer of the document
            pdfkeywords={keyword1} {key2} {key3}, % list of keywords
            pdfnewwindow=true,      % links in new window
            colorlinks=true,       % false: boxed links; true: colored links
            linkcolor=black,          % color of internal links (change box color with linkbordercolor)
            citecolor=black,        % color of links to bibliography
            filecolor=black,      % color of file links
            urlcolor=black          % color of external links
        }
%    \fi

so you may remove the whole \ifdefined\HCode ... \else ... \fi stuff. Instead, add some \Css commands to your .cfg file:

\Css{a{color:black;}}
\Css{a:visited{color:black;}}
\Css{a:hover{color:\#888;}}

enter image description here

  • Thats really great. Thanks for putting the time to give some background. One more tool for my TeX debugging toolbox. I would like to remove the underlines as well, so have tried to parallel your additions to the cfg file with \Css{a:text-decoration:none;} \Css{a:visited{text-decoration:none;} \Css{a:hover{text-decoration:underline;}} \Css{a:active{text-decoration:underline;}} but I am missing something - a set of braces at minimum in the first two at least I am sure (if I even got the code correct). – EngBIRD Mar 15 '15 at 15:48
  • @EngBIRD it should be \Css{a{text-decoration:none;}}. but if you remove underlining and the links have the same color as text, how would you identify links in the document? – michal.h21 Mar 15 '15 at 15:52
  • Thanks, I used your formatting to create a second option \Css{a:hover{text-decoration:underline;}}. Unlike most people who probably want to draw attention to links (url, cross ref) I use an absurd amount of glossaries calls which create an unreadable paragraph with all the underlining and color changes. Gls calls give me dynamic control over definitions, abbrev., suppliers, catalog numbers, symbols, and even data values and statistics. I also expect this technical document to be read in field so the mouse and formatting change observed when hovering is sufficient attention to the link. – EngBIRD Mar 15 '15 at 16:15
  • Of course it is reasonable to want certain terms hyperlinked in a visible format, but I think I have to settle for no visible links rather than all. I am not sure there are specific tags I could add to add link formatting for cross references/urls etc and remove link displays for some types of gls insertions and not others. – EngBIRD Mar 15 '15 at 16:18
  • @EngBIRD OK then :) it could be possible to distinguish different links, I hope, but probably not easy – michal.h21 Mar 15 '15 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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