7

I am new to this forum and I looked, searched all articles that I think may have similar topics. But my question is still open. Maybe it's because my LaTeX skills are not the best.

Topic:

I am writing a thesis, and my institute tells me how to do formatting for citations (usually we have to use MS Word, so I'm glad I got the allowance to write in LaTeX). But if we write something it should look like that:

LaTeX:

Text, text, text, text, text, text, text, text. [EINS43]

BibTeX/Biber:

Author={Einstein},
Year={1943}, 

Usually if i compile my file it looks like:

Text, text, text, text, text, text, text, text. [Ein43]

How can I change the content of the brackets?

Before I close this question I have to add some more. I also use norms like DIN or ISO. These have to appear like:

Text, text, text, text, text, text, text, text. [ISO03]

To sum up everything i need: Change the content of the bracket (I user Biber for my literature) from 3 letters to 4 uppercase letters; but when I have a norm it shall appear as 3 uppercase letters. In my bib I also user the keys as I like them to appear. Maybe there is a possibility to change the cite-keys in the document just to the input keys?

Thank you for your help!


This is my MWE:

Latex:

\documentclass[listof=totocnumbered, listof=nochaptergap, bibliography=totocnumbered, parskip, captions=nooneline, fontsize=11pt, twoside=semi, numbers=noenddot, open=right, draft=false, a4paper, footinclude=false, fleqn]{scrreprt}
\usepackage[backend=biber, style=alphabetic, isbn=false, url=false, firstinits=true]{biblatex}

\newcommand{\zitat}[2][]{\nopagebreak\nolinebreak\mbox{\cite[][#1]{#2}}} 

%----------------------------------------------------------------
% Also I found that (but I think thats from the template to change the appearance of the Bibliography, and has nothing to do with cite-keys):

\addbibresource{MWE.bib}
\renewcommand{\bibfont}{\sffamily}
\renewcommand{\bibsetup}{\upshape}
\DeclareFieldFormat{title}{#1}
\renewcommand{\multinamedelim}{\addsemicolon\addspace}
\renewcommand{\finalnamedelim}{\addsemicolon\addspace}
\renewcommand*{\labelnamepunct}{\addcolon\addspace}
\DeclareNameAlias{default}{last-first}
\renewbibmacro*{in:}{%  
   \iffieldundef{maintitle}
    {}
    {\printtext{%
    \intitlepunct}}}
\renewbibmacro*{byeditor+others}{%
  \ifnameundef{editor}
    {}
    {%
     \printnames[byeditor]{editor}%
     \setunit{\addspace}%
     \usebibmacro{byeditor+othersstrg}
     \clearname{editor}% 
     \newunit}%
  \usebibmacro{byeditorx}%
  \usebibmacro{bytranslator+others}
}
\AtEveryBibitem{\clearfield{language}}
\renewcommand{\finentrypunct}{} 
\DefineBibliographyStrings{ngerman}{%
    editor = {(Hrsg.).},
    editors = {(Hrsg.).},
    byeditor = {(Hrsg.).},
    editor = {(Hrsg.).}}    
%----------------------------------------------------------------

\begin{document}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. \zitat[S. 165-166]{ROOS15}\\
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.\zitat{ZENK10}\\
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.\zitat{DIN05}\\

\printbibliography
\end{document}

Biber (MWE.bib):

@conference{DIN05,
    Author = {{Normenausschuss Materialpr{\"u}fung im DIN}},
    Booktitle = {Norm DIN EN ISO 6507 Teil 1},
    Date-Added = {2015-07-01 16:33:02 +0000},
    Date-Modified = {2015-07-03 03:23:48 +0000},
    Keywords = {DIN, Vickers, H{\"a}rtepr{\"u}fung},
    Title = {Metallische Werkstoffe - H{\"a}rtepr{\"u}fung nach Vickers - Teil 1: Pr{\"u}fverfahren},
    Year = {2005}}

@book{ZENK10,
    Address = {Germany},
    Author = {Zenker, R.; Buchwalder, A.},
    Date-Added = {2015-05-29 21:10:31 +0000},
    Date-Modified = {2015-06-21 04:52:47 +0000},
    Keywords = {EBH, Pro-beam},
    Publisher = {pro-beam AG \& Co. KGaA},
    Subtitle = {Innovative Technologien f{\"u}r h{\"o}chste industrielle Anspr{\"u}che},
    Title = {Elektronenstrahlrandschichtbehandlung},
    Year = {2010}}

@book{ROOS15,
    Address = {Stuttgart},
    Annote = {S. 179
6.4.2.9 Randschichth{\"a}rten},
    Author = {Roos, E.; Maile, K.},
    Date-Added = {2015-05-13 19:05:21 +0000},
    Date-Modified = {2015-06-21 21:35:57 +0000},
    Isbn = {978-3-642-54989-2},
    Publisher = {Springer Vieweg},
    Subtitle = {Grundlagen, Anwendung, Pr{\"u}fung},
    Title = {Werkstoffkunde f{\"u}r Ingenieure},
    Year = {2015}}
  • 1
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Martin Schröder Jul 18 '15 at 23:27
  • 2
    In the BibTeX format names are separated with and not with a semicolon, so you will want your author fields to read Author = {Zenker, R. and Buchwalder, A.}, and Author = {Roos, E. and Maile, K.},. Address = {Germany} seems pretty nondescript to me, either use something like address = {Karlsruhe} or drop it entirely. – moewe Jul 19 '15 at 7:16
  • 1
    I think your request quite unusual. Letting biblatex handle the labelling automatically will make sure there are no inconsistencies and you will have to think less. In some cases it might be useful to override a label created by biblatex in which case you can use the shorthand field (the label field is a fallback). – moewe Jul 19 '15 at 7:18
6

It seems that you want to use your entry names as labels.

To do that, simply add the following lines to your preamble:

\DeclareLabelalphaTemplate{%
  \labelelement{%
    \field{citekey}
  }
}

In this way you are declaring that the label generated for your entries is the same as your entry name (pseudo-field citekey).

MWE:

\documentclass[listof=totocnumbered, listof=nochaptergap, bibliography=totocnumbered, parskip, captions=nooneline, fontsize=11pt, twoside=semi, numbers=noenddot, open=right, draft=false, a4paper, footinclude=false, fleqn]{scrreprt}
\usepackage[backend=biber, style=alphabetic, isbn=false, url=false, firstinits=true]{biblatex}

\newcommand{\zitat}[2][]{\nopagebreak\nolinebreak\mbox{\cite[][#1]{#2}}}

\DeclareLabelalphaTemplate{%
  \labelelement{%
    \field{citekey}
  }
}

%----------------------------------------------------------------
% Also I found that (but I think thats from the template to change the appearance of the Bibliography, and has nothing to do with cite-keys):

\addbibresource{MWE.bib}
\renewcommand{\bibfont}{\sffamily}
\renewcommand{\bibsetup}{\upshape}
\DeclareFieldFormat{title}{#1}
\renewcommand{\multinamedelim}{\addsemicolon\addspace}
\renewcommand{\finalnamedelim}{\addsemicolon\addspace}
\renewcommand*{\labelnamepunct}{\addcolon\addspace}
\DeclareNameAlias{default}{last-first}
\renewbibmacro*{in:}{%
   \iffieldundef{maintitle}
    {}
    {\printtext{%
    \intitlepunct}}}
\renewbibmacro*{byeditor+others}{%
  \ifnameundef{editor}
    {}
    {%
     \printnames[byeditor]{editor}%
     \setunit{\addspace}%
     \usebibmacro{byeditor+othersstrg}
     \clearname{editor}%
     \newunit}%
  \usebibmacro{byeditorx}%
  \usebibmacro{bytranslator+others}
}
\AtEveryBibitem{\clearfield{language}}
\renewcommand{\finentrypunct}{}
\DefineBibliographyStrings{ngerman}{%
    editor = {(Hrsg.).},
    editors = {(Hrsg.).},
    byeditor = {(Hrsg.).},
    editor = {(Hrsg.).}}
%----------------------------------------------------------------

\begin{document}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. \zitat[S. 165-166]{ROOS15}\\
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.\zitat{ZENK10}\\
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.\zitat{DIN05}\\

\printbibliography
\end{document} 

Output:

enter image description here

As a side note, if your files are utf8-encoded, adding the line

\usepackage[utf8]{inputenc}

in your .tex document, you will be able to substitute things like {\"o} with simply ö both in your .tex and .bib files.

  • You might also want to add that the request with four letters and two digits of the year is possible with \DeclareLabelalphaTemplate{ \labelelement{ \field[strwidth=4, strside=left, uppercase, names=1]{labelname} } \labelelement{ \field[strwidth=2, strside=right]{year} } } the norms will need a shorthand then, though. – moewe Jul 19 '15 at 15:55
  • 1
    @moewe Since the OP has requested two different strwidths, that's why I didn't add this possibility ;-) – karlkoeller Jul 19 '15 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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