PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : multibib - Anzahl möglicher Bibliotheken erhöhen?



Ceres
16-09-2010, 17:39
Ich habe ein wirklich großes Problem.
Ich habe ca. 25 Einzelprojekte, die nun zu einem großen Projekt zusammengefügt werden sollen.
Jedes einzelne Projekt besitzt 2-3 Bibliotheken. jedes Projekt läßt sich wunderbar einzeln mit multibib verwalten.
Jetzt müssen aber alle Projekte zusammen kompiliert werden und da habe ich nun mal ca. 70 Bibliotheken. In diesem Fall verweigert allerdings multibib seinen Dienst nach ich glaube 12 Bibliotheken mit dem Fehler:


No room for a new \write \newcites{.....}

Hat jemand eine Ahnung, wie ich multibib mehr Bibliotheken beibringen kann?

Xenara
16-09-2010, 17:42
Vielleicht naiver Vorschlag, aber:
Das Dokument splitten, die funktionierenden Einzelteile kompilieren und mit pdfpages in einem Hauptdokument zusammenfügen geht nicht?

Ceres
16-09-2010, 17:55
Vielleicht naiver Vorschlag, aber:
Das Dokument splitten, die funktionierenden Einzelteile kompilieren und mit pdfpages in einem Hauptdokument zusammenfügen geht nicht?

Nein, das geht leider nicht, da dann Seitenzahlen und Inhaltsverzeichnis nicht korrekt erstellt werden.

rais
17-09-2010, 00:29
Moin moin,

Ich habe ein wirklich großes Problem.
Ich habe ca. 25 Einzelprojekte, die nun zu einem großen Projekt zusammengefügt werden sollen.
Jedes einzelne Projekt besitzt 2-3 Bibliotheken. jedes Projekt läßt sich wunderbar einzeln mit multibib verwalten.
Jetzt müssen aber alle Projekte zusammen kompiliert werden und da habe ich nun mal ca. 70 Bibliotheken. In diesem Fall verweigert allerdings multibib seinen Dienst nach ich glaube 12 Bibliotheken mit dem Fehler:


No room for a new \write \newcites{.....}

ja, die Anzahl der Schreibregister ist begrenzt (max. 16). Ein Lösungsansatz ist zumindest denkbar, so Deine einzelnen Projekte nicht zu sehr mit einander verzahnt werden, zum Vergleich


\documentclass{article}
\newwrite\mywritehandle
\newcommand*\mywrite[2]{%
\immediate\openout\mywritehandle=\jobname.0#1
\immediate\write\mywritehandle{#2}
\immediate\closeout\mywritehandle
}
\begin{document}
\makeatletter
\@for\fooa:={a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s ,t,u,v,w,x,y,z}\do{%
\@for\foob:={a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s ,t,u,v,w,x,y,z}\do{%
\mywrite{\fooa\foob}{Test \fooa/\foob}%
}%
}%
\makeatother
\end{document}

damit sollten so rund 676 (zusätzliche) Dateien erzeugt werden, wobei (La)TeX-seitig nur ein Schreibregister benutzt wird.
Nun bräuchtest Du ``bloß'' noch dafür zu sorgen, daß Du Dir, hmm, drei oder vier solcher Schreibregister reservierst, den \newcites entsprechend umschreibst, daß kein neues Schreibregister verwendet wird (ggf. auch noch den einen oder anderen zusätzlichen Befehl aus multibib) ... tönt nicht gerade trivial.

MfG

rais
23-09-2010, 13:32
Moin moin,


Jetzt müssen aber alle Projekte zusammen kompiliert werden und da habe ich nun mal ca. 70 Bibliotheken. In diesem Fall verweigert allerdings multibib seinen Dienst nach ich glaube 12 Bibliotheken mit dem Fehler:


No room for a new \write \newcites{.....}

ich hab da mal ein paar Bits hin- und hergeschoben :D


\documentclass{article}
\usepackage{multibib}
\usepackage{filecontents}
\begin{filecontents}{foo.bib}
@article{foo,
author = {Silie, Peter},
title = {Vom Minimalbeispiel zum fertigen Projekt},
journal = {Der kleine {\TeX}niker},
volume = {41},
number = {795},
pages = {25-37},
year = {2010}
}
\end{filecontents}

\makeatletter
%pool:
\newwrite\wrhandle@a
\newwrite\wrhandle@b
\newwrite\wrhandle@c
\newwrite\wrhandle@d
\newwrite\wrhandleaux
\newcommand*\mylistidx{a,b,c,d,e,f,g,h,i,j}
\@for\myidxa:=\mylistidx\do{%
\@for\myidxb:=\mylistidx\do{%
\immediate\openout\wrhandle@a=bib-\myidxa\myidxb.bib
\typeout{Creating bib file `bib-\myidxa\myidxb.bib'}%
\immediate\write\wrhandle@a{@article{foo\myidxa\my idxb,
author={Silie, Peter},
title={Vom Minimalbeispiel zum fertigen Projekt},
journal={Der kleine {\string\TeX}niker},
volume={41},
number={795},
pages={25-37},
year={2010}
}
}%
\immediate\closeout\wrhandle@a
}%
}
\newcommand*\whatisopen@a{\empty}
\newcommand*\whatisopen@b{\empty}
\newcommand*\whatisopen@c{\empty}
\newcommand*\whatisopen@d{\empty}
\newcounter{whatisdone@a}
\newcounter{whatisdone@b}
\newcounter{whatisdone@c}
\newcounter{whatisdone@d}
\newcounter{mydone}
\newcommand*\myempty{\empty}
\newcommand*\mystuff{}
\newcommand*\addflag[1]{%
\ifcase\value{#1}\relax
\addtocounter{#1}{\value{mydone}}%
\or% 1: (ein) cite vorhanden:
\ifnum\value{#1}<\value{mydone}\relax
\addtocounter{#1}{\value{mydone}}%
\fi
\or% 2: bib vorhanden:
\ifnum\value{mydone}=2\relax\else
\addtocounter{#1}{\value{mydone}}%
\fi
\or% 3: bib+cite vorhanden:
\ifnum\value{mydone}=4\relax
\addtocounter{#1}{\value{mydone}}%
\fi
\or% 4: style vorhanden:
\ifnum\value{mydone}<4\relax
\addtocounter{#1}{\value{mydone}}%
\fi
\or% 5: cite+style vorhanden:
\ifnum\value{mydone}=2\relax
\addtocounter{#1}{\value{mydone}}%
\fi
\or% 6: bib+style vorhanden:
\typeout{Warning: style and bibliography present, but no cite yet}%
\typeout{I will not be able to detect an end for `\wr@virtual',}%
\typeout{some cites for `\wr@virtual' may get lost!}
\ifnum\value{mydone}=1\relax
\addtocounter{#1}{\value{mydone}}%
\fi
\or% 7: (ein) cite+bib+style vorhanden:
\else% >7???
\typeout{Warning: Something went seriously wrong for `\wr@virtual' (\value{#1})}%
\fi
}
\newcounter{nextt@reopen}
\newcommand*\mywrite@i[2]{%
\immediate\write#1{#2}%
\typeout{Adding \mystuff\space to #1}%
}
\newcommand*\mywrite[2]{%
\edef\wr@virtual{#1}%
\ifx\wr@virtual\whatisopen@a
\mywrite@i{\wrhandle@a}{#2}%
\addflag{whatisdone@a}%
\ifnum\value{whatisdone@a}=7\relax% alles drin?
\immediate\closeout\wrhandle@a
\typeout{Closing `\whatisopen@a'}%
\setcounter{whatisdone@a}{0}%
\def\whatisopen@a{\empty}%
\fi
\else% Datei nicht a...
\ifx\wr@virtual\whatisopen@b
\mywrite@i{\wrhandle@b}{#2}%
\addflag{whatisdone@b}%
\ifnum\value{whatisdone@b}=7\relax% alles drin?
\immediate\closeout\wrhandle@b
\typeout{Closing `\whatisopen@b'}%
\setcounter{whatisdone@b}{0}%
\def\whatisopen@b{\empty}%
\fi
\else% Datei weder a noch b...
\ifx\wr@virtual\whatisopen@c
\mywrite@i{\wrhandle@c}{#2}%
\addflag{whatisdone@c}%
\ifnum\value{whatisdone@c}=7\relax% alles drin?
\immediate\closeout\wrhandle@c
\typeout{Closing `\whatisopen@c'}%
\setcounter{whatisdone@c}{0}%
\def\whatisopen@c{\empty}%
\fi
\else% a nich, b nich, c nich ...
\ifx\wr@virtual\whatisopen@d
\mywrite@i{\wrhandle@d}{#2}%
\addflag{whatisdone@d}%
\ifnum\value{whatisdone@d}=7\relax% alles drin?
\immediate\closeout\wrhandle@d
\typeout{Closing `\whatisopen@d'}%
\setcounter{whatisdone@d}{0}%
\def\whatisopen@d{\empty}%
\fi
\else% a nich, b nich, c nich, d nich ...
\ifx\whatisopen@a\myempty
\edef\whatisopen@a{#1}%
\immediate\openout\wrhandle@a=#1
\typeout{Setting \string\wrhandle@a=#1}%
\mywrite@i{\wrhandle@a}{#2}%
\addflag{whatisdone@a}%
\else% a offen, aber andere Datei, wat nu?
\ifx\whatisopen@b\myempty
\edef\whatisopen@b{#1}%
\immediate\openout\wrhandle@b=#1
\typeout{Setting \string\wrhandle@b=#1}%
\mywrite@i{\wrhandle@b}{#2}%
\addflag{whatisdone@b}%
\else
\ifx\whatisopen@c\myempty
\edef\whatisopen@c{#1}%
\immediate\openout\wrhandle@c=#1
\typeout{Setting \string\wrhandle@c=#1}%
\mywrite@i{\wrhandle@c}{#2}%
\addflag{whatisdone@c}%
\else
\ifx\whatisopen@d\myempty
\edef\whatisopen@d{#1}%
\immediate\openout\wrhandle@d=#1
\typeout{Setting \string\wrhandle@d=#1}%
\mywrite@i{\wrhandle@d}{#2}%
\addflag{whatisdone@d}%
\else
\typeout{Warning: No more handles available!}%
\typeout{You may want to increase the number of handles.}%
\typeout{Trying to recover...}%
\ifcase\value{nextt@reopen}
\immediate\closeout\wrhandle@a
\typeout{Forcibly (\thewhatisdone@a) closing \string\wrhandle@a. Sth may get lost!}%
\immediate\openout\wrhandle@a=#1
\typeout{Reopening \string\wrhandle@a=#1}%
\edef\whatisopen@a{#1}%
\mywrite@i{\wrhandle@a}{#2}%
\or
\immediate\closeout\wrhandle@b
\typeout{Forcibly closing \string\wrhandle@b. Sth may get lost!}%
\immediate\openout\wrhandle@b=#1
\typeout{Reopening \string\wrhandle@b=#1}%
\edef\whatisopen@a{#1}%
\mywrite@i{\wrhandle@b}{#2}%
\or
\immediate\closeout\wrhandle@c
\typeout{Forcibly closing \string\wrhandle@c. Sth may get lost!}%
\immediate\openout\wrhandle@c=#1
\typeout{Reopening \string\wrhandle@c=#1}%
\edef\whatisopen@c{#1}%
\mywrite@i{\wrhandle@c}{#2}%
\or
\immediate\closeout\wrhandle@d
\typeout{Forcibly closing \string\wrhandle@d. Sth may get lost!}%
\immediate\openout\wrhandle@d=#1
\typeout{Reopening \string\wrhandle@d=#1}%
\edef\whatisopen@d{#1}%
\mywrite@i{\wrhandle@d}{#2}%
\fi
\stepcounter{nextt@reopen}%
\ifnum\value{nextt@reopen}>3% 0--3
\setcounter{nextt@reopen}{0}%
\fi% next > 3?
\fi% d war frei?
\fi% c war frei?
\fi% b war frei?
\fi% a war frei?
\fi% Datei offen in d?
\fi% Datei offen in c?
\fi% Datei offen in b?
\fi% Datei offen in a?
}
\newcommand*\mycitation[2]{%
\edef\mystuff{citation `#2'}%
\setcounter{mydone}{1}%
\mywrite{#1.aux}{\string\citation{#2}}%
}
\newcommand*\mybibdata[2]{%
\edef\mystuff{bibdata `#2'}%
\setcounter{mydone}{2}%
\mywrite{#1.aux}{\string\bibdata{#2}}%
}
\newcommand*\mybibstyle[2]{%
\edef\mystuff{bibstyle `#2'}%
\setcounter{mydone}{4}%
\mywrite{#1.aux}{\string\bibstyle{#2}}%
}
\InputIfFileExists{\jobname.xua}{\typeout{Loading `\jobname.xua'}}{\typeout{`\jobname.xua' doesn't exist just yet...}}
\immediate\openout\wrhandleaux=\jobname.xua
\newcommand*\testlibs@i[1]{%
\@for\mycite:=#1\do{%
bla\csname citelit\mycite\endcsname{foo\mycite}\par
}%
\@for\mycite:=#1\do{%
\csname bibliographystylelit\mycite\endcsname{plain}
\csname bibliographylit\mycite\endcsname{bib-\mycite}
}%
}
\newcounter{myidx}
\newcounter{mymaxidx}
\setcounter{mymaxidx}{2}
\newcommand*\testlibs{%
\edef\myidx{\empty}%
\@for\myidxa:=\mylistidx\do{%
\@for\myidxb:=\mylistidx\do{%
\stepcounter{myidx}%
\ifx\myidx\myempty
\edef\myidx{\myidxa\myidxb}%
\else
\edef\myidx{\myidx,\myidxa\myidxb}%
\fi
\ifnum\value{myidx}>\value{mymaxidx}%
\testlibs@i{\myidx}%
\edef\myidx{\empty}%
\setcounter{myidx}{0}%
\ifnum\value{mymaxidx}>1
\setcounter{mymaxidx}{1}%
\else
\setcounter{mymaxidx}{2}%
\fi
\fi
}%
}%
}
\newcommand*\current@suffix{}
\def\newcites#1#2{%
\def\@suffixlist{#1,}%
\@for\@newrefname:=#2\do{%
\mylop\@suffixlist\to\@suffix
\expandafter\protected@edef\csname refname\@suffix\endcsname
{\@newrefname}%
\if@filesw
%%% \expandafter\newwrite\csname @auxout\@suffix\endcsname
%%% Umleitung auf *eine* Datei:
\expandafter\let\csname @auxout\@suffix\endcsname=\wrhandleaux
%%%
\expandafter\edef\csname @auxout\@suffix name\endcsname{\@suffix}%
\begingroup
\makeatletter
\@input@{\csname @auxout\@suffix name\endcsname .aux}%
\endgroup
%%% die multibib-eigene .aux noch nicht beschreiben lassen:
%%% \immediate\openout\csname @auxout\@suffix\endcsname
%%% \csname @auxout\@suffix name\endcsname .aux
\fi
\@for\@citename:=\@mb@citenamelist\do{%
\expandafter\edef\csname \@citename\@suffix\endcsname{%
%%% \current@suffix<-\@suffix:
\expandafter\edef\noexpand\current@suffix{\@suffix }%
\let\noexpand\@citex\noexpand\mb@@citex
\let\noexpand\@newciteauxhandle\csname @auxout\@suffix\endcsname
\noexpand\csname\@citename\endcsname
}%%%<--
}%
\expandafter\edef\csname nocite\@suffix\endcsname##1{{%
\let\noexpand\@auxout\csname @auxout\@suffix\endcsname
\noexpand\nocite{##1}}}%
\iflabeled % if option labeled
\expandafter\edef\csname @bibitem\@suffix\endcsname##1{%
\noexpand\item
\noexpand\if@filesw \noexpand\immediate\noexpand\write\noexpand\@auxou t
{\noexpand\string\noexpand\mybibcite{\@suffix}{##1 }%%%<--
{\@suffix\noexpand\the\noexpand\value{\noexpand\@l istctr}}}%
\noexpand\fi
\noexpand\ignorespaces}%
\expandafter\edef\csname @biblabel\@suffix\endcsname##1{[\@suffix##1]}%
\fi % end if option labeled
\expandafter\edef\csname bibliography\@suffix\endcsname##1{{%
\let\noexpand\temp@auxout\noexpand\@auxout
\let\noexpand\addtocontents\noexpand\mb@addtoconte nts
\let\noexpand\@auxout\csname @auxout\@suffix\endcsname
\let\noexpand\jobname
\expandafter\noexpand\csname @auxout\@suffix name\endcsname
\let\noexpand\refname
\expandafter\noexpand\csname refname\@suffix\endcsname
\let\noexpand\bibname
\expandafter\noexpand\csname refname\@suffix\endcsname
\iflabeled
\let\noexpand\@bibitem
\expandafter\noexpand\csname @bibitem\@suffix\endcsname
\let\noexpand\@biblabel
\expandafter\noexpand\csname @biblabel\@suffix\endcsname
\fi
\noexpand\mybibliography{\@suffix}{##1}%
}}
\expandafter\edef\csname bibliographystyle\@suffix\endcsname##1{%
\noexpand\if@filesw
\noexpand\immediate\noexpand\write\csname @auxout\@suffix\endcsname
{\noexpand\string\noexpand\mybibstyle{\@suffix}{## 1}}%
\noexpand\fi}
}%
}
%%% Bibliography:
\def\mybibliography#1#2{%
\ifcontinuouslabels
\let\usecounter\newusecounter
\fi
%%% statt \std@bibliography:
\if@filesw
\immediate\write\@auxout{\string\mybibdata{#1}{#2} }%
\fi
\@input@{\jobname.bbl}%
%%%
\ifcontinuouslabels
\global\let\newusecounter\@newusecounter
\fi}
%%% \@citex:
\AtBeginDocument{%
\@ifpackageloaded{natbib}{%
%%% TODO
% \def\std@@citex[#1][#2]#3{}%
}{%
\def\std@@citex[#1]#2{%
\leavevmode
\let\@citea\@empty
\@cite{\@for\@citeb:=#2\do
{\@citea\def\@citea{,\penalty\@m\ }%
\edef\@citeb{\expandafter\@firstofone\@citeb\@empt y}%
\if@filesw\immediate\write\@auxout{\string\mycitat ion{\current@suffix}{\@citeb}}\fi
\@ifundefined{b@\@citeb}{\hbox{\reset@font\bfserie s ?}%
\G@refundefinedtrue
\@latex@warning
{Citation `\@citeb' on page \thepage \space undefined}}%
{\@cite@ofmt{\csname b@\@citeb\endcsname}}}}{#1}%
}%
}%
}
\@for\myidxa:=\mylistidx\do{%
\@for\myidxb:=\mylistidx\do{%
\newcites{lit\myidxa\myidxb}{Literatur \myidxa\myidxb}
}%
}
\makeatother

\begin{document}
\section{Test}
blubb \cite{foo}
\testlibs
\renewcommand{\refname}{sonstige Literatur}
\bibliographystyle{plain}
\bibliography{foo}
\end{document}

(die blau hervorgehobenen Teile sind nur zur Demo eingebaut)
Die \cite*, \bibliography* und \bibliographystyle*-Befehle (also die durch \newcites zur Verfügung gestellten) werden hier so umgebaut, dass sie keine eigene .aux mehr anlegen, sondern über \jobname.xua (xua: aux rückwärts;-) umgeleitet werden, diese wird erst ab dem zweiten LaTeX-Lauf eingelesen und daraus werden dann die einzelnen .aux-Dateien generiert.
Es muss also mindestens zweimal (pdf)LaTeX gelaufen sein, bevor die ganzen .aux-Dateien vorhanden sind, auf die Du dann BibTeX loslassen kannst (und danach muss (pdf)LaTeX ebenfalls mindestens zweimal laufen, damit die Referenzen auch stimmen).

MfG