Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lokales Ausschalten von bibhyperref bei citetranslator #112

Closed
LukasCBossert opened this issue Aug 10, 2017 · 5 comments
Closed

Lokales Ausschalten von bibhyperref bei citetranslator #112

LukasCBossert opened this issue Aug 10, 2017 · 5 comments
Assignees
Milestone

Comments

@LukasCBossert
Copy link
Owner

Nach deiner Vorlage, @moewew , auf https://tex.stackexchange.com/a/385721/98739 habe ich citetranslator modifiziert.
Allerdings ist jetzt der Fall, dass die Bibstrings auch auf den Bibliographieeintrag verweisen. Kann man die lokal abschalten, sodass die nicht verknüpft sind?
Danke!!

\documentclass[ngerman]{scrbook}
\usepackage{filecontents,etoolbox,babel}
\begin{filecontents}{\jobname.bib}
@Book{Varro_ling,
  author      = {Terentius Varro, Marcus},
  editor      = {William Heinemann},
  title       = {On the Latin Language},
  location    = {Cambridge and London},
  year        = {1993},
  volume      = {I--II},
  series      = {Loeb Classical Library},
  number      = {333--334},
  edition     = {3},
  origtitle   = {de lingua latina},
  translator  = {Kent, Roland G.},
  shorthand   = {Varro ling.},
  shortauthor = {Varro},
  keywords    = {ancient},
  options     = {ancient},
  origdate    = {1938},
}
@Book{Varro_rust,
  author      = {Terentius Varro, Marcus},
  origtitle   = {de re rustica},
  shorthand   = {Varro rust.},
  shortauthor = {Varro},
  keywords    = {ancient},
  options     = {ancient},
}

\end{filecontents}
\usepackage[           
  backend=biber,
%style=../biblatex-archaeologie/archaeologie,
style=archaeologie,
]{biblatex}
\DeclareCiteCommand{\citetranslator}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \renewcommand*{\multinamedelim}{\addcomma\space}%
   \renewcommand*{\finalnamedelim}{%
   \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
   \addspace\bibstring{and}\space}%
   \usebibmacro{prenote}}%
  {\usebibmacro{citeindex}%
\ifboolexpr{%
   test {\ifbool{bbx:inreferences}}%
   and %
   test  {\ifentrytype{inreference}}%
   }%
  {\printtext}%
  {\printtext[bibhyperref]}%
  {\ifthenelse{% 
    \ifentrytype{incollection}%
    \OR%
    \ifentrytype{inbook}%
  }%
  {\ifnameundef{intranslator}%
   {\bibstring{owntranslation}}% <--- hyperref aktiviert
   {\printnames[citeauthor]{intranslator}}}%
  {\ifnameundef{translator}%
   {\bibstring{owntranslation}}% <--- hyperref aktiviert
   {\printnames[citeauthor]{translator}}}}}%
  {\multicitedelim}%
  {\usebibmacro{postnote}}
	
\addbibresource{\jobname.bib}
\def\me{ich}

\DefineBibliographyStrings{ngerman}{%
    owntranslation = {\me},%
}

\newcommand\mytrans[1]{Transl. \citetranslator{#1}}
\usepackage{hyperref}
\begin{document}
Transl. (Varro ling): \citetranslator{Varro_ling}\par
Transl. (Varro rust): \citetranslator{Varro_rust}\par
\mytrans{Varro_ling}\par
\mytrans{Varro_rust}

\printbibliography
\end{document}
@LukasCBossert LukasCBossert added this to the 2.32 milestone Aug 10, 2017
@LukasCBossert LukasCBossert self-assigned this Aug 10, 2017
@moewew
Copy link
Contributor

moewew commented Aug 10, 2017

Da Du doch sowieso mit der ersten Abfrage schaust, ob Du einen Link setzt oder nicht, musst Du doch nur die Logik ein bisschen umdrehen.

@moewew
Copy link
Contributor

moewew commented Aug 10, 2017

Vielleicht so

\DeclareCiteCommand{\citetranslator}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \renewcommand*{\multinamedelim}{\addcomma\space}%
   \renewcommand*{\finalnamedelim}{%
     \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
      \addspace\bibstring{and}\space}%
   \usebibmacro{prenote}}%
  {\usebibmacro{citeindex}%
   \ifboolexpr{% 
     test {\ifentrytype{incollection}}
     or
     test {\ifentrytype{inbook}}
   }%
     {\ifnameundef{intranslator}%
        {\bibstring{owntranslation}}%
        {\printtext[bibhyperref]{\printnames[citeauthor]{intranslator}}}}%
     {\ifnameundef{translator}%
       {\bibstring{owntranslation}}%
       {\ifboolexpr{%
          test {\ifbool{bbx:inreferences}}%
          and %
          test  {\ifentrytype{inreference}}%
        }%
          {\printnames[citeauthor]{translator}}
          {\printtext[bibhyperref]{\printnames[citeauthor]{translator}}}}}}
  {\multicitedelim}%
  {\usebibmacro{postnote}}

@LukasCBossert
Copy link
Owner Author

Ah, dort hätte ich die Logik ändern müssen. klappt wunderbar!! Mal wieder vielen Dank!!!

@moewew
Copy link
Contributor

moewew commented Aug 10, 2017

Ah, wo wir gerade dabei sind: test {\ifbool{bbx:inreferences}}% wird kürzer zu bool {bbx:inreferences}, also

        \ifboolexpr{
          bool {bbx:inreferences}
          and
          test  {\ifentrytype{inreference}}
        }% 

statt

        \ifboolexpr{%
          test {\ifbool{bbx:inreferences}}%
          and %
          test  {\ifentrytype{inreference}}%
        }% 

Die % braucht man in \ifboolexpr nicht (die etoolbox-Doku dazu: "Spaces, tabs, and line endings may be used freely to arrange the expression visually. Blank lines are not permissible in the expression.")

@LukasCBossert
Copy link
Owner Author

Das leuchtet ein! danke!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants