Edit entry preview : How to eliminate the Publisher field in Articles but not in Book

I wanted in the following example the publisher (in bold) removed:
Heinrich, B.
Beating the Heat in Obligate Insect Endotherms: The Environmental Problem and the Organismal Solutions
American Zoologist, Oxford University Press (OUP), 1989 , 29 , 1157-1168.

When I removed the field from the entry it worked. But that is not what I intend: I want a condition where the puiblisher is shown in books (and parts thereof) but not in articles.

BTW You have to restart jabref to let editing of the preview becoming effective. This restarting is not enforced why other changes which require restarting are shown to become effictive only after restarting.

Kind regards

Hi,

from what I see, it’s not possible to do model this kind of behavior in the entry preview directly.
A workaround would be to define a custom field e.g. showPublisher with a value like true and then use a conditional output to check if both fields are present: https://docs.jabref.org/import-export/export/customexports#conditional-output
This should only print the publisher if both fields are filled

\begin{publisher&&showPublisher} <em>\format[HTMLChars]{\publisher}, </em>\end{publisher&&showPublisher}

Example entry:

@Book{Trapnell_2009,
  author          = {Cole Trapnell and Lior Pachter and Steven L. Salzberg},
  title           = {{TopHat}: discovering splice junctions with {RNA}-Seq},
  publihser = {Sample publisher},
 showPublisher  = {true}

I do not see how to create a custom field.

Unfortunately the dialog is not yet reimplemented, but you can simply add it in the bibtex source. JabRef will recognize this then

Blockquote
\bibtextype\begin{bibtexkey} (\bibtexkey)\end{bibtexkey}

\begin{author} \format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\author}
\end{author}
\begin{editor} \format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\editor} (\format[IfPlural(Eds.,Ed.)]{\editor})
\end{editor}
\begin{title} \format[HTMLChars]{\title} \end{title}

\begin{chapter} Chap. \format[HTMLChars]{\chapter}
\end{chapter}
\begin{journal} \format[HTMLChars]{\journal}, \end{journal}
\begin{booktitle} \format[HTMLChars]{\booktitle},
\begin{publisher&&showpublisher} \format[HTMLChars]{\publisher}, \end{publisher&&showpublisher}
\begin{year}\year\end{year}\begin{volume}, \volume\end{volume}\begin{pages}, \format[FormatPagesForHTML]{\pages} \end{pages}

\begin{doi} DOI: \format[HTMLChars]{\doi}
\end{doi}
\begin{abstract}

Abstract: \format[HTMLChars]{\abstract} \end{abstract}
\begin{comment}

Comment: \format[HTMLChars]{\comment} \end{comment}

I edited the Preview as shown above.
The bibtex source

Blockquote
@Article{DMC18,
author = {Dancau, Tina and Mason, Peter G. and Cappuccino, Naomi},
year = {2018},
title = {Elusively overwintering: a review of diamondback moth (Lepidoptera: Plutellidae) cold tolerance and overwintering strategy},
abstract = {There is no consensus …},
doi = {10.4039/tce.2018.2},
number = {2},
pages = {156–173},
volume = {150},
groups = {Lepidoptera, winterhardiness},
journal = {The Canadian Entomologist},
owner = {bk},
publisher = {Cambridge University Press},
showpublisher = {false},
timestamp = {2019.12.03},
}

still shows as

Article (DMC18)
Dancau, T.; Mason, P. G. & Cappuccino, N.
Elusively overwintering: a review of diamondback moth (Lepidoptera: Plutellidae) cold tolerance and overwintering strategy
The Canadian Entomologist, Cambridge University Press, 2018 , 150 , 156–173
DOI: 10.4039/tce.2018.2

What is still wrong? Is it “false” or another keyword?
BTW After saving the edited preferences I restarted Jabref since that seems to be necessary.

What is still wrong? Is it “false” or another keyword?

The condition only checks if the field is there and not empty. It doesn’t matter what’s written inside, there is no special keyword. The “true” was just a sample from me. You could also enter “asdf”
So if you don’t want a publisher you can simply omit the field. You only need to add it for those entries where you want to show the publisher.

@Siedlerchr:
I have edited the Preview as follows:

\bibtextype\begin{bibtexkey} (\bibtexkey)\end{bibtexkey}

\begin{author} \format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\author}
\end{author}
\begin{editor} \format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\editor} (\format[IfPlural(Eds.,Ed.)]{\editor})
\end{editor}
\begin{title} \format[HTMLChars]{\title} \end{title}

\begin{chapter} Chap. \format[HTMLChars]{\chapter}
\end{chapter}
\begin{journal} \format[HTMLChars]{\journal}, \end{journal}
\begin{booktitle} \format[HTMLChars]{\booktitle},
\begin{publisher&&showpublisher} \format[HTMLChars]{\publisher}, \end{publisher&&showpublisher}
\begin{year}\year\end{year}\begin{volume}, \volume\end{volume}\begin{pages}, \format[FormatPagesForHTML]{\pages} \end{pages}

\begin{doi} DOI: \format[HTMLChars]{\doi}
\end{doi}
\begin{abstract}

Abstract: \format[HTMLChars]{\abstract} \end{abstract}
\begin{comment}

Comment: \format[HTMLChars]{\comment} \end{comment}

The source is

@InCollection{Hei93a,
author = {Bernd Heinrich},
booktitle = {The Hot-Blooded Insects},
year = {1993},
title = {Night-Flying Moths},
doi = {10.1007/978-3-662-10340-1_2},
pages = {17–75},
publisher = {Springer Berlin Heidelberg},
abstract = {AS anyone who has ever passed a summer … an insect.},
groups = {winterhardiness},
owner = {bk},
showpublisher = {true},
timestamp = {2019.12.03},
}

The resulting preview is now:
InCollection (Hei93a)
Heinrich, B.
Night-Flying Moths
Springer Berlin Heidelberg, 1993 , 17-75
DOI: 10.1007/978-3-662-10340-1_2

The publisher is shown, but not the booktitle. May I ask why?

Happy New Year!

Maybe because \end{booktitle} is missing?

1 Like

Thank you very much, @mlep, that was the reason it did not work.
Now the preview is
InCollection (Hei93a)
Heinrich, B.
Night-Flying Moths
The Hot-Blooded Insects,
Springer Berlin Heidelberg, 1993 , 17-75
DOI: 10.1007/978-3-662-10340-1_2 plus the abstract, as it should be.