Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

footnote trouble with email in return-address #14

Open
rnuske opened this issue Nov 7, 2017 · 10 comments
Open

footnote trouble with email in return-address #14

rnuske opened this issue Nov 7, 2017 · 10 comments

Comments

@rnuske
Copy link

rnuske commented Nov 7, 2017

Sometimes it seems useful to include an email address in the return-address block (maybe to suggest a way for faster exchange of messages or ...).

linl seems to get confused if an email address is added to the return-address. It marks the email address with a superscript 1 indicating a footnote but does not print a footnote (eg. email_in_return_address.pdf)

As far as I understood the process: pandoc's "markdown to latex" converts all email address to \href{mailto:...}{\nolinkurl{...}} and the linl template.tex tries to do footnotes instead of hotlinks.

I think there is no need for a footnote in case of email addresses but couldn't come up with a solution. I guess even the mailto and nolinkurl stuff could be done away with but have no clue how communicate this to pandoc

@eddelbuettel
Copy link
Owner

Reproducible example, please, or the bug report may not exist...

@rnuske
Copy link
Author

rnuske commented Nov 7, 2017

alright, based on the linl-skeleton:

---
author:
- Aaron Wolen
opening: Dear Dirk,
closing: Sincerely,
address:
- Dirk Eddelbuettel
- 123 Street Rd
- Chicago, IL
return-address: 
- 456 Road St.
- New York, NY
- somebody@somewhere.tld
output: linl::linl
      
---

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin mollis
dolor vitae tristique eleifend. Quisque non ipsum sit amet velit
malesuada consectetur. Praesent vel facilisis leo. Sed facilisis
varius orci, ut aliquam lorem malesuada in. Morbi nec purus at nisi
fringilla varius non ut dui. Pellentesque bibendum sapien velit. Nulla
purus justo, congue eget enim a, elementum sollicitudin eros. Cras
porta augue ligula, vel adipiscing odio ullamcorper eu. In tincidunt
nisi sit amet tincidunt tincidunt. Maecenas elementum neque eget dolor
[egestas fringilla](http://example.com):

> Nullam eget dapibus quam, sit amet sagittis magna. Nam tincidunt,
> orci ac imperdiet ultricies, neque metus ultrices quam, id gravida
> augue lacus ac leo.

Vestibulum id sodales lectus, sed scelerisque quam. Nullam auctor mi
et feugiat commodo. Duis interdum imperdiet nulla, vitae bibendum eros
placerat non. Cras ornare, risus in faucibus malesuada, libero sem
fringilla quam, ut luctus enim sapien eget dolor.

@eddelbuettel
Copy link
Owner

Oh, I see now. That may be a pandoc interaction.

I guess we can add 'allow for email address' as a feature request. I suspect it may be easiest to make it a new frontmatter idem rather than shoehorning it into address. But I just guessing at this point...

@rnuske
Copy link
Author

rnuske commented Nov 7, 2017

that would be cool, thanks.

yep, the first half (converting somebody@somewhere.tld to \href{mailto:somebody@somewhere.tld}{\nolinkurl{somebody@somewhere.tld}}) absolutly. The second half (turning all \href{} into foontotes) is at least controlled by linl's template.tex. That's my guess.

@eddelbuettel
Copy link
Owner

That latter one has a toggle. You could turn that off for a start.

@eddelbuettel
Copy link
Owner

eddelbuettel commented Nov 7, 2017

Tested and verified. Just add

inline-links: true

to your front-mastter. Now the link is part from the from address just as you specified.

We could close this, or keep it open as a 'wishlist' for a from-email field. May as well go with it and make the email a wee bit more visually distinctive. Thoughts, @aaronwolen ?

@rnuske
Copy link
Author

rnuske commented Nov 7, 2017

just tried it. It works for the email but kills the other link in the example above [egestas fringilla](http://example.com)

@aaronwolen
Copy link
Collaborator

That's an interesting problem.

I agree it should be possible to include an email address and use the links as footnotes option but I'm not sure how best to make that happen.

One option would be to move the line redefining \href to the line following \opening in the template:

...
\opening{$opening$}
\renewcommand{\href}[2]{#2\footnote{\url{#1}}}
...

It's not pretty but it works. The question is would the change have any unintended side effects.

Let's leave this open for now.

@aaronwolen
Copy link
Collaborator

aaronwolen commented Nov 7, 2017

We need a better long term solution but in the mean time we can workaround this by disabling Pandoc's autolink_bare_uris extension

output: 
  linl::linl:
    md_extensions: "-autolink_bare_uris"

@rnuske
Copy link
Author

rnuske commented Nov 8, 2017

The md_extensions: "-autolink_bare_uris" approach looks promising.
My little tests showed good results and others seemed to have come up with the same solution for this problem.

Actually, I would prefer to put it into the linl function in R/linl.R, for instance in line 64:

base <- inherit_pdf_document(..., template = template, keep_tex = keep_tex,  md_extensions = "-autolink_bare_uris")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants