3

I am trying to adapt keys to my bibliography section, but Latex still generates its own ones.

My main file:

\documentclass[12pt,a4paper, abstract=on, fleqn]{scrreprt}
\usepackage{scrhack}
\usepackage[latin1]{inputenc}
\usepackage{cite}
\bibliographystyle{alpha}
\usepackage[justification=justified,singlelinecheck=false]{caption}
\usepackage[margin=2.5cm]{geometry}
\makeatletter

\begin{document}

This is a quote: 'bla bla!' from \cite{VDI2607}
\bibliography{literature} 
\bibliographystyle{plain}

\end{document}

literature.bib:

@Book{VDI2607,
author    = {Lamport, Leslie},
title     = {\LaTeX: A Document Preparation System},
year      = {1994},
isbn      = {0-021-52983-1},
publisher = {Addison\,\textendash\,Wesley},

}

I want the link to my source to appear exactly as I defined it in key (VDI2607), but Latex still displays it as [Ing00]

How can I solve this? I want to freely define a key!

bogus
  • 909

1 Answers1

3

copy the file alpha.bst to myalpha.bst and modify the function output.bibitem to

FUNCTION {output.bibitem}
{ newline$
  "\bibitem[" write$
   cite$ write$
%  label write$
  "]{" write$
  cite$ write$
  "}" write$
  newline$
  ""
  before.all 'output.state :=
}

for a test put the file myalpha.bst into your documents directory. Then you'll get the key as label:

\RequirePackage{filecontents}
\begin{filecontents}{myrefs.bib}

@Book{VDI2607,
    author    = {Lamport, Leslie},
    title     = {\LaTeX: A Document Preparation System},
    year      = {1994},
    isbn      = {0-021-52983-1},
    publisher = {Addison\,\textendash\,Wesley},
}
\end{filecontents}

\documentclass{scrreprt}

\usepackage{cite}

\begin{document}

This is a quote: 'bla bla!' from \cite{VDI2607}

\bibliographystyle{myalpha}
\bibliography{myrefs} 

\end{document}

enter image description here

  • Thanks, that's what I was looking for. Just one follow-up question: How can I turn the citation into a link, i.e. make it clickable? – bogus Feb 18 '13 at 09:34
  • use package hyperref –  Feb 18 '13 at 09:43
  • How can the entry keys be ordered alphabetically in the reference list? – bogus Mar 19 '13 at 22:44
  • the sorting is done by bibtex or biber –  Mar 20 '13 at 06:22
  • How can apply bibtex here? All my source entries are in a file \begin{filecontents}{myrefs.bib} ... \end{filecontents}, I am using \bibliography{literature} \bibliographystyle{myalpha} for my bibliography – bogus Mar 20 '13 at 10:04
  • then it is not possible and you have to do it manually. –  Mar 20 '13 at 10:05
  • How can I do it manually? – bogus Mar 20 '13 at 10:07
  • ?? copy and paste, or I didn't understand your problem. –  Mar 20 '13 at 10:08
  • The references are listed in my bibliography, but they are not sorted propperly. I want the entries in the bibiography to be ordered by their keys. For example, "A_reference" has to be listed before "B_reference" – bogus Mar 20 '13 at 10:13
  • I wrote nonsense. Thought that you were using \begin{thebibliography}.... However, what style is myalpha. The default style alpha does the sorting by default. –  Mar 20 '13 at 10:15
  • You defined myalpha above in your answer ;-) It works fine but unfortunately lacks the alphabetical ordering – bogus Mar 20 '13 at 10:20
  • I looked into the style file and there is no easy solution. However, you can run bibtex which creates a file <file>.bbl. You can modify this one and replace the \bibliography{myrefs} with \input{<file>.bbl} –  Mar 20 '13 at 10:44
  • Editing the .bbl seems pointless as it gets immediately overwritten once I build my report, so the "order" is reverted, there is still chaos – bogus Mar 20 '13 at 12:05
  • then rename it to bib.tex and it will be fine. –  Mar 20 '13 at 12:38