Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [fp]

The tag has no usage guidance.

3
votes
1answer
23 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: \...
0
votes
2answers
29 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. \...
2
votes
1answer
36 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 ...
2
votes
3answers
48 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} \...
4
votes
2answers
38 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{...
11
votes
3answers
910 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} \...
2
votes
1answer
30 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,...
6
votes
2answers
172 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 ...
5
votes
1answer
75 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: ...
6
votes
1answer
123 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 & \...
1
vote
1answer
35 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 ...
2
votes
3answers
391 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)...
3
votes
1answer
45 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 & ...
0
votes
1answer
164 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 ...
1
vote
1answer
163 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 ...
1
vote
1answer
39 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 ...
1
vote
3answers
374 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) ...
1
vote
0answers
55 views

Can spreadtab distinguish between displayed value and actual value?

Number formatting behaves in a way that is not ideal in spreadtab. Basically, I can set rounding using \STautoround{2}, but if the numbers in the table are used in later computations, the rounding ...
5
votes
1answer
434 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 ...
4
votes
2answers
355 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{...
3
votes
1answer
260 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 ...
1
vote
1answer
398 views

fp - How to keep running sum in variable?

I have this code in my LaTeX: \FPset{totalHours}{0} \newcommand{\entry}[5]{ \FPeval{totalHours}{(totalHours)+#5} #1 & #2 & #3 & #4 & #5 \\ } Where \entry is meant to be an ...
5
votes
2answers
505 views

Unable to pass result of one command as argument to another

In my document I have the need to do a little bit of maths, which is related to sizing images. Specifically I need a linear interpolation function, the inverse function of linear interpolation, and a ...
9
votes
2answers
1k views

Direct evaluation of fp expression

This code \documentclass{article} \usepackage[nomessages]{fp} \begin{document} \FPeval{result}{clip(cos(pi))} $\cos(\pi)=$\result \end{document} would produce the following output: Is it possible ...
2
votes
1answer
370 views

\FPeval not working in new command

\documentclass[10pt]{article} \usepackage{calc} \usepackage{fp} \newcommand{\test}[1]{ \makeatletter \setlength{\tempdimen}{\widthof{#1}} \FPeval\‌​resultaP(70-\strip@pt\tempdimen)/2} \makeatother} \...
4
votes
1answer
452 views

\widthof{} command in \FPeval

Could someone please tell me how I can use the \widthof{} command from the calc package within \FPeval from the fp package? \documentclass[10pt]{article} \usepackage{calc} \usepackage{fp} \begin{...
1
vote
1answer
136 views

Library with xkeyval, make my life easier?

Question is related to the topic that I opened last year regarding the Library with xkeyval, fp and newcommand where the library now grew quite big and adding new stuff in it has become tedious and ...
2
votes
1answer
294 views

Creating a heatmap using calculations and tabular environment

I know there exists pgf, and many people uses this to create heatmaps. I however am not allowed to use this package. I therefore want to create a command that enables me to color the different cells. ...
1
vote
0answers
111 views

Expansion to fpeval

This is a followup to Egregs answer in the question Deleting defined variables or assign within group, I am trying to expand the code, but got into trouble while attempting some calculations with ...
3
votes
2answers
228 views

overloading functions of the fp package

I have a document with several commands that store numeric variables inside an extra macro. This extra macro will highlight that text so I can track them in the printed document. Like so: \...
5
votes
2answers
169 views

Error in pgfplot when big offset is subtracted

I have some data with a huge offset that I want to plot. Im using PGF plots, where it's possible to subtract the offset from a whole row in my data. This works when the offset isn't too big, and/or ...
0
votes
1answer
218 views

Library with xkeyval, fp and newcommand

Been searching the net here and did not find any solution to this. I am having some problems with a defined library structure (xkeyval) with FPeval calculation and then passing this information/...
0
votes
2answers
436 views

Numerical calculations inside table environment

I am doing a coursework in mechanics and would like to write both the theory and calculations in LaTeX. However, as design is iterative process, I would like to escape the tedious cycle of: Select ...
3
votes
2answers
853 views

Tikz: Math with coordinates

I need to extract the coordinates of a node into a variable. I've tried \pgfextractx \documentclass[11pt]{article} \usepackage{fp} \usepackage{tikz} \usetikzlibrary{calc} \begin{...
2
votes
2answers
175 views

Show variable name, measurement unit and value in a single command invocation

I am using the fp package to write a coursework in mechanics and calculate the numerical values on the fly. Here is some example code: \documentclass{article} \usepackage[nomessages]{fp} % http://...
2
votes
1answer
102 views

Calculating time difference within datatools foreach

I'm trying to build a table with some calculations from an external file. data.csv: From,To,Task 10:00,11:00,Task1 11:00,13:13,Task2 I'm using datatool to read the csv and it's foreach to output the ...
3
votes
1answer
196 views

How to pass a command as \uncover argument

I can't pass a command to the argument of an uncover command in the beamer class. Why? How do I fix this? Here's my code: \documentclass{beamer} \usepackage{fp} \newcommand{\fcEvalToInt}[1]{\FPeval{\...
12
votes
4answers
9k views

Using LaTeX as calculator [duplicate]

I know that exist several packages, like fp that allow to make all kinds of computations. But I do not understand the correct way to use them. I need some simple examples of multiplication and ...
11
votes
3answers
949 views

Accuracy of calculations in TikZ with fixed point arithmetic

I want to build a tree which satisfies the following: It grows to the right. The first child grows at 0 degrees (subsequent children growing clockwise). All children nodes are in the same vertical, ...
1
vote
1answer
349 views

Using Texcount Templates

Anybody have a texcount template they would share? I noticed that the texcount documentation references an option -template="template". I presume this is to enable adding some custom text surrounding ...
3
votes
1answer
672 views

Select largest value from a list of variables in LaTeX

I am trying to adapt this example How to iterate over a comma separated list? as my base. Except, rather than display all values, I actually want to iterate through all the values and only return / ...
4
votes
1answer
86 views

fp alignment in tables

Can anyone explain why the output from these two entries is different? Does anyone know how to make the second one match the first? \documentclass{article} \include{fp} \newcommand\entryOne[1]{ \...
6
votes
2answers
412 views

TeX/LaTeX: Macro for getting a length as number

I would like to write a macro getlengthin to get a length or dimen as floating point number in a specified unit. Here is what I have created so far: \documentclass{article} \usepackage[nomessages]{...
2
votes
1answer
740 views

Component Library and automatic calculations with FPeval

I have come upon a problem I'd like to solve but unable to by myself. My intention is to create a library of components with different parameters and do calculations with FPeval. Here is the code: \...
7
votes
2answers
219 views

Why does the samples option conflict with fp?

Minimal working example: \documentclass{amsart} \usepackage{fp} \usepackage{tikz} \usetikzlibrary{fixedpointarithmetic} \begin{document} \begin{tikzpicture}[scale=2, fixed point arithmetic] \draw[...
4
votes
3answers
2k views

logarithm, sine, cosine etc evaluated in tabular

I know that I can use spreadtab to make automatic calculations in a tabular. However, I only managed to do simple operations like +-*/, but I have no idea how to make more complex ones like log, ln, ...
4
votes
1answer
1k views

global variables and/or array of variables

I'm looking for a way to obtain (in tex/latex - still difficult for me to determine the difference - I guess it should state latex) run-time defineable global variables to be used with the fp package. ...
2
votes
1answer
287 views

FP commands inside math mode

I face a strange problem running fp macros inside tabenum (tablists package) environment. I use fp to generate some values that are presented with a personal list environment based on tabenum. The ...
1
vote
2answers
557 views

\num with parameters in siunitx table

I have a couple of different methods to solve a diven problem and I want to compare them in a table. My aim is it to automatically add the relative deviation. I got some problems using siunitx within ...
2
votes
1answer
294 views

Using a fp variable in a longtabu header

So, I am using the tabu package (which I need to use over tabular others for several reasons) to make a long table spanning several pages. This table contains currency amounts in a column, and I'd ...