1

I am using LyX for my CV. When I add my list of publications, many of them contain DOI's. And the problem is that when I generate the PDF, the DOI's are not "cut" or "hyphened", so that line contains and gets out of the page. How can one fix this?

9
  • Before the bibliography is added, write \raggedright into an ERT box.
    – Johannes_B
    Mar 27, 2016 at 14:44
  • thanks but the problem is that I add my publications "by hand", not using bibtex Mar 27, 2016 at 14:44
  • 2
    If the url and/or hyperref are loaded, you could also enclose the doi string in a \url{...} wrapper.
    – Mico
    Mar 30, 2016 at 7:45
  • 2
    Seems like a minimal working example would be of great help here. meta.tex.stackexchange.com/questions/228/…
    – jonalv
    Mar 30, 2016 at 8:38
  • 2
    We definitely need an MWE. There are many ways of adding the publications "by hand", each of which may have their optimal solutions.
    – akvilas
    Mar 30, 2016 at 17:33

2 Answers 2

3
+50

A simple solution, if you add DOIs by hand is to use the hyperref package in your preamble: \usepackage{hyperref}. Each URL or DOI has to be given in the following format: \href{http://dx.doi.org/10.1007/978-3-531-92180-8}{doi:10.1007/978-3-531-92180-8}. This should create linebreaks where needed.

2
  • looks more like a DOI/ISBN hybrid to me. and wouldn't the / be a marker to hyphenate?
    – naphaneal
    Apr 4, 2016 at 18:24
  • Well, I think it does not matter at all if the DOI is a hybrid. Since any DOI can be wirtten as a http-link (e.g. http://doi.org/10.1000/182), they can be wrapped with a \href{}{}-command. Apr 5, 2016 at 19:23
1

You can define a "\breaking slash" macro via Insert -> Math -> Macro. Define the macro boxes as follows:

Macro name: \brslash
TeX        :/\allowbreak
LyX        :/

The result in LyX will be

enter image description here

So in LyX, enter math mode (Insert -> Math -> Inline formula) then \text (followed by a space bar) to enter plain text in math mode, and then type the DOI. Instead, however, of directly typing a slash, type \brslash. LyX can even have it autocompleted.

A similar macro can be defined for the dash - also.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .