Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Using the Biblatex style from here and tweaking some other things I had some success but not for this thing in bibliography; I have a repeated species name, which is Helicobacter pylori, how to write a code to recognize this word, and may be some other words as well, so that Biblatext can write them in emphasized text once found in the .bib file?

P.S. That word Helicobacter pylori can appear in different forms in titles of references, they all should be emphasized as they are species names, as following:

  • Helicobacter pylori
  • Helicobacter
  • H. pylori
  • H.pylori, i.e., space in between is sometimes omitted
  • Helicobacteraceae, though rarely

Code:

\documentclass[oneside]{scrbook} 
\usepackage[none]{hyphenat}%
%=====================Language, Fonts============================  
\usepackage[ngerman,english]{babel} 
\selectlanguage{english}
\usepackage{courier,mathptmx,amsmath,amsfonts,amssymb} %
\usepackage[utf8]{inputenc} % 
\usepackage[T1]{fontenc} %
\usepackage{cmbright}
%=====================Referencing============================
\usepackage{xcolor} %
\usepackage{hyperref} %
\definecolor{dark-red}{rgb}{0.4,0.15,0.15}
\definecolor{dark-blue}{rgb}{0.15,0.15,0.4}
\definecolor{medium-blue}{rgb}{0,0,0.5}
\hypersetup{
    colorlinks, linkcolor={dark-red},
    citecolor={dark-blue}, urlcolor={medium-blue} %url can be magenta 
    }
\usepackage{filecontents} % to provide file
\begin{filecontents}{\jobname.bib}
@book{kennedy_pcr_2011,
    title = {{PCR} Troubleshooting and Optimization: The Essential Guide},
    isbn = {9781904455721},
    shorttitle = {{PCR} Troubleshooting and Optimization},
    language = {en},
    pagetotal = {245},
    publisher = {Horizon Scientific Press},
    author = {Kennedy, Suzanne},
    date = {2011-01-01},
    keywords = {{PCR} troubleshooting, Polymerase Chain Reaction, {qPCR}, Science / Chemistry / General, Science / Life Sciences / Genetics \& Genomics}
}
@article{akira_role_2000,
    title = {The role of {IL-18} in innate immunity},
    volume = {12},
    issn = {0952-7915},
    url = {http://www.ncbi.nlm.nih.gov/pubmed/10679398},
    issue = {1},
    pages = {59-63},
    journaltitle = {Current Opinion in Immunology},
    shortjournal = {Curr Opin Immunol},
    author = {Akira, S},
    urldate = {2011-09-06},
    date = {Feb 2000},
    note = {{PMID:} 10679398},
    keywords = {Animals, Immunity, Innate, Interferon-gamma, Interleukin-1, Interleukin-12, Interleukin-18, Interleukin-18 Receptor alpha Subunit, Killer Cells, Natural, Mice, Models, Immunological, Receptors, Interleukin, Receptors, Interleukin-18, Signal Transduction, Th1 Cells}
}
@article{vignali_il-12_2012,
    title = {{IL-12} family cytokines: immunological playmakers},
    volume = {13},
    rights = {© 2012 Nature Publishing Group, a division of Macmillan Publishers Limited. All Rights Reserved.},
    issn = {1529-2908},
    url = {http://www.nature.com/ni/journal/v13/n8/full/ni.2366.html},
    doi = {10.1038/ni.2366},
    shorttitle = {{IL-12} family cytokines},
    language = {en},
    issue = {8},
    pages = {722-728},
    journaltitle = {Nature Immunology},
    shortjournal = {Nat Immunol},
    author = {Vignali, Dario A. A. and Kuchroo, Vijay K.},
    urldate = {2012-11-20},
    date = {2012},
    keywords = {{IL-12} family, key reference, language, review},
    file = {Vignali und Kuchroo - 2012 - IL-12 family cytokines immunological playmakers.pdf:D:\Documents\Zotero_Backup\storage\4WZFHV46\Vignali und Kuchroo - 2012 - IL-12 family cytokines immunological playmakers.pdf:application/pdf}
}
@software{matthias_kohl_slqpcr:_2007,
    title = {{SLqPCR:} Functions for analysis of real-time quantitative {PCR} data at {SIRS-Lab} {GmbH.} R package, {SIRS-Lab} {GmbH.} Jena.},
    author = {{Matthias Kohl}},
    date = {2007},
    note = {www.sirs-lab.com}
}

@article{lu_duodenal_2005-1,
    title = {Duodenal ulcer promoting gene of Helicobacter pylori},
    volume = {128},
    issn = {0016-5085},
    url = {http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3130061/},
    issue = {4},
    pages = {833-848},
    journaltitle = {Gastroenterology},
    shortjournal = {Gastroenterology},
    author = {{LU}, {HONG} and {HSU}, {PING–I} and {GRAHAM}, {DAVID} Y. and {YAMAOKA}, {YOSHIO}},
    urldate = {2012-12-19},
    date = {2005-4},
    note = {{PMID:} 15825067
{PMCID:} {PMC3130061}},
    keywords = {{dupA}, first reference, H.pylori, {IL-8}, key reference, virulence},
    file = {LU et al. - 2005 - Duodenal Ulcer Promoting Gene of Helicobacter pylo.pdf:D:\Documents\Zotero_Backup\storage\TDCZTC4F\LU et al. - 2005 - Duodenal Ulcer Promoting Gene of Helicobacter pylo.pdf:application/pdf}
}

\end{filecontents}

\usepackage[backend=biber,style=chem-acs,sorting=none,isbn=false,doi=false]{biblatex} 
\addbibresource{\jobname.bib} % extension must be written
\ExecuteBibliographyOptions{%
  citetracker=true,% Citation tracker enabled in order not to repeat citations, and have two lists.
  sorting=none,% Don't sort, just print in the order of citation
  alldates=long,% Long dates, so we can tweak them at will afterwards
  dateabbrev=false,% Remove abbreviations in dates, for same reason as ``alldates=long''
  articletitle=true,% To have article titles in full bibliography
  maxcitenames=999% Number of names before replacing with et al. Here, everyone.
  }

% No brackets around the number of each bibliography entry
\DeclareFieldFormat{labelnumberwidth}{#1\addperiod}

% Suppress article title, doi, url, etc. in citations
\AtEveryCitekey{%
  \ifentrytype{article}
    {\clearfield{title}}
    {}%
  \clearfield{doi}%
  \clearfield{url}%
  \clearlist{publisher}%
  \clearlist{location}%
  \clearfield{note}%
}

% Print year instead of date, when available; make use of urldate
\DeclareFieldFormat{urldate}{\bibstring{urlseen}\space#1}
\renewbibmacro*{date}{% Based on date bib macro from chem-acs.bbx
  \iffieldundef{year}
    {\ifentrytype{online}
       {\printtext[urldate]{\printurldate}}
       {\printtext[date]{\printdate}}}
    {\printfield[date]{year}}}

% Remove period from titles
\DeclareFieldFormat*{title}{#1}
% Make year bold for @book types
\DeclareFieldFormat[book]{date}{\textbf{#1}} % doctorate added this line
% Embed doi and url in titles, when available
\renewbibmacro*{title}{% Based on title bib macro from biblatex.def
  \ifboolexpr{ test {\iffieldundef{title}}
               and test {\iffieldundef{subtitle}} }
    {}
    {\ifboolexpr{ test {\ifhyperref}
                  and not test {\iffieldundef{doi}} }
       {\href{http://dx.doi.org/\thefield{doi}}
          {\printtext[title]{%
             \printfield[titlecase]{title}%
             \setunit{\subtitlepunct}%
             \printfield[titlecase]{subtitle}}}}
       {\ifboolexpr{ test {\ifhyperref}
                     and not test {\iffieldundef{url}} }
         {\href{\thefield{url}}
            {\printtext[title]{%
               \printfield[titlecase]{title}%
               \setunit{\subtitlepunct}%
               \printfield[titlecase]{subtitle}}}}
         {\printtext[title]{%
            \printfield[titlecase]{title}%
            \setunit{\subtitlepunct}%
            \printfield[titlecase]{subtitle}}}}%
     \newunit}%
  \printfield{titleaddon}%
  \clearfield{doi}%
  \clearfield{url}%
  \clearlist{language}% doctorate added this
  \clearfield{note}% doctorate added this
  \ifentrytype{article}% Delimit article and journal titles with a period
    {\adddot}
    {}}

\begin{document}
The book reference  is here~\parencite{kennedy_pcr_2011}. This article has a bold year in the bibliographye~\parencite{vignali_il-12_2012}, whereas this one not~\parencite{akira_role_2000}. This article also with no year shown~\parencite{lu_duodenal_2005-1}, but has species name called ``\textit{Helicobacter pylori}'' that I want to be emphasized as it should be. If it is possible also to make the author name lower case, otherwise I have to hack this from within the Biblatex translator of Zotero citation manager. I am using TexStudio as \LaTeX{} IDE, while you may use a different one, but that should'nt be a problem anyway.How about using  \verb|multicite| commands of the \verb|Biblatex| neat package by citing all of the above \parencites{see,}{akira_role_2000, kennedy_pcr_2011, vignali_il-12_2012, lu_duodenal_2005-1}. Did you notice that the prenote ``see'' was bold, how to change that to normal? 
\printbibliography[title={References}] % change from bibliography to references
\end{document}

Result after typsetting: enter image description here

enter image description here

share|improve this question
2  
Please reduce your code to the packages that are actually relevant to the question. Have a look at the answer I've just been asked to write a minimal example, what is that?. –  doncherry May 14 '13 at 19:53
2  
Generally, it seems like right about every subquestion you have should be a question of its own. This kind of knowledge management makes it easier for other users with one of your questions to find the answers they need. The way it is, your question might be in danger of being closed as a bad fit for our Q&A format. –  doncherry May 14 '13 at 19:57
2  
Thanks, your effort is appreciated! I do think the splitting up is necessary. While all your questions revolve around the general topic bibliography, they are pretty widespread within this topic, some about citing, one about string macros, one about capitalization, one even specific to an editor. It’d be great if you could put the effort into it! –  doncherry May 14 '13 at 20:47
3  
@doctorate For Q1, the missing dates are due to invalid format. Biber would've warned you about that. For valid date formats see the manual or this post. Q3: Enable the option terseinits. The remaining questions are not closely related. Keeping them together is unlikely to be useful to anyone but you, so I'd follow doncherry's advice. –  Audrey May 14 '13 at 21:41
1  
Regarding the last question, putting the names in braces (e.g., {LU}, {HONG}) is meant to prevent tampering by uppercase-/lowercase-ing commands. I think it is adviseable to make your .bib file conform rather than selectively break this feature on an ad hoc basis. (What is the advantage of allowing Zotero/etc. to create arbitrary database entries and then programmatically correct them on the output side? Isn't it better to have a bibliography file that conforms to the expected specification?) Regarding 'was the book correctly written?', could you elaborate on what that means? –  jon May 14 '13 at 22:34

2 Answers 2

(Too long for a comment...)

There are two obvious ways to format the term 'Heliobacter pylori' consistently: either in the preamble of your document define:

\newcommand\helicobacter{\emph{Helicobacter pylori}}

and use that string in your .bib file; or, to couple the definition more closely with your .bib file, you could put this it the file itself:

@preamble{ "\newcommand\helicobacter{\emph{Helicobacter pylori}}" }

and use the same string in your bibliography entries.

Incidentally, the date formats for akira_role_2000 (i.e., Feb 2000) and lu_duodenal_2005-1 (i.e., 2005-4) are incorrect. Pay attention to biber's warnings, they are usually very explicit and helpful.

The reason see is coming out as bold is because you are not using \parencites correctly. You should change it to:

\parencites[see,][]{akira_role_2000, kennedy_pcr_2011, vignali_il-12_2012, lu_duodenal_2005-1} % not: \parencites{see,}{...}

Finally, your minimal example --- very helpful, by the way --- is missing something like \usepackage{xcolor}.

share|improve this answer
    
concerning species name, it was my mistake, see the updated question, you may come up with a more generic answer to cover all possibilities of the species name. xcolor has been added, thanks a lot. –  doctorate May 15 '13 at 14:52
    
@doctorate -- Regarding the variant species names: are you hoping that one command will automagically recognize an arbitrary list of words and someone reformat them in italics (only) in the bibliography? And without the words being marked-up in any way? Wouldn't it be easier to use something like sed and simply reformat the bibliography entries? –  jon May 15 '13 at 15:05
    
how to implement sed to catch these word combinations of the species name and replace them with marked up LaTeX code? can you come up with a code to do this? I also thinking now of doing it using regex, but I am short of knowledge in both cases. –  doctorate May 17 '13 at 20:51
    
@doctorate -- This sort of substitution with sed is pretty straightforward (and I'm no regex wizard!). I'd run the commands in this order: sed -i.bak 's/Helicobacter pylori/\\helicobacterpylori{}/g' <your file>; sed 's/Helicobacteraceae/\\helicobacteaceae{}/g' <file>; sed 's/Helicobacter/\\helicobacter{}/g' <file>; sed 's/H. pylori/\\hpylori{}/g' <file>; sed 's/H.pylori/\\Hpylori{}/g' <file>. Then define \helicobacterpylori, \helicobacter, \hpylori(= H. pylori), \Hpylori (= H.pylori), and \helicobacteraceae. Just watch that you don't overwrite earlier subsitutions.... –  jon May 18 '13 at 19:11
up vote 1 down vote accepted

Finally, I found a suitable workaround for this problem. The tweaking should not be from within later tool chains, like biblatex, but rather should be dealt with right from the beginning, i.e., from within the citation manager backend, from Zotero, even at the very moment when you automagically grab your reference from the web (BTW that what makes Zotero an interesting program).

<i> Helicobacter pylori </i> is what would solve the issue radically. So everytime you grab a reference from the web, and you feel that some words need to be italicized then just surround them with HTML-like tags in the title from within Zotero, that will give the italicized format like \textit{Helicobacter pylori}once exported as BibTex file format, and finally Helicobacter pylori after LaTeX typesetting, for more types of formatting tags please refer to this weblink. Unfortunately, \emph{} is not yet supported by Zotero export to BibTex format, one workaround is very easy just one find/replace command to find all \textit and replace them with \emph strings will do the trick.

In this way, you don't have to format your entries each time after .bib export from Zotero and most importantly, this fits well into the automation of the whole process now from grabbing a reference from a website into citing that reference, correctly formatted, into a LaTeX document or even MS Word document (for those who are still using it along with LaTeX) without introducing human error, whether during data entry phase or citation key generation phase. If someone is interested in this automated process of bibliography citation using, IMHO, versatile bibliography tools, you can have a look at my answer here.

Edit:

Please note that the following behaviour I have noticed in Zotero:

  • Bibtex epxort of Zotero does not support \epmh{} parsing of HTML-like tags, I think they won't do it also, because that will mess with other things
  • I found that when I introduce two tags to italicize two words that happen to be in one title of a reference, Zotero would parse only the first tag correctly, but not the tags thereafter, so that should be fixed from Zotero in the next releases
  • If it happened that your tag in the beginning of a title, you will find the tag again in the citation key, which I don't think is an elegant way to autogenerate citation keys in Zotero, a more stable citation key, should be devised that ideally wouldn't be influenced by potential tags, either by stripping the title from these tags, or by including other disambiguation key other than the title, of course, plus the author name and year, to make the citation key sensible as much as possible and gives some hint about the cited reference

  • One important feature request for next Zotero would be ability to copy the citation key to the clipboard, by assigingn a dedicated shortcut key for BibTeX format export (which shlouldn't be a problem BTW) like may be; CTRL + ALT + B

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.