Ask Your Question

Can I add Functions to Math?

asked 2021-02-28 20:30:31 +0200

ml9104 gravatar image

updated 2021-02-28 21:15:18 +0200

I'd like to add a function to LO Math, specifically arctan2(y,x), but in the menus I found no way to do this.
Is this even possible?

Thank You.

edit retag flag offensive close merge delete


This function is present in Calc. It is listed as ATAN2

AdmFubar gravatar imageAdmFubar ( 2021-02-28 21:53:58 +0200 )edit

I'm aware of this. But I'm talking about Math and adding it as a function to present formulas using it in a nice way.

ml9104 gravatar imageml9104 ( 2021-02-28 22:04:05 +0200 )edit

Something is a bit munged with the forum here. Wanted to edit my comment or add a new one and couldn't mouse pointer moved a bit and hit the convert to answer link.

Yes you did say Math... Looks like you will have to build that function as a macro and call it that way.

Also has anyone else noticed that in the Math module of LO is called Formula in the File/New drop down menu?

Using LO from opensuse 15.2.

AdmFubar gravatar imageAdmFubar ( 2021-02-28 22:17:58 +0200 )edit

Do you mean make arctan2(y,x) to look like other functions, as in arctan2(y,x)? Put double quotes around it, "arctan2"(y,x)

Earnest Al gravatar imageEarnest Al ( 2021-02-28 23:30:47 +0200 )edit

You would prolly want to make it look and work like a normal function would. I've not personally done this, but it should be possible with a macro. This will be a good start on macro writing

AdmFubar gravatar imageAdmFubar ( 2021-02-28 23:38:25 +0200 )edit

Aren't the function ATAN2() and its name monsters anyway. All my life I worked with functions named without the usage of digits. Calc (or whoever) didn't a good job with that function giving it a name outside the usual namespace for functions. In addition AZAN2() is completely needless. Math shouldn't be blamed for "disliking" names with digits.

Lupp gravatar imageLupp ( 2021-03-01 00:39:09 +0200 )edit

Why are you talking about Calc? Riding some hobby horse here?
The question was related to Math.
For your reference:

ml9104 gravatar imageml9104 ( 2021-03-01 00:50:49 +0200 )edit

You're kidding? Of course I knew the question was about Math.
However, a function named atan2 (and its functionality) simply isn't known to me except for spreadsheets. Why should it be used in a Math formula then? In mathematics the nearest related function would be arg where the input which is a pair (x, y) for the spreadsheet function would be the complex number x + i y.

Lupp gravatar imageLupp ( 2021-03-01 02:03:31 +0200 )edit

atan2/arctan2 is a well-known function distinct from atan. The latter takes a single "tangent" argument (and has no way of knowing which half of plane is being meant), while the former takes two arguments (coordinates of a point on the tangent ray) to overcome this limitation of plain atan. Distinguishing the two functions is very useful, and blaming others in wanting to use such things (based on something "isn't known to me") is ... strange. Besides, even if it were used only in spreadsheets (which is not the case), why would someone not want to create, say, a tutorial for spreadsheet use with formulas created in Math? And should that someone give you account for their reasons?

Mike Kaganski gravatar imageMike Kaganski ( 2021-03-01 07:29:46 +0200 )edit

I see the distinguishing of inlined digits as a regression. This is the kind of "second guessing user intention" which is an important reason why I dislike MS Office.

I submitted an "un-enhancement request"

keme gravatar imagekeme ( 2021-03-01 10:11:31 +0200 )edit

2 Answers

Sort by » oldest newest most voted

answered 2021-03-01 07:22:58 +0200

updated 2021-03-01 08:29:44 +0200

If you need a new "function" in Math, just use

func newfuncname(x, y)

... which would format the argument of the func keyword according to your formula's functions setting (same formatting as, say, sin built-in function).

It seems that the 2 is automatically considered an argument to the new function, and will be formatted as number (it's common to have things like sin45°); so for arctan2, you might need a workaround like

func arctan func2(y,x)

or, taking into account that arctan is already a pre-existing function, and Math inserts a small gap between function name and argument, it might even be better to use this:

nospace {arctan func2}(y,x)

The keyword is present in the Math' Functions section of Elements pane:


edit flag offensive delete link more


See tdf#140726 which I filed for possible discoverability problem with this keyword.

Mike Kaganski gravatar imageMike Kaganski ( 2021-03-01 08:19:11 +0200 )edit

Thank You for your efforts. Your suspicion that 2 is formatted as a number is correct, so I'll stay with my Text/italic workaround.

ml9104 gravatar imageml9104 ( 2021-03-01 18:30:22 +0200 )edit

answered 2021-02-28 23:52:51 +0200

ml9104 gravatar image

updated 2021-02-28 23:54:39 +0200

OK, solved somehow.
Anyhow, it's all about layout, readability and aesthetics of formulas.
Entering the function as "arctan2" and choosing 'Format', 'Fonts..', 'Modify', 'Text' and choosing italic makes it look good.
Using a macro is somewhat over the top.

Math is a bit of a stepchild in LibreOffice, I think. But nice.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2021-02-28 20:30:31 +0200

Seen: 64 times

Last updated: Mar 01