Questions tagged [fp]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
79 views

Problem with continued use of FPeval

I want to create a template to standardise the question papers in my institution. I had previously asked this question but did not receive any answer. Recently, I tried the way as shown in the MWE ...
Subhajit Paul's user avatar
0 votes
1 answer
62 views

Branch to something when an expression cannot be evaluated by fpeval

I would like to design a \comparator expandable command that relies on fpeval that has 3 branches: true branch when the comparison is equal to 1 false branch when the comparison is equal to zero ...
Vincent's user avatar
  • 5,257
2 votes
1 answer
45 views

How to Retrieve and Use Glossary Entry Value in `fp` Package for Calculations?

I intend to utilize the numerical value 590.98 stored in the glossary entry PClabel for subsequent calculations. My approach was to retrieve the value using \glsuseri{PClabel} and incorporate it into ...
Marco Moldenhauer's user avatar
3 votes
2 answers
135 views

\FPeval ceil results in "multiple values"

\FPeval returns a multiple values error when using ceil or floor, but not trunc or round. \documentclass{article} \usepackage{graphicx} % Required for inserting images \usepackage{fp} \begin{document}...
nvrain's user avatar
  • 33
0 votes
2 answers
121 views

Package FP: Error for power of a negative number

I am using the FP-package for multiple choice exams with AMC (automatic multiple choice). For randomization I make use of long formulas which sometimes lead to error messages. The reason for these ...
JeBa's user avatar
  • 15
0 votes
1 answer
52 views

"FPeval" along with "clip" when multiplied with 10 gives wrong answer while it does not happen with other numbers

\newcounter{tenMarksQ} \setcounter{tenMarksQ}{0} \DTLforeach{Q}{\Marks=Marks} { \ifnum\Marks=10 \addtocounter{tenMarksQ}{1} \fi } \FPeval{\10}{clip(10*\thetenMarksQ)} \section{ELABORATE ON:...
Srini Vasan's user avatar
0 votes
0 answers
92 views

FP calculation bug within tabularray

Strange results had been reported here when using the fp package inside a table using tabu package. A solution had been proposed to manage the fact that computations are done twice by performing a ...
Tobard's user avatar
  • 1,189
1 vote
0 answers
57 views

Error messages not thrown with fp_eval

I'm writing some error-checking on values passed to a function, to raise an error if values are not OK, before passing them to \fp_eval. From what I've noticed, the call to \fp_eval messes with the ...
3isenHeim's user avatar
  • 2,107
0 votes
1 answer
79 views

Calculating marking points exam class

I want to calculate marking points for an exam by multiplying a percentage with the total number of points (e.g., 0.5 * \numpoints{}) to make a grading table. Problem is that before I run the ...
bjpean's user avatar
  • 1
4 votes
3 answers
313 views

xfp - Huge integers - Why is \inteval less accurate then \fpeval?

I was trying to print the first few terms of hyperfactorials, which are defined by H(0)=1 and H(n)=H(n-1)*n^n. When fpeval is used for calculation and inteval is used for printing: \documentclass{...
inge3515's user avatar
0 votes
0 answers
119 views

Using the result of a macro/command in FPEval / Undefined Control Sequence

How can the following LaTeX code be fixed to use the result of "\RoundGrade{\codeA}" correctly in a later \FPEval computation? \documentclass{standalone} \usepackage{fp} \newcommand{\...
DCTLib's user avatar
  • 1,914
0 votes
0 answers
73 views

Make \exp_not:V and \exp_args:NV work for fp variables too?

In interface3 the description of \exp_not:V command is the following: \exp_not:V ⟨variable⟩ Recovers the content of the ⟨variable⟩, then prevents expansion of this material in x-type or e-type ...
L.J.R.'s user avatar
  • 11k
0 votes
3 answers
67 views

arithmetic in tex when the data type is not an integer

Use case. I am drafting a contract where I would specify in the beginning an hourly rate using \newcommand{\monthlyrate}{\$10000} And in the following command, I would like to specify a penalty that ...
jxhyc's user avatar
  • 1,131
6 votes
1 answer
363 views

What is the ">?" LaTeX3 floating point operator

The l3fp package documentation refers to the >? operator (page 237 of interface3.pdf) but I could not find any example or explanation there despite it is recognized as shown in next example. \...
Jérôme LAURENS's user avatar
1 vote
1 answer
108 views

Why doesn't this work? It should be a pendulum with harmonic movement

\documentclass[border=0pt,pstricks]{standalone} \usepackage{pst-coil,pstricks-add} \usepackage[nomessages]{fp} \FPset\CoilArm{0.25} \FPset\CoilWidth{0.3} \FPeval\CoilTurn{round(50/3:3)} \FPeval\...
jaime lopez's user avatar
1 vote
1 answer
128 views

tkzDrawTangentLine ! FP error: UPN stack is empty!. \FP@errmessage #1->\errmessage {FP error: #1!}

The following code typesets with error ! FP error: UPN stack is empty!. \FP@errmessage #1->\errmessage {FP error: #1!} Anyone know how I can fix this? MWE \documentclass[tikz]{standalone} \...
jowe_19's user avatar
  • 939
0 votes
0 answers
33 views

Why doesn't the fp package work inside tabulars and how do I get around that? [duplicate]

I want to add sums while writing tabular (tabularx) lines. For this I have written a command to emit individual lines, but all the \FPxxx commands fail to work from within the tabular environment. I ...
bitmask's user avatar
  • 1,205
4 votes
1 answer
178 views

On the incompatibility of the tikz and fp packages: division (/) operator in \FPeval and node in tikz

Let us assume that we want to divide two numbers u=-60 and v=3 using the fp package without calling tikz picture. It works fine as below: \documentclass{article} \usepackage{fp} \begin{document} \edef\...
Aria's user avatar
  • 1,523
2 votes
1 answer
640 views

On the fp package: inverse sine function

On page 3/7 of the fp package we see the definition of the inverse sine function as below: \FParcsin#1#2 % #1 := arcsin(#2) From high school we may remember: Arcsin(0.5)=pi/6= 0.524 around. I got 0 ...
Aria's user avatar
  • 1,523
1 vote
1 answer
56 views

On the fp package: repeat last test

On page 3/7 fp package documentation we read: %repeat last test \ifFPtest ...\else...\fi % repeat last test I really could not understand this. That is why I wrote a code as below to see what \...
Aria's user avatar
  • 1,523
0 votes
1 answer
264 views

Using the fp package inside an invoice template [closed]

I am using this template : https://www.latextemplates.com/template/invoice And I want to kind of do something similar to this : \newcommand*{\total}[1]{\FPdiv{\t}{\arabic{#1}}{1000}\formatNumber{\t}} ...
Cliff Stamp's user avatar
1 vote
1 answer
140 views

Nested macros using FPeval

I am trying to create an easy to use template, with a part that would look like this: The original code I used to do this is the following: \begin{tabularx}{\linewidth}{|X|X|X|X|X|} \hline \rowcolor{...
Victor's user avatar
  • 35
5 votes
1 answer
166 views

Can \fp_eval handle uppercase e ("E") exponent symbol format

While handling data from a text file, I stumbled upon this problem. My numeric data is formatted using a %n.dE C format specifier. which outputs numbers with a uppercase e (E) as scientific notation ...
BambOo's user avatar
  • 8,811
0 votes
1 answer
107 views

fp and macro question

I try to feed macros doing FP calculations into other macros doing the same, and face problems with macro expansion. The usual "protect" trick didn't work for me. Any hints? An example is below. \...
taku's user avatar
  • 3
1 vote
2 answers
301 views

pgfplotstable: correct way to generate new columns using custom commands in a table that can be plotted with tikz

Sorry if the title is too big, but I didn't know how to express it as something specific, I try to generate new columns in a table using custom commands, for instance: \documentclass{scrbook} \...
4lrdyD's user avatar
  • 181
0 votes
1 answer
155 views

newcommand, pgfplotsinvokeforeach, expl3: How to handle with several arguments of the kind '#...'

I have #1 for my newcommand. I have ##1 for my pgfplotsinvokeforeach-loop. Now I would need something like ###1 for my comparing-method "\fpcompareTF{##1<0}{333}{##1}". What is the right way ...
cis's user avatar
  • 8,139
1 vote
1 answer
427 views

Using \def variables computed by \FPeval within tikz

Hello there I am an absoulute beginner. I took some tikz template for drawing nerual nets and tried to modify it so I can change the number of layers automatically, but it yields strange errors. I ...
Adam Bajger's user avatar
4 votes
1 answer
453 views

Getting the equation number as an integer

I want to use the number of an equation as an integer value. Consider the following MWE: \documentclass{article} \usepackage[nomessages]{fp}% http://ctan.org/pkg/fp \begin{document} \begin{...
user avatar
5 votes
2 answers
623 views

Nested FPifeq : Extra \fi error

I want to have a command Unit with 1 parameter that return : nothing if the parameter is 1 - if the parameter is -1 the parameter in any other case The goal is to show x and -x instead of 1*x* and -...
Matheod's user avatar
  • 460
1 vote
1 answer
972 views

How to calculate factorial with xfp package

I'm trying to calculate the factorial with the xfp package. In the documentation (http://ctan.cs.uu.nl/macros/latex/contrib/l3packages/xfp.pdf), I have found the function name to be fact. My code ...
Carl's user avatar
  • 11
3 votes
1 answer
2k views

How to use result of \FPeval computation "inline"?

Instead of writing something as, which works \documentclass{article} \usepackage{array} \usepackage{fp} \begin{document} \FPeval{\result}{4*0.3} %store the result in `\result` first then: \...
Nasser's user avatar
  • 20.2k
0 votes
2 answers
352 views

combining ifthen with FPeval - problem

if i use \FPeval{\one}{\csname test1\endcsname} everything is fine. If i use \FPeval{\one}{\csname test1\endcsname+\csname test2\endcsname} in \ifthenelse, then i get en error. \...
Bilal Yilmaz's user avatar
2 votes
1 answer
331 views

Use \ifthenelse{\equal{ on a number called from reference

I want to store an answer key for an exam and then automatically move the multiple choice answer choices around for each question match its predetermined answer. (I need to conform my multiple choice ...
Matt S's user avatar
  • 267
2 votes
3 answers
715 views

How to store values in an array?

How to store a calculated value in array? zz(1) = ( xx(1) + yy(1) )/2 \fpeval\zz(\counter){(\xx(\counter)+\yy(\counter))/2} NOT working \documentclass{beamer} \usepackage{siunitx,amsmath} \...
sandu's user avatar
  • 7,950
4 votes
2 answers
578 views

Array variable with fp package: How to use \FPeval in array?

I want use array along with fp package. \FPadd\xx{\somevalues(1)}{\somevalues(3)} works well \FPeval\xx{\somevalues(1)+\somevalues(1)} NOT working How to use \FPeval in array? \documentclass{...
sandu's user avatar
  • 7,950
11 votes
3 answers
2k views

How to write Quadratic equation with negative coefficient

How to write Quadratic equation with negative coefficient in fp For a=1, b=-5, c= 6, $\ca x^2+\cb x + \cc=0$ gives 1x^2 + -5x + 6 But i want to have x^2 -5x + 6 \documentclass{beamer} \usepackage{...
sandu's user avatar
  • 7,950
2 votes
1 answer
354 views

Adding/subtracting to the /thecsvrow number in csvsimple

Assume a simple example centered on the csvsimple package. \documentclass{standalone} \usepackage{csvsimple} \usepackage{fp} \usepackage[table]{xcolor} \begin{filecontents*}{input.csv} Foo,...
Michael Gruenstaeudl's user avatar
6 votes
2 answers
1k views

Using FP package to compute sum breaks: FP error: UPN stack is empty!

I am trying to sum up entries in a table and thought using the fp package was the way to go. The MWE below, \AddToTotal{18,000.00} \AddToTotal{-17,000.00} \AddToTotal{-8,000.00} yields: as ...
Peter Grill's user avatar
5 votes
1 answer
216 views

Spy magnification with tangent to an ellipse doesn't work

I tried to adapt the zooming code from https://tex.stackexchange.com/a/457705/21557 to an ellipse, but if I choose the zooming factor high enough there is an obvious mismatch of the tangent position: ...
Julia's user avatar
  • 1,658
6 votes
1 answer
349 views

Why does the result of FPeval disappear after a `&`

I am trying to use the fp package, and the results are deeply confusing to me: \documentclass[a4paper]{article} \usepackage{fp} \begin{document} \begin{tabular}{r|l} \FPeval\testing{2 + 2} a & \...
Maya's user avatar
  • 171
1 vote
1 answer
263 views

How to add an unit to a calculated value properly?

I have some trouble to understand how I ought to handle some values I calculated with fp to use them as length. It is obvious that I have to add an unit to the number to use it, but trying to do so, I ...
user5950's user avatar
  • 1,456
2 votes
3 answers
2k views

FPeval in a macro [closed]

I am writing a document where I need to use a lot the following construct \FPeval{\born}{1833} \FPeval{\died}{1894} \FPeval{\age}{round(\died - \born,0)} Born in \born, died in \died (\age years old)...
tst's user avatar
  • 236
3 votes
1 answer
83 views

FP calculation problem with multicolumn

I want to do a calculation inside tabular environment, My tabular look like this \documentclass{book} \usepackage{array} \usepackage{fp} \begin{document} \begin{tabular}{|*{4}{c|}} \hline a & ...
Nazime Lakehal's user avatar
0 votes
1 answer
653 views

Strange behaviour of \FPeval

I have a piece of code, which sometimes compiled correctly, other times it gives an error. Is it possible that the package fp is unstable? Or might another package conflict with fp? How could I fix ...
bmv's user avatar
  • 3,588
1 vote
1 answer
335 views

Can FP read scientific notation?

I'm reading numbers from a file that are in scientific notation, and I'd like to do a simple calculation with them using FP. However, it's giving me the error FP error: Illegal character e found in ...
john_stech's user avatar
1 vote
1 answer
59 views

Why is there extra space in left justified longtable cell when creating custom function

I'm using the longtable and fp packages to create an invoice in the scrlttr2 document. I have used the \entry custom command to allow for creating running totals, compute the tax, and obtain a grand ...
Fred Hockney's user avatar
1 vote
3 answers
2k views

How to extract integer part and fractional part of a decimal number?

Code: \documentclass{article} \usepackage[a4paper]{geometry} \usepackage[english]{babel} \usepackage{fp} \def\x{59.3612} \begin{document} \noindent x = \x\\ %what to write here? int(x) = 59\\ frac(x) ...
user4035's user avatar
  • 5,035
5 votes
1 answer
708 views

LATEX3: More than 9 arguments

I am working on a table template with Latex3 and want to calculate the sum of a column. My Problem is that i can't pass more than 9 parameters, which is necessary since I don't know how big the table ...
ChrisF's user avatar
  • 95
5 votes
2 answers
874 views

Calculating a real inside an environment

I am trying to calculate real numbers within an environment. Unfortunately, I'll have to display the result of the calculations outside the environment. This is my minimal example. \documentclass{...
Jan's user avatar
  • 5,303
3 votes
1 answer
491 views

Problem with negative "multido" and "fp"

Is there a way to use "negative" numbers with multido and fp? In the code below, it works with \Nx=4+0.5 but not with \Nx=4+-0.5. Additional question: is there a way to do this without using package ...
Oli's user avatar
  • 483