When trying to use
\FPeval
within the {thebibliography}
environment, I noticed that the variable used to hold the result of the \FPeval
computation gets reset outside the {thebibliography}
environment to its initial value. This is demonstrated by the following example code.Code: Select all
\documentclass[9pt,a4paper,twoside]{article}
% Do not make all pages exactly the same size.
\raggedbottom
% Use xifthen conditional branch package
\usepackage{xifthen}
% Unicode stuffs
\usepackage[mathletters]{ucs}
\usepackage[frenchb,english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{a4wide}
\usepackage{color}
\usepackage{amsfonts,amsmath,amsthm}
\usepackage{amssymb,amscd,amstext}
\usepackage{latexsym}
\usepackage{exscale}
\usepackage{euscript}
% Use other fonts than default
\usepackage[slantedGreek]{mathpazo}
%\usepackage{times}
% Table formatting as done in books
%\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{colortbl}
% Make arithmetic with variables
\usepackage{calc}
% Evaluate arithmetic expression
\usepackage[debug]{fp}
% Allow margin note in floats
\usepackage{marginnote}
% Allow better treatment of marginal notes
\usepackage{mparhack}
% Fancy headers & footers
\usepackage{fancyhdr}
\pagestyle{plain}
% Bibliography management : modified style for headers to be not in uppercase
\usepackage[comma,numbers,sort&compress]{natbib}
% Multiple bibliographies
\usepackage{multibib}
\newcites{phd,peerfirst,peernotfirst,peernotisi,report,poster,talk}{X,X,X,X,X,X,X}
% Allow optional text
\usepackage[weight]{optional}
\opt{weight}{
\edef\peerfirst{0}
}
\opt{weight}{
\edef\peernotfirst{0}
}
\opt{weight}{
\edef\pubtotal{0}
}
\newcommand{\cpeerfirst}[1]{\opt{weight}{\marginpar[\itshape\small\raggedleft#1]{\itshape\small\raggedright#1}\FPeval\peerfirst{clip(peerfirst+(35))}}}
\title{\textsc{Curriculum Vitae}}
\author{}
\date{}
\begin{document}
\pagenumbering{arabic}
\maketitle \thispagestyle{empty}
\begingroup
\renewcommand{\section}[2]{}%
\nocitepeerfirst{*}
\setbiblabelwidth{99}
\begin{thebibliography}{5}
\providecommand{\natexlab}[1]{#1}
\providecommand{\url}[1]{\texttt{#1}}
\expandafter\ifx\csname urlstyle\endcsname\relax
\providecommand{\doi}[1]{doi: #1}\else
\providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi
\bibitem[A et~al.(2004)A]{A_2004}
\textbf{A.}\cpeerfirst{35} \textbf{A}.
\newblock {????}.
\newblock \emph{???}, ??:\penalty0 17--37, 2004.
\bibitem[A et~al.(2003)A]{A_2003}
\textbf{A.}\cpeerfirst{35} \textbf{A}.
\newblock {????????}.
\newblock \emph{???}, ?????:\penalty0 4612--4612, 2003.
\opt{weight}{\marginpar[\itshape\small\raggedleft Total : \FPprint\peerfirst]{\itshape\small\raggedright Total : \FPprint\peerfirst}}
\end{thebibliography}
\endgroup
\opt{weight}{\marginpar[\itshape\small\raggedleft Total : \FPprint\peerfirst]{\itshape\small\raggedright Total : \FPprint\peerfirst}}
\FPeval\pubtotal{clip(pubtotal+peerfirst)}
\end{document}
Am I doing something wrong ?
Many thanks,
Alessandro.