emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to wavy/double underline an org-mode link?
@ 2017-07-22 10:35 Sharon Kimble
  2017-07-22 11:22 ` Rasmus
  0 siblings, 1 reply; 5+ messages in thread
From: Sharon Kimble @ 2017-07-22 10:35 UTC (permalink / raw)
  To: org-mode-email

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


I'm writing a document that is available in two formats, one a pdf file
and the other a paper copy of it, and its been pointed out to me that
some sentences don't seem to make sense in the paper copy. When I've
looked at that particular sentence in the source document, an org-mode
file, I see that the relevant section is actually an org-mode link.

So what I'm looking for is something like a wavy underline under each of
the org-mode links which will appear in both versions. But how do I do
it please? It will need to be a generalised command, meaning that it can
very easily be applied as there are 387 links to be adjusted!

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?

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 --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to wavy/double underline an org-mode link?
       [not found] <2535f962381540a18db893c8c5f44f34@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2017-07-22 10:44 ` Eric S Fraga
  2017-07-24 13:22   ` Sharon Kimble
       [not found]   ` <cca36b87045e4d368338546940c6ae98@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Eric S Fraga @ 2017-07-22 10:44 UTC (permalink / raw)
  To: emacs-orgmode

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

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

-- 
: Eric S Fraga via Emacs 26.0.50, Org release_9.0.9-573-g09e612

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to wavy/double underline an org-mode link?
  2017-07-22 10:35 How to wavy/double underline an org-mode link? Sharon Kimble
@ 2017-07-22 11:22 ` Rasmus
  0 siblings, 0 replies; 5+ messages in thread
From: Rasmus @ 2017-07-22 11:22 UTC (permalink / raw)
  To: emacs-orgmode

Sharon Kimble <boudiccas@skimble.plus.com> writes:

> I'm writing a document that is available in two formats, one a pdf file
> and the other a paper copy of it, and its been pointed out to me that
> some sentences don't seem to make sense in the paper copy. When I've
> looked at that particular sentence in the source document, an org-mode
> file, I see that the relevant section is actually an org-mode link.
>
> So what I'm looking for is something like a wavy underline under each of
> the org-mode links which will appear in both versions. But how do I do
> it please? It will need to be a generalised command, meaning that it can
> very easily be applied as there are 387 links to be adjusted!
>
> 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?

Is the paper copy a printed version of the pdf (i.e. generated via latex)?
If so, I would guess that you could customize the way links are printed by
hyperref.  There are various ways to do this.  Wavy underlines might be a
fair bit of work, but normal underlines should be doable.  This is what I
use, possibly with a thinner line (<1).  I am not sure it will show when
printed, though.  There might be an option to keep them.

    \hypersetup{pdfborderstyle={/S/U/W 1}}

Otherwise, you might be able to use something like the command in this
post.

    https://tex.stackexchange.com/a/311143

Hope it helps,
Rasmus

-- 
May the Force be with you

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to wavy/double underline an org-mode link?
  2017-07-22 10:44 ` Eric S Fraga
@ 2017-07-24 13:22   ` Sharon Kimble
       [not found]   ` <cca36b87045e4d368338546940c6ae98@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  1 sibling, 0 replies; 5+ messages in thread
From: Sharon Kimble @ 2017-07-24 13:22 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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 --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to wavy/double underline an org-mode link?
       [not found]   ` <cca36b87045e4d368338546940c6ae98@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2017-07-24 13:55     ` Eric S Fraga
  0 siblings, 0 replies; 5+ messages in thread
From: Eric S Fraga @ 2017-07-24 13:55 UTC (permalink / raw)
  To: emacs-orgmode

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

Glad you found a solution and thanks for posting it.

-- 
: Eric S Fraga via Emacs 26.0.50, Org release_9.0.9-573-g09e612

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-07-24 13:55 UTC | newest]

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

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).