# Re: Multiple Bib - Koma

Dear Yannick,

I am glad to hear that the files I sent you solved your problem. I tried to
send my e-mail, with the attached files, even to the
lyx-us...@lists.lyx.orgbut the mail systems continues to refuse my
message to the list. I don't
know why.
According to the Readme file the NM LyX port  "is free software; you can
redistribute it and/or modify it" so I imagine I am free to post to a
website my modified version. But maybe it is not so difficult to have it and
in any case  I will be happy to send it to other interested people who would
like to use the LyX version of André Miede's ClassicThesis, by Nick Mariette
together with the biblatex package.

pierfranco

2009/9/4 Yannick Wurm <yannick.w...@unil.ch>
Cool that's excellent!
Thank you so much! Can I buy you a beer? What's your paypal?

Now all I have to do is figure out how to format the references the way I
want them :)

have a wonderful evening,
yannick
ps: will you post this to the list or to a website?

On 4 Sep 2009, at 15:18, Pierfranco Minsenti wrote:

Dear Yannick,

Good News! It works: I mean: LyX+classicthesis port + biblatex.
I have tested it using 2 different computers and environments:
1) an iBook PowerPc with MAC OS X 10.3.9, TeXLive 2007 and LyX 1.5
2) an iMac Intet with MAC OS X 10.5.8, TeXLive 2008 and LyX 1.6.2
it works on both machines so it SHOULD work even in your case.

Let's sum up the preliminary steps to have it work:

Support/LyX-1.6/layouts

http://wiki.lyx.org/BibTeX/Tips#secbib and copy it into your /usr/local/bin

3) open LyX and Run Edit→Reconfigure, restart LyX and select the module
"Biblatex-citation-styles" from Document→Settings→Modules. as explained in
http://wiki.lyx.org/BibTeX/Biblatex

directory, that is in the folder
/Users/your_computer_name/Library/texmf/bibtex/bib

Now let's go and open the two files preamble.sty and nm_classicthesis.sty
from the Nick Mariette ClassicThesis LyX port:

1. Modifications to preamble.sty

2. Modifications to nm_classicthesis.sty

and modify them as I have explained in the file List of commands to modify
in the preamble_sty file.tex you will find in the folder enclosed

\usepackage{nameref}
%
%
\defbibfilter{notcited}{%
\not \segment{1}
\and \not \segment{2}
\and \not \segment{3}

2. in every chapter add these lines:

for example:

\myChapter{Title of first chapter}

\begin{refsegment}

...

\end{refsegment}

and then again:

\myChapter{Title of second chapter}

\begin{refsegment}

...

\end{refsegment}

etc.

Mind the line with the command
\printbibliography[heading=references,segment=2] : in the options the number
after segment is the same number of your segment, that is, in your case, the
number of the chapter

Save and run PDF (pdflatex) from your master file.

In the addedd folder you will find and example done with Chapter 02 from the
Nick Mariette LyX port of ClassicThesis.

I hope this will work.

Best wishes

Pierfranco

2009/9/3 Yannick Wurm <yannick.w...@unil.ch>

Hmmmm,
> so getting things working with ClassicThesis is harder than I thought.
>
> I've resolved most of the conflicts between the classicthesis.sty,
> preamble.sty and the preable that you gave in your example. (like you said,
> those were related to natbib, hyperref, backref). So I feel I'm 90% there!
> However, as soon as I add the code below to my ClassicThesis.lyx preamble,
> things fail.
>
> But I cannot make sense of the errors, nor locate where they are coming
> from (is there any way to get more verbose error messages from lyx?). What
> follows is the first error out of many:
> Error: "You can't use '\spacefactor' in vertical mode."
> Description: " \@
> ifundefined{showcaptionsetup}{}{%
> Sorry, but I'm not programmed to handle this case;
> I'll just pretend that you didn't ask for it.
> If you're in the wrong mode, you might be able to
> return to the right one by typing I}' or I\$' or I\par'.
> "
>
> Do you have any ideas where I should look?
>
> Thanks!!
> yannick
>
>
> --------------------
> %  responsible for converting the citekeys to pretty citations
> \makeatletter
> \AtEveryBibitem{%
> \iffieldequals{namehash}{\...@prevhash}
> {}
> {\addvspace{0.8\baselineskip}}% 0.8\baselineskip o altra misura
> \savefield{namehash}{\...@prevhash}}
> \AtBeginBibliography{%
> \let\...@prevhash\undefined}
> \makeatother
>
> On 3 Sep 2009, at 16:18, Yannick Wurm wrote:
>
>  Hello Pierfranco,
>> thank you very much for the rapid and exhaustive reply!
>>
>> After setting things up the way you outlined, I could only get your .tex
>> document to create the references correctly if I replaced the "refsegment"
>> with "refsection" as is it found in the "10-references-per-section.tex"
>> file.
>>
>> Bringing things into lyx worked as planned which is a very pleasant
>> surprise.
>> I haven't yet tried combining it all into my thesis chapters (which are
>> separate documents), but will look into that after a good cup of coffee.
>>
>> Thanks again and kind regards,
>>
>> Yannick
>>
>>
>> On 2 Sep 2009, at 18:39, Pierfranco Minsenti wrote:
>>
>>  Hi Yannick,
>>>
>>> I have very recently tested a solution to your problem using the biblatex
>>> package. Even if biblatex is still beta I can assure you that it is a very
>>> effective and easy solution, very flexible and adaptable to different needs.
>>> Read the instruction on the LyX wiki dedicated to the use of biblatex at
>>> http://wiki.lyx.org/BibTeX/Biblatex.
>>> It is indispensable in your case to install the biblatex package
>>> http://www.ctan.org/tex-archive/help/Catalogue/entries/biblatex.html.
>>> Also you will have to install the Perl script bibtexall into an executable
>>> path so that LyX will be able to compile all the files produced.
>>> Herewith enclosed I add  an exemple I have developed modifying an
>>> original file found in the exemples directory of the biblatex package
>>> http://www.ctan.org/tex-archive/help/Catalogue/entries/biblatex.html
>>> The code is pure LateX but it has also been tested with LyX and the
>>> KOMAscript report class, so it perflectly works. You just need to import
>>> this file in LyX and make adjustements following the specific instructions
>>> at http://wiki.lyx.org/BibTeX/Biblatex for using biblatex with LyX.
>>> I can also add that I haven't still used in conjunction with the LyX port
>>> of the ClassicThesis style which I am also using, but I plan to do it very
>>> soon and I think I will only have to modify the original files related to
>>> the LyX port of the ClassicThesis style by commenting out fthe packages and
>>> options related to:
>>> 1) natbib
>>>
>>> 2) backref package (you will use the specific functions provided by
>>> biblatex)
>>>
>>> besides it is absolutely important to put the biblatex package before the
>>> hyperref package.
>>>
>>> Herewith you can see the exemple I have obtained using pure LaTex code
>>> for producing lists of references printed at the end of each chapter.
>>> Obviously this example can only work in conjunction with the examples.bib
>>> file put in the exemples directory of the biblatex package.
>>>
>>> \documentclass[english,a4paper,twoside]{scrreprt}
>>> \usepackage[T1]{fontenc}
>>> \usepackage[latin9]{inputenc}
>>> \setcounter{secnumdepth}{3}
>>> \setcounter{tocdepth}{3}
>>> \usepackage{babel}
>>> %
>>> \usepackage[babel]{csquotes}
>>>
>>> \usepackage[style=authoryear,
>>>       natbib=true,
>>>       hyperref=auto,
>>>       backref=true,
>>>       date=long,
>>>       urldate=long,
>>>       block=space,
>>> ]{biblatex}
>>> %
>>> %HYPERREF
>>>
>>> hyperfootnotes=false,
>>> pdfstartview=FitV]
>>> {hyperref}
>>> %
>>> %HYPERSETUP
>>> %
>>> \bibliography{examples}
>>> %
>>> various References sections put in each chapter
>>> %
>>> %
>>> % added more vertical space among records because default space in
>>> authorcite style is =0
>>> %
>>> \makeatletter
>>>
>>> \AtEveryBibitem{%
>>> \iffieldequals{namehash}{\...@prevhash}
>>> {}
>>> {\addvspace{0.8\baselineskip}}% 0.8\baselineskip o altra misura
>>> \savefield{namehash}{\...@prevhash}}
>>>
>>> \AtBeginBibliography{%
>>> \let\...@prevhash\undefined}
>>>
>>> \makeatother
>>> %
>>> \title{My Dissertation}
>>> \author{Firstname Lastname}
>>> \date{}
>>> %
>>> %__________________________________________
>>> \begin{document}
>>>
>>> \maketitle
>>>
>>> \tableofcontents
>>>
>>>
>>> \chapter{Title of first chapter}
>>>
>>> \begin{refsegment}
>>>
>>> This is just filler text \parencite{massa}.
>>> This is just filler text \parencite{augustine}. This is just filler
>>> text \parencite{cotton}. This is just filler text \parencite{hammond}.
>>> %
>>> \end{refsegment}
>>>
>>> \chapter{Title of second chapter}
>>>
>>> \begin{refsegment}
>>>
>>> This is just filler text \parencite{hammond}. This is just filler
>>> text \parencite{massa}. This is just filler text \parencite{cotton}.
>>> This is just filler text \parencite{murray}.
>>> %
>>> \end{refsegment}
>>>
>>> \chapter{Title of third chapter}
>>>
>>> \begin{refsegment}
>>>
>>> This is just filler text \parencite{murray}. This is just filler
>>> text \parencite{augustine}. This is just filler text \parencite{cotton}.
>>> This is just filler text \parencite{bertram}.
>>> %
>>> \end{refsegment}
>>> %
>>> %__________________________________________________
>>> \end{document}
>>>
>>> Best wishes
>>>
>>> Pierfranco
>>>
>>>
>>> 2009/9/2 Yannick Wurm <yannick.w...@unil.ch>
>>> Hello,
>>>
>>> I'm trying to write my thesis with the excellent Lyx port of
>>> classicThesis (uses Koma). However, I prefer keeping my bibliographies
>>> separate (ie one bibliography per chapter).
>>>
>>> I don't have deep understanding of Latex, but found some 2002 posts to
>>> this list relative to using bibunits. I tried those as well as looking at
>>> chapterbib.
>>>
>>> The simplest I could attempt to do was to compile the following example:
>>> http://wiki.lyx.org/Examples/Bibunits
>>>
>>> Suprisingly, it doesn't work (I obtain only one single bibliography at
>>> the end). Here's the output:
>>> http://yannick.poulet.org/scratch/bibunits_KomaArticle.pdf
>>>
>>> I'm running this on Lyx 1.6.3 on Mac OS 10.5.8 and the pdflatex version I
>>> think I'm using is:
>>> pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
>>>
>>> Do you have any ideas?
>>>
>>> Thanks & regards,
>>>
>>>
>>>
>>
`