[Tutkielma-TeX] [darcs] jydiss.cls-muutos: Another attempt to make jydiss work with natbib. Fails at least if one uses natbib's "numbers" option, probably in other situations too.

Matthieu Weber mweber at mit.jyu.fi
Tue Mar 11 17:59:12 EET 2008


(English below)

Tämä on automaattinen ilmoitus jydiss-luokkaan tai sen dokumentaatioon tehdystä
muutoksesta.  Voit hakea uuden, muutetun version osoitteesta
  http://antti-juhani.kaijanaho.fi/darcs/jydiss/

Alla on tiedot tehdystä muutoksesta.

---

This is an automated notification of a change made to the jydiss document
class or its accompanying documentation.  You can get the new version at
  http://antti-juhani.kaijanaho.fi/darcs/jydiss/

Below, you will find information about the actual change.

Tue Mar 11 17:56:00 EET 2008  Matthieu Weber <mweber at mit.jyu.fi>
  * Another attempt to make jydiss work with natbib. Fails at least if one uses natbib's "numbers" option, probably in other situations too.
diff -rN -u old-jydiss/jydiss.cls new-jydiss/jydiss.cls
--- old-jydiss/jydiss.cls	2008-03-11 17:59:11.621938000 +0200
+++ new-jydiss/jydiss.cls	2008-03-11 17:59:11.621938000 +0200
@@ -102,6 +102,9 @@
 deprecated}{jydiss does not load the hyperref package automatically anymore.
 You must load it in the preamble of your document with
 \string\usepackage{hyperref} if you need it.}}
+  
+\newif\ifdiss at natbib
+\diss at natbibfalse
 
 \newif\ifdiss at alttt
 \diss at altttfalse
@@ -353,7 +356,34 @@
   \diss at hyperreffalse
   \define at TotPages@putlabel
   }%
-	\@mainmatterfalse
+
+  \@ifpackageloaded{natbib}{\diss at natbibtrue}{\diss at natbibfalse}
+  \let\@cite at rig=\@cite
+  \let\@citex at rig=\@citex
+  \ifdiss at natbib
+    \def\@cite##1##2##3{\ifdiss at artcite\textbf{##1}\endgroup\else\@cite at rig{##1}{##2}{##3}\fi\diss at artcitefalse}
+    \def\@citex[##1][##2]##3{\@ifundefined{diss at artcite@##3}{\diss at artcitefalse\@citex at rig[##1][##2]{##3}}{\diss at artcitetrue\@citex at rig[##1][##2]{##3}}}%
+    \def\@lbibitem[##1]##2{%
+      \if\relax\@extra at b@citeb\relax\else
+        \@ifundefined{br@##2\@extra at b@citeb}{}{%
+         \@namedef{br@##2}{\@nameuse{br@##2\@extra at b@citeb}}}\fi
+       \@ifundefined{b@##2\@extra at b@citeb}{\def\NAT at num{}}{\NAT at parse{##2}}%
+       \@ifundefined{diss at artcite@##2}{%
+         \item[\hfil\hyper at natanchorstart{##2\@extra at b@citeb}\@biblabel{\NAT at num}%
+           \hyper at natanchorend]%
+       }{%
+         \@ifundefined{NAT at name}{%
+           \item[?]%
+         }{%
+           \item[\hfil\hyper at natanchorstart{##2\@extra at b@citeb}\@biblabel{\NAT at name}%
+             \hyper at natanchorend]}%
+       }
+        \NAT at ifcmd##1(@)(@)\@nil{##2}}
+  \else
+    \def\@cite##1##2{\ifdiss at artcite\textbf{##1}\else\@cite at rig{##1}{##2}\fi\diss at artcitefalse}
+    \def\@citex[##1]##2{\@ifundefined{diss at artcite@##2}{\diss at artcitefalse\@citex at rig[##1]{##2}}{\diss at artcitetrue\@citex at rig[##1]{##2}}}%
+  \fi
+  \@mainmatterfalse
   \pagestyle{empty}
   \selectdefaultlanguage
   \maketitle
@@ -844,7 +874,7 @@
 
 %%%% List of articles
 \newenvironment{thelistofarticles}[1]
-  {\def\@biblabel##1{##1}%
+  {\def\@biblabel##1{\bfseries ##1\hfill}%
 \list{\@biblabel{\@Alph\c at enumiv}}%
  {\settowidth\labelwidth{\@biblabel{#1}}%
   \leftmargin\labelwidth
@@ -890,7 +920,8 @@
 \newcommand{\artpublish}[1]{\gdef\diss at art@publish{#1}}
 \newcommand{\artyear}[1]{\gdef\diss at art@year{#1}}
 \newcommand{\artcopyright}[1]{\gdef\diss at art@copyright{#1}}
-\newcommand{\artlabel}{\textbf{P\Roman{articles}}}
+%\newcommand{\artlabel}{\textbf{P\Roman{articles}}}
+\newcommand{\artlabel}{P\Roman{articles}}
 \newcommand{\artpages}[1]{\gdef\diss at art@pages{#1}}
 \newcommand{\arthide}{\diss at art@visiblefalse}
 \newcommand{\artmakebib}{%
@@ -900,11 +931,10 @@
 
 % Because of NatBib. We don't want NatBib to be used for the ``included
 % articles'' bibliography
-\def\diss@@lbibitem[#1]#2{\item[\@biblabel{#1}\hfill]\if at filesw
-      {\let\protect\noexpand
-       \immediate
-       \write\@auxout{\string\bibcite{#2}{{#1}{}{{}}{{}}}}}\fi\ignorespaces}
-\def\diss at bibitem{\@ifnextchar[\diss@@lbibitem\@bibitem}
+%\def\diss@@lbibitem[#1]#2{\item[\@biblabel{#1}\hfill]\if at filesw
+%      {\let\protect\noexpand
+%       \write\@auxout{\string\bibcite{#2}{{}{}{{#1}}{{}}}}}\fi\ignorespaces}
+%\def\diss at bibitem{\@ifnextchar[\diss@@lbibitem\@bibitem}
 
 \newcommand{\artmaketitle}{%
 \cleardoublepage
@@ -958,7 +988,13 @@
 %}
 \begingroup
 \let\protect\@unexpandable at protect
-\immediate\write\@auxout{\string\@writefile{loar}{\string\diss at bibitem[\artlabel]{\diss at art@label} \artmakebib}}
+%\immediate\write\@auxout{\string\@writefile{loar}{\string\diss at bibitem[\artlabel]{\diss at art@label} \artmakebib}}
+%\immediate\write\@auxout{\string\@writefile{loar}{\string\bibitem[\artlabel]{\diss at art@label} \artmakebib}}
+\ifdiss at natbib
+\immediate\write\@auxout{\string\@writefile{loar}{\string\bibitem[\artlabel()]{\diss at art@label} \artmakebib}}
+\else
+\immediate\write\@auxout{\string\@writefile{loar}{\string\bibitem[\artlabel]{\diss at art@label} \artmakebib}}
+\fi
 \endgroup
 %\addtocounter{page}{\diss at art@pages}
 %\addtocounter{TotPages}{\diss at art@pages}
@@ -1009,14 +1045,14 @@
 \def\jydiss at contrib@body{You need to run \LaTeX{} a second time.}
 \newcommand\jydiss at set@contrib at body[1]{\long\gdef\jydiss at contrib@body{#1}}
 
-% Changing the citation label in the body of the document depending on wether
+% Changing the citation label in the body of the document depending on whether
 % the citation is an included article or not
 \newif\ifdiss at artcite\diss at artcitefalse
-\let\@cite at rig=\@cite
-\def\@cite#1#2{\ifdiss at artcite\textbf{#1}\else\@cite at rig{#1}{#2}\fi\diss at artcitefalse}
-
-\let\@citex at rig=\@citex
-\def\@citex[#1]#2{\@ifundefined{diss at artcite@#2}{\diss at artcitefalse\@citex at rig[#1]{#2}}{\diss at artcitetrue\@citex at rig[#1]{#2}}}
+%\let\@cite at rig=\@cite
+%\def\@cite#1#2{\ifdiss at artcite\textbf{#1}\else\@cite at rig{#1}{#2}\fi\diss at artcitefalse}
+%
+%\let\@citex at rig=\@citex
+%\def\@citex[#1]#2{\@ifundefined{diss at artcite@#2}{\diss at artcitefalse\@citex at rig[#1]{#2}}{\diss at artcitetrue\@citex at rig[#1]{#2}}}
 
 %%%% Floats and numbering
 






More information about the Tutkielma-TeX mailing list