1

Despite my lack of LaTeX skills, with the help of the forum, I have been making good progress on developing an updated SAE class for writing SAE papers with LaTeX. Next up: Properly formatting "Internet References" in the bibliography.

I am using biblatex/biber, and while it seems obvious that there is a lot of power in using this combination for bibliographies, it is not obvious to me on how to manipulate the formatting. So again, I ask for help in this area.

Let's take as an example the following bib-entry:

@Online{Dowanol2012,
  Title                    = {DOWANOL (TM) TPM Technical Data Sheet},
  Url                      = {http://msdssearch.dow.com/PublishedLiteratureDOWCOM/dh_08ad/0901b803808ad68e.pdf?filepath=oxysolvents/pdfs/noreg/110-00619.pdf&fromPage=GetDoc},
  Note                     = {Accessed 9/8/2015},
  Organization             = {The DOW Chemical Company},
  Urldate                  = {2015-09-08},
  Year                     = {2012},
}

With my current attempt, I get the following entry in my bibliography:

DOWANOL (TM) TPM Technical Data Sheet, Accessed 9/8/2015. The DOW Chemical Company, 2012, http://msdssearch.dow.com/PublishedLiteratureDOWCOM/dh_08ad/0901b803808ad68e.pdf?filepath=oxysolvents/pdfs/noreg/110-00619.pdf&fromPage=GetDoc, accessed 09/08/2015.

What I need it to look like is the following:

The DOW Chemical Company, "DOWANOL (TM) TPM Technical Data Sheet," http://msdssearch.dow.com/PublishedLiteratureDOWCOM/dh_08ad/0901b803808ad68e.pdf?filepath=oxysolvents/pdfs/noreg/110-00619.pdf&fromPage=GetDoc, accessed Sep. 2015.

The urldate field is maybe not the most appropriate to use for getting Sep. 2015 instead of 09/08/2015, I'm not sure. Maybe I can access month/year from the urldate?

Also, I removed italics on the title using the following:

\DeclareFieldFormat[online]{title}{#1}

But after that, I'm not sure how to reorder everything, get rid of the double printing of the url date and do all the formatting (i.e. quotation marks around the title, etc.)

Here is a current MWE:

\documentclass[letterpaper]{article}

% This package allows for detailed control of urls within the document and in the bibliography.
\usepackage{filecontents}
\usepackage{url}
\usepackage{color}
\usepackage{xcolor}
\usepackage[american]{babel}
\usepackage{csquotes}

\usepackage[style=numeric-comp, maxbibnames=4, minbibnames=3, sorting=none,firstinits=true, url=false, doi=true, backend=biber]{biblatex}

% Change the font size of the references list
\renewcommand*{\bibfont}{\small}

% Fix the way URLs are displayed.
\DeclareFieldFormat{url}{\url{#1}}
\DeclareFieldFormat{urldate}{\bibstring{urlseen}\space#1}
\renewbibmacro*{url+urldate}{%
  \usebibmacro{url}%
  \iffieldundef{urlyear}
    {}
    {\setunit*{\addcomma\space}%
     \usebibmacro{urldate}}}

% Print an access date on URLs.
\DefineBibliographyStrings{american}{urlseen = {accessed}}

% Typesets the URL (and DOI) in the same font as the document  
\urlstyle{same}

% Print an access date on URLs.
\DefineBibliographyStrings{american}{urlseen = {accessed}}

% Remove the italics on the title (how do I get quotes around it)?
\DeclareFieldFormat[online]{title}{#1}

% This line defines which file(s) bibtex will look for your bib entries (i.e. the name of your *.bib file without the extension). 
\bibliography{test}

\usepackage{hyperref}
\hypersetup{
  pdfencoding = {auto},
  pdfauthor   = {Dr. Who},
  pdftitle    = {Title},
  urlcolor    = blue,
  pdffitwindow=true,
  pdfkeywords={LLFC}, % Keywords 
  pdfnewwindow=true, % links in new window
  colorlinks=true, % false: boxed links; true: colored links
  linkcolor=red, % Color of internal links (change box color with linkbordercolor)
  linkbordercolor=red,
  citecolor=green,
  filecolor=magenta, 
  urlcolor=blue
}

\begin{filecontents}{test.bib}
@Online{Dowanol2012,
  Title                    = {DOWANOL (TM) TPM Technical Data Sheet},
  Url                      = {http://msdssearch.dow.com/PublishedLiteratureDOWCOM/dh_08ad/0901b803808ad68e.pdf?filepath=oxysolvents/pdfs/noreg/110-00619.pdf&fromPage=GetDoc},
  Note                     = {Accessed 9/8/2015},
  Organization             = {The DOW Chemical Company},
  Urldate                  = {2015-09-08},
  Year                     = {2012},
}
\end{filecontents}

\begin{document}
This is a test document with one citation \cite{Dowanol2012}.
\renewcommand\refname{References}
\printbibliography
\end{document}

Oh, and technically the hyperlink should be underlined and blue... I can get it blue, but I'm having trouble getting it underlined. Especially only for urls that are part of the "@online" bib-type. URLs for the DOIs of journal articles should be underlined but not blue (I can address this later in a separate thread though, just trying to give context for the weird formatting I am trying to accomplish to meet SAE guidelines).

1
  • The note field is certainly superfluous if you have the urldate field. You can also simply make The DOW Chemical Company the author instead of organization, see also corporate authors in BibTeX.
    – moewe
    Feb 23, 2016 at 7:06

1 Answer 1

1

In this answer I will assume that your document uses the code from Has anybody implemented Society of Automotive Engineer (SAE) style bibliographies with a biblatex/biber solution?, so we don't have to deal with details that have been addressed there.

Most work can already been done by changing the .bib entry. "The DOW Chemical Company" may well be the author and not the organization (see also Using a 'corporate author' in the “author” field of a bibliographic entry (spelling out the name in full), the biblatex documentation has a short word about that in §2.3.3 Corporate Authors and Editors, p. 31). The note field also seems unnecessary seeing that the information is already in the urldate field. So I would go with

@Online{Dowanol2012,
  Title    = {DOWANOL (TM) TPM Technical Data Sheet},
  Url      = {http://msdssearch.dow.com/PublishedLiteratureDOWCOM/dh_08ad/0901b803808ad68e.pdf?filepath=oxysolvents/pdfs/noreg/110-00619.pdf&fromPage=GetDoc},
  author   = {{The DOW Chemical Company}},
  Urldate  = {2015-09-08},
  Year     = {2012},
}

Then the only thing that needs changing is the urldate output, just choose urldate=long and then you may drop the day using

\DefineBibliographyExtras{english}{
  \protected\def\mkbibdatelong#1#2#3{%
    \iffieldundef{#2}
      {}
      {\mkbibmonth{\thefield{#2}}%
       \iffieldundef{#1}{}{\space}}%
     \iffieldbibstring{#1}
       {\bibstring{\thefield{#1}}}
       {\stripzeros{\thefield{#1}}}}}

MWE

\documentclass[letterpaper]{article}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=numeric-comp, maxbibnames=4, minbibnames=3, sorting=none,firstinits=true, url=false, doi=true, backend=biber, urldate=long]{biblatex}

\renewcommand*{\bibfont}{\small}

\DeclareFieldFormat{url}{\url{#1}}
\DeclareFieldFormat{urldate}{\bibstring{urlseen}\space#1}
\renewbibmacro*{url+urldate}{%
  \usebibmacro{url}%
  \iffieldundef{urlyear}
    {}
    {\setunit*{\addcomma\space}%
     \usebibmacro{urldate}}}

\DefineBibliographyStrings{american}{urlseen = {accessed}}

\urlstyle{same}

\DeclareFieldFormat[online]{title}{\mkbibquote{#1\isdot}}
\renewcommand*{\newunitpunct}{\addcomma\space}

\DefineBibliographyExtras{english}{
  \protected\def\mkbibdatelong#1#2#3{%
    \iffieldundef{#2}
      {}
      {\mkbibmonth{\thefield{#2}}%
       \iffieldundef{#1}{}{\space}}%
     \iffieldbibstring{#1}
       {\bibstring{\thefield{#1}}}
       {\stripzeros{\thefield{#1}}}}}

\usepackage{hyperref}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Online{Dowanol2012,
  Title    = {DOWANOL (TM) TPM Technical Data Sheet},
  Url      = {http://msdssearch.dow.com/PublishedLiteratureDOWCOM/dh_08ad/0901b803808ad68e.pdf?filepath=oxysolvents/pdfs/noreg/110-00619.pdf&fromPage=GetDoc},
  author   = {{The DOW Chemical Company}},
  Urldate  = {2015-09-08},
  Year     = {2012},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
This is a test document with one citation \cite{Dowanol2012}.

\printbibliography
\end{document}
6
  • first, your assumption is correct, and I tried to create an MWE that would include only the aspects that would affect internet references. Your answer comes really close to fully answering my question... the last things are that I can't seem to figure out how to get the comma after the url, as well as make the url underlined. The combinations I have tried seem to remove or add spaces in weird places, and if I try something like \DeclareFieldFormat{url}{\underline{\url{#1}}} for underlining, then it doesn't allow line breaks in the url and everything looks funny. Any thoughts there?
    – R.K.G.
    Feb 23, 2016 at 16:16
  • @R.K.G. I'm afraid the underline/line breaking thing is beyond my capabilities. Line breaking is complicated and gets more complex in the bibliography. Breaking URLs is even more complicated, but fortunately there is a package for that (url, loaded automatically by biblatex). Underlining is also quite complicated with TeX and breaking underlined text is a very, very complicated matter (ulem and soul can do something in that regard). But combining URL and underlining while retaining line breaks is not something I ever managed to do.
    – moewe
    Feb 23, 2016 at 16:21
  • @R.K.G. I'm a bit confused, in my MWE there is a comma after the URL.
    – moewe
    Feb 23, 2016 at 16:21
  • I think I (or perhaps SAE) can live without the underlines on URLS. As for the comma, I usually do quick testing using overleaf: overleaf.com/4322600cgmjwb and here it showed no comma. I tried again using a standard latex distribution and the comma is there. Go figure.
    – R.K.G.
    Feb 23, 2016 at 16:38
  • @R.K.G. If you and the SAE can live without underlined URLs that makes things really easier. There are a few questions about underlined URLs with line breaks on this site, but I have yet to find a really good solution (there are some that fake underlining in the PDF viewer with hyperref's link borders, but that is not printed later I believe). I think you cannot see the comma in overleaf because the link border is quite thick, if you disable the borders the comma is definitely there.
    – moewe
    Feb 23, 2016 at 16:46

You must log in to answer this question.

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