emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sharon Kimble <boudiccas@skimble.plus.com>
To: emacs-orgmode@gnu.org
Subject: Re: How to wavy/double underline an org-mode link?
Date: Mon, 24 Jul 2017 14:22:08 +0100	[thread overview]
Message-ID: <87pocqufzz.fsf@skimble.plus.com> (raw)
In-Reply-To: <87k230px78.fsf@delle7240.chemeng.ucl.ac.uk> (Eric S. Fraga's message of "Sat, 22 Jul 2017 11:44:59 +0100")

[-- Attachment #1: Type: text/plain, Size: 3110 bytes --]

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Saturday, 22 Jul 2017 at 10:35, Sharon Kimble wrote:
>
> [...]
>
>> I've found that I can underline each org-mode link by putting '_' before
>> and after each link, which is then exported to a latex file and built
>> into the pdf and does work. But, I am already underlining each glossary
>> entry in the main body of the text, so to differentiate I would like
>> either a wavy underline, or a double underline. But how please?
>
> Have a look at org-link-parameters variable and this page for LaTeX
> suggestions on how to double-underline:
>
> http://tex.stackexchange.com/questions/249616/ddg#249617

Thanks to Eric and Rasmus who replied.

I did try using a double-underline but it looked so horrible I changed
it very quickly!

This is what I've ended up using -

--8<---------------cut here---------------start------------->8---

%% https://tex.stackexchange.com/questions/311132/how-to-style-hrefs-underlined-and-coloured-throughout-the-document?noredirect=1&lq=1

\usepackage{ulem}

\makeatletter
\begingroup
  \catcode`\$=6 %
  \catcode`\#=12 %
  \gdef\href@split$1#$2#$3\\$4{%
    \hyper@@link{$1}{$2}{\dashuline{$4}}% or \underline
    \endgroup
  }%
\endgroup
\makeatother

%% https://tex.stackexchange.com/questions/49862/having-all-links-underlined-with-dotted-line?noredirect=1&lq=1

\usetikzlibrary{calc}

\makeatletter
\newlength\link@width
\newsavebox\link@box

\newcommand{\formatlink}[1]{%
   % --- save the box to be displayed (so that e.g. footnote counters do not
   %     get incremented twice)
   \savebox{\link@box}{#1}%
   % --- calculate the width of the box for later use
   \settowidth\link@width{\usebox{\link@box}}%
   % --- draw the link
   \tikz[baseline=(todotted.base)]{
   \node[inner sep=-1pt,outer sep=0pt] (todotted) {\usebox{\link@box}};
   \draw[dotted, thick] 
      ($(todotted.base)-(.5\link@width,2pt)$) -- +(\link@width,0); 
   }%
}

\AtBeginDocument{%
   % --- replace \ref command
   % \let\oldref=\ref
   % \renewcommand\ref[1]{\formatlink{\oldref{#1}}}
   % --- replace hyperref command
   \let\oldhyperref=\hyperref
   \renewcommand\hyperref[2][]{\formatlink{\oldhyperref[#1]{#2}}}
   % --- replace footnote command
   % \let\oldfootnote=\footnote
   % \renewcommand\footnote[1]{\formatlink{\footnotemark}\footnotetext{#1}}
   % --- replace cite command
   % \let\oldcite=\cite
   % \renewcommand\cite[1]{\formatlink{\oldcite{#1}}}
   % --- introduce secref command   
   % \newcommand\secref[1]{\hyperref[#1]{Section \oldref{#1}}}
}
\makeatother
--8<---------------cut here---------------end--------------->8---

I've saved it as 'code-1.tex' and just use it as '#+latex_header:
\input{/home/boudiccas/research/code-1}' at the end of my package list
in my org-mode source document.

And its now working perfectly. 

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk  
Debian 9.0, fluxbox 1.3.5-2, emacs 25.1.1, org-mode 9.0.9

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2017-07-24 13:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2535f962381540a18db893c8c5f44f34@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-07-22 10:44 ` How to wavy/double underline an org-mode link? Eric S Fraga
2017-07-24 13:22   ` Sharon Kimble [this message]
     [not found]   ` <cca36b87045e4d368338546940c6ae98@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-07-24 13:55     ` Eric S Fraga
2017-07-22 10:35 Sharon Kimble
2017-07-22 11:22 ` Rasmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pocqufzz.fsf@skimble.plus.com \
    --to=boudiccas@skimble.plus.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).