2

First of all, I have tried Disabling URLs in bibliography and it does not work.

Secondly, I am not repeating Suppress certain URLS in bibliography as I prefer to not edit the bib file, which is automatically generated.

I am preparing a conference publication to be submitted to IEEE; so, please don't suggest editing the bibliography style file (IEEEtran.bst).

I have a .bib file generated from Mendeley which contains url fields. Currently, I manually delete them. However, in favor of efficiency, I would like either

  1. A way to export from Mendeley without urls

or

  1. A way to disable insertion of url in the bibliography, preferrably via a directive or a flag

preferably both!


A minimal example [source.tex]

\documentclass[conference]{IEEEtran}

\begin{document}
\bstctlcite{MyBSTcontrol}
\title{I need a vacation!}
\author{\IEEEauthorblockN{tokyo coder}
\IEEEauthorblockA{Institute of Random Stuff, A big University, Japan}}
\maketitle
\IEEEpeerreviewmaketitle

\section{Introduction}
kill me now \cite{Levecque2017} \\does happiness exist?

\bibliographystyle{IEEEtran}
\bibliography{science,disabl_url}

% that's all folks
\end{document}

The bib file is [science.bib]

@article{Levecque2017,
author = {Levecque, Katia and Anseel, Frederik and {De Beuckelaer}, Alain and {Van der Heyden}, Johan and Gisle, Lydia},
doi = {http://dx.doi.org/10.1016/j.respol.2017.02.008},
isbn = {3907},
issn = {0048-7333},
journal = {Research Policy},
keywords = {GHQ-12,Mental health,PhD students,Psychosocial working conditions,Work organization},
number = {4},
pages = {868--879},
publisher = {Elsevier B.V.},
title = {{Work organization and mental health problems in PhD students}},
url = {http://www.sciencedirect.com/science/article/pii/S0048733317300422},
volume = {46},
year = {2017}
}

Second bib file is [disabl_url.bib]

@IEEEtranBSTCTL{MyBSTcontrol,
    CTLuse_url = "no",
}
  • 1
    I have no idea if Mendeley can suppress the url export. Regarding the tex side: Make a complete example so that one can test how the bbl looks like. – Ulrike Fischer Mar 17 '17 at 10:55
  • 2
  • I think my old question (not even the answers to it) answers your question. Without an example we can't tell how you're using the bibliography so I can't be sure. – Chris H Mar 17 '17 at 11:14
  • 1
    Well at least your second point looks like a duplicate of the question you linked to. – Skillmon Mar 17 '17 at 11:15
  • 1
    Otherwise on a unix-like (or windows with cygwin) system, from the commandline: sed 's/^\s*url.*,//' bibliography.bib >temp.bib will delete lines starting "url" (it will leave a blank line but that doesn't matter). – Chris H Mar 17 '17 at 11:18
  • 1
    Can you please show a minimal example? One single bib entry with a URL suffices, together with a minimal document from \documentclass to \end{document}. – egreg Mar 17 '17 at 11:23
  • 3
    @ChrisH: This is not a duplicate to your question. Your question uses biblatex, but here a bst-file is used. – Ulrike Fischer Mar 17 '17 at 11:59
  • @UlrikeFischer, good spot, thanks. I'd looked for a bibtex tag or just a mention of bibtex, but missed the file extension. I'll promote my other comment to an answer as well, if the question is likely to stay open. – Chris H Mar 17 '17 at 13:13
  • 1
    see http://tex.stackexchange.com/a/268987/36296 – samcarter_is_at_topanswers.xyz Mar 17 '17 at 13:14
  • 4
  • Why can't you use this solution? – gernot Mar 26 '17 at 09:37
  • @gernot tried that; does not work – tokyoCoder Apr 21 '17 at 03:04
  • @samcarter tried that; does not work – tokyoCoder Apr 21 '17 at 03:06
  • @samcarter Please read the question before commenting that it is a duplicate of Disabling URLs in bibliography. It is not. – tokyoCoder Apr 21 '17 at 03:08
  • 1
    @tokyoCoder We read the little information that you have provided, and for this, Disabling URLs in bibliography is the perfect answer. May it be that you didn't read the answer? The answer requires you to modify the bib file by setting a flag (something that you are looking for), not the bst file. If you really tried that and failed: Explain what you did and what you mean by "it doesn't work". And provide more information, like an MWE including a small bib file. – gernot Apr 21 '17 at 07:32
  • 1
    @tokyoCoder Please excuse, but I did read your question. You are asking, quote "preferrably via a directive or a flag" and the linked answer is exactly that. If it does not work for you, please show us the code you tried, the linked answer clearly works - just saying "does not work" is not really helpful information. – samcarter_is_at_topanswers.xyz Apr 21 '17 at 08:47
  • @samcarter I spend several hours trying different solutions including https://tex.stackexchange.com/a/268987/110998 . I just failed to see how it solves the problem, just like how you did not see why it doesn't. I finally managed to reduce my file to a minimal example. I hope that could clear things a little better. Sorry for the confusion. – tokyoCoder Apr 24 '17 at 03:36
  • @gernot. Thank you for trying to help me. If you had explicitly asked for a working example, it would have been clear to me what I should have done. Just marking it as duplicate did not solve my issue, rather left me wondering how it solves it in the first place. In any case, I am updating the question with an example. I hope that clears things a little. – tokyoCoder Apr 24 '17 at 03:39
  • @UlrikeFischer Thank you for the help. I have added an example. Maybe it can clear the situation a little more. – tokyoCoder Apr 24 '17 at 03:51
  • 1
    Your entry in disable_url.bib works fine for and disables the url's. So what is your problem? – Ulrike Fischer Apr 24 '17 at 07:15
  • @tokyoCoder Using your MWE I get https://i.stack.imgur.com/fMGry.png -> no urls. What does your output look like? – samcarter_is_at_topanswers.xyz Apr 24 '17 at 08:47
  • 1
    Which version of IEEEtran.bst do you use? The current one seems to be Version 1.14 (2015/08/26), and it has the handling of CTLuse_url built in. – gernot Apr 24 '17 at 16:54
  • @gernot I was using the IEEEtran.bst from IEEE's conference web page http://www.ieee.org/conferences_events/conferences/publishing/templates.html . It is Version 1.12 Using Version 1.14 from CTAN solved the issue. Thank you very much! – tokyoCoder Apr 25 '17 at 09:12
  • 2
    I'm voting to close this question as off-topic because it caused by an outdated package version. – Schweinebacke Apr 25 '17 at 09:59
  • @Schweinebacke I also request you to update the answer at http://tex.stackexchange.com/questions/26318/disabling-urls-in-bibliography because otherwise, people will never find the solution particularly considering that IEEE website itself is providing outdated packages. – tokyoCoder Apr 26 '17 at 03:43

2 Answers2

2

One way to do this is to automatically edit the .bib file to remove the url field. After exporting your file from mendeley, you would need to delete all lines starting url (with possible whitespace first), writing to a new .bib file (as your master bibliography is in mendeley you could overwrite the original but in the general case I don't suggest you do). This is easily done on the commandline using sed (available on all unix-like systems, including mac, also possible on windows by using Cygwin or MinGW, or just installing it). Any decent programmer's text editor will also provide a way to do the same thing (regex find/replace).

The command you actually need is sed 's/^\s*url.*,//' bibliography.bib >temp.bib, which breaks down to run sed to substitute (s/) from the beginning of the line (^) one or more (*) whitespace characters (\s) followed by "url", and one or more (*) of any character except newline (.) up to a comma. The replacement is blank (given by the // as / is the delimiter). This leaves a blank line where the url was, but bibtex won't mind.

If the url is the last item in the entry, with no comma at the end of the line, this won't work. So if mendeley (I tried it once and never used it again) puts the url last in the entry, we'll need a slightly different replacement, which will depend on whether the final closing } of the entry is on its own line or on the same line as the url. A more complex regex could take these variables into account, but I find it that it's better to keep things simple as there's less to go wrong.

Chris H
  • 8,705
1

Get a recent copy of IEEEtran.bst from CTAN, at least Version 1.14 (2015/08/26). Then proceed as described in Disabling URLs in bibliography.

gernot
  • 49,614