! 尺寸太大

! 尺寸太大

Dimension too large当我制作我的\Desktops{80}和我的时我一直收到错误\DTUnits{20},但是如果我更改我的,\DTUnits{14}它就会起作用,有人可以帮帮我吗?

\documentclass[a4paper,12pt]{article}

\usepackage{times,helvet,pgfplots,transparent}


%------------------------------------------------------------

\begin{document}

\letterHead

\begin{Contract}

\begin{SLAInfo}

%*******************ONLY CHANGE INFO BELOW!!!!******************


\date{27 May 2013}
\effectiveDate{1 June 2013}
\theirName{SAMWU}
\theirRep{MR. Conrad Groendevelt}
\theirPosn{Management}
\theirAddress{17 TERMO AVENUE, TEGNOPARK, STELLENBOSCH.}





\Desktops{80}
\Laptops{0}
\Macs{0}

\Servers{3}

\DTUnits{20}
\ServUnits{6}

\KM{30}


\ReportsNeededPerSite{0}





\Takeon{0}


\SLATotal{0}






%*******************ONLY CHANGE INFO ABOVE!!!!******************


\Printers{0}
\author{Mr. Alex Masters}
\ourRep{Alex Masters}
\title{\cntrctTheirName\ \textbf{- SLA}}
\docId{SLA - \cntrctTheirName}

\terms{7}
\deposit{}
\escalation{10\%}
\head

%------------------------------------------------------------
\begin{PaymentSchedule}\label{payment}

The following pricing table includes once-off setup and deployment, and support.

\begin{OnceoffMonthYearPrices}{}
\priceItem{}{}{}{}


\ifnum\ecTakeon=0 %
        \priceItem{Take on Audit of all Desktop/s, Laptop/s and Sever/s}{R \pgfmathparse{int((25*\ecDesktops)+(25*\ecMacs)+(25*\ecLaptops)+(250*\ecServers)+(1000*\ecReport))}\pgfmathresult -00}{}{}
\else %
    \priceItem{Take on Audit of all Desktop/s, Laptop/s and Sever/s}{R \ecTakeon-00}{}{}
\fi



    \priceItem{}{}{}{}


\ifnum\ecDesktops=0 %
    %
\else %
%R 90 per Desktop/Laptop
    \priceItem{\mhmon of \fillinField{\bf{\ecDesktops}} x Desktop/s.}{}{}{}
\fi

%R 90 per Macbook
\ifnum\ecMacs=0 %
    %
\else %
    \priceItem{\mhmon of \fillinField{\bf{\ecMacs}} x Apple Mac/s.}{}{}{}
\fi

\ifnum\ecLaptops=0 %
    %
\else %
%R 90 per Desktop/Laptop
    \priceItem{\mhmon of \fillinField{\bf{\ecLaptops}} x Laptop/s.}{}{}{}
\fi

%R 350 per Server
\ifnum\ecServers=0 %
    %
\else %
    \priceItem{\mhmon of \fillinField{\bf{\ecServers}} x Server/s with Raid 1.}{}{}{}
\fi

    \priceItem{}{}{}{}


%-------MHSUPPORT STUFF BELOW--------------

\ifnum\ecDesktops=0 %
    %
\else %
    \priceItem{\mhsupp for \fillinField{\bf{\ecDesktops}} x Desktop/s (\ecDTUnits\ Units).}{}{}{}
\fi

\ifnum\ecMacs=0 %
    %
\else %
    \priceItem{\mhsupp for \fillinField{\bf{\ecMacs}} x Apple Mac/s (Part of Desktop Units).}{}{}
\fi

\ifnum\ecLaptops=0 %
    %
\else %
    \priceItem{\mhsupp for \fillinField{\bf{\ecLaptops}} x Laptop/s (Part of Desktop Units).}{}{}{}
\fi

%R 450 per Unit
\ifnum\ecServers=0 %
    %
\else %
    \priceItem{\mhsupp for \fillinField{\bf{\ecServers}} x Server/s with Raid 1 (\ecServUnits\ Units).}{}{}{}
\fi

    \priceItem{}{}{}{} \hline \hline


\ifnum\ecSLATotal=0 %
    \priceItem{Total}{}{R \pgfmathparse{int((90*\ecDesktops)+(90*\ecMacs)+(90*\ecLaptops)+(350*\ecServers)+(350*\ecDTUnits)+(450*\ecServUnits)+(12*\ecKM))}\pgfmathresult -00}{}\hline \hline

\else %
    \priceItem{Total}{}{R \ecSLATotal-00}{}\hline \hline
\fi

\end{OnceoffMonthYearPrices}



\end{PaymentSchedule}

%------------------------------------------------------------

\end{SLAInfo}

\end{Contract}

\end{document}

答案1

发生这种情况的原因是您要计算的值大于 TeX 引擎可以处理的值。要处理大数字,请使用库fpu。使用 加载它\usetikzlibrary{fpu},然后使用 激活它\pgfkeys{/pgf/fpu=true, /pgf/fpu/output format=fixed}。数学表达式通常可以保持不变。

通常,使用\pgfmathprintnumber{\pgfmathresult}来打印计算结果是一个好主意,而不是\pgfmathresult直接使用。\pgfmathprintnumber如果需要,宏会处理舍入值,并可用于一致地格式化数字(例如,千位和小数分隔符)。

\documentclass{article}

\usepackage{pgfplots}

\begin{document}

\def\Desktops{80}
\def\Laptops{0}
\def\Macs{0}    
\def\Servers{3}   
\def\DTUnits{20}
\def\ServUnits{6}    
\def\KM{30}

\pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}
\pgfmathparse{(90*\Desktops)+ (90*\Macs)+ (90*\Laptops)+ (350*\Servers)+ (350*\DTUnits)+ (450*\ServUnits)+ (12*\KM)}

Total: \pgfmathprintnumber[1000 sep=\,]{\pgfmathresult}
\end{document}

相关内容