Generalfp | Strange Interaction with Bibliography

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
aipe
Posts: 1
Joined: Wed Nov 14, 2012 8:28 pm

fp | Strange Interaction with Bibliography

Post by aipe »

Hi,

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}
I would expect the value of the second Total to be 70 as for the first and not 0.

Am I doing something wrong ?

Many thanks,


Alessandro.
Last edited by localghost on Wed Nov 14, 2012 9:00 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: fp | Strange Interaction with Bibliography

Post by josephwright »

Assignments are local to groups unless you deliberately make them global.
Joseph Wright
Post Reply