TransWikia.com

How to disable italics for textgreek in .bib output

TeX - LaTeX Asked on April 26, 2021

I would like to disable the italics for the titles in Greek from my .bib file, but not for the entire document. How should I do?

I believe that the best way is to use emph{} with Greek characters when needed without using textgreek{} [I need italics for Greek only a few times], and to disable italics options for textgreek{}, but I don’t know how to do the last operation in the preamble of the main document.

% !TeX encoding = UTF-8
% !TeX TS-program = xelatex
% !TeX spellcheck = it_IT
% !TeX root = Italics.tex
% !BIB TS-program = biber


documentclass[a4paper,12pt]{article}

usepackage[no-math]{fontspec} 
    setmainfont[Ligatures=TeX,Numbers=OldStyle]{Linux Libertine O}

usepackage{polyglossia} 
    setmainlanguage[babelshorthands=true]{italian}
    setotherlanguages{latin,greek,english,german,russian,serbian}
        setkeys{greek}{variant=polytonic}


usepackage[style=phys, sorting=none, defernumbers=true]{biblatex}

addbibresource{bibliography.bib}
begin{document}

emph{ἄνθρωπος}

printbibliography[keyword=regular,title={Bibliography}]
nocite{*}


end{document}

@book{Sathas.1872,
 editor = {Sathas, Konstantinos N.},
 year = {1872-1894},
 title = {textgreek{Μεσαιωνικὴ Βιβλιοθήκη. Συλλογὴ ἀνεκδότων μνημείων τῆς Ἑλλενικῆς ἱστορίας}},
 volumes = {I-VII},
 address = {textgreek{Παρίσι}},
 publisher = {textgreek{Ἑταιρεία Μακεδονικῶν Σπουδῶν}}
}

One Answer

If you want to change the title formatting only for a certain language, you need to set the languageid in the entry and check for it in the formatting command with iffieldequalstr.

In SathasA the field languageid is set to greek while in SathasB the field is completely omitted:

documentclass[a4paper,12pt]{article}

begin{filecontents*}{jobname.bib}
  @book{SathasA,
    editor = {Sathas, Konstantinos N.},
    date = {1872},
    title = {Μεσαιωνικὴ Βιβλιοθήκη. Συλλογὴ ἀνεκδότων μνημείων τῆς Ἑλλενικῆς ἱστορίας},
    volumes = {I-VII},
    address = {Παρίσι},
    publisher = {Ἑταιρεία Μακεδονικῶν Σπουδῶν},
    langid = {greek}
  }
  @book{SathasB,
    editor = {Sathas, Konstantinos N.},
    date = {1872},
    title = {Μεσαιωνικὴ Βιβλιοθήκη. Συλλογὴ ἀνεκδότων μνημείων τῆς Ἑλλενικῆς ἱστορίας},
    volumes = {I-VII},
    address = {Παρίσι},
    publisher = {Ἑταιρεία Μακεδονικῶν Σπουδῶν},
  }
end{filecontents*}

usepackage{fontspec} 
  setmainfont[Ligatures=TeX,Numbers=OldStyle]{Linux Libertine O}

usepackage{csquotes}

usepackage{polyglossia} 
  setmainlanguage{italian}
    setotherlanguages{greek,english}
      setkeys{greek}{variant=polytonic}

usepackage[style=phys, sorting=none]{biblatex}
  addbibresource{jobname.bib}
  DeclareFieldFormat{title}{% <-- change the format of the title field
    iffieldequalstr{langid}{greek}{normalfont{#1}}{mkbibitalic{#1}}}
    % if langid = greek, then use normalfont else use mkbibitalic
  
begin{document}

emph{ἄνθρωπος} autocite{SathasA}
emph{ἄνθρωπος} autocite{SathasB}
printbibliography[title={Bibliography}]
end{document}

enter image description here


If you want the whole citation in greek (translated strings, etc.), then add the biblatex option autolang=other:

enter image description here

Answered by DG' on April 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP