emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* rounding when exporting
@ 2018-06-25 20:20 Uwe Brauer
  2018-06-25 23:19 ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Brauer @ 2018-06-25 20:20 UTC (permalink / raw)
  To: emacs-orgmode



Hi 

Is there way, that when I export and org file with a table, its content
is rounded when exported to html/latex?

Uwe Brauer 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: rounding when exporting
  2018-06-25 20:20 rounding when exporting Uwe Brauer
@ 2018-06-25 23:19 ` Nick Dokos
  2018-06-26  6:58   ` Uwe Brauer
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2018-06-25 23:19 UTC (permalink / raw)
  To: emacs-orgmode

Uwe Brauer <oub@mat.ucm.es> writes:

> Hi 
>
> Is there way, that when I export and org file with a table, its content
> is rounded when exported to html/latex?
>

The exporters take the text to be exported from the buffer, so if the buffer contains
arbitrary precision, then I don't think so: you'd have to apply a filter of some sort.

It's easy enough however to set the format for calc, recalculate all the tables, export,
then reset the format and recalculate once more to get back to where you were. Note
that internally org calculates floating point numbers to 12 decimal places (roughly)
but displays only 8 of them (to keep the display a bit more compact). See

(info "(org) Formula Syntax for Calc")

for details. Here's an example to use fixed-point format with 3 decimals:

--8<---------------cut here---------------start------------->8---

* Set floating point format to fixed point with 3 decimals                         :noexport:
#+begin_src emacs-lisp
(setq org-calc-default-modes '(calc-internal-prec 12 calc-float-format
                    (fix 3)    ;;; the default here was (float 8)
                    calc-angle-mode deg calc-prefer-frac nil calc-symbolic-mode nil calc-date-format
                    (YYYY "-" MM "-" DD " " Www
                          (" " hh ":" mm))
                    calc-display-working-message t))

#+end_src

* Table

|  x | log(x) |
|----+--------|
|  1 |      0 |
|  2 |  0.693 |
|  3 |  1.099 |
|  4 |  1.386 |
|  5 |  1.609 |
|  6 |  1.792 |
|  7 |  1.946 |
|  8 |  2.079 |
|  9 |  2.197 |
| 10 |  2.303 |
#+TBLFM: $2 = log($1)
--8<---------------cut here---------------end--------------->8---

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: rounding when exporting
  2018-06-25 23:19 ` Nick Dokos
@ 2018-06-26  6:58   ` Uwe Brauer
  0 siblings, 0 replies; 3+ messages in thread
From: Uwe Brauer @ 2018-06-26  6:58 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1305 bytes --]


   > Uwe Brauer <oub@mat.ucm.es> writes:

   > The exporters take the text to be exported from the buffer, so if the buffer contains
   > arbitrary precision, then I don't think so: you'd have to apply a filter of some sort.

   > It's easy enough however to set the format for calc, recalculate all the tables, export,
   > then reset the format and recalculate once more to get back to where you were. Note
   > that internally org calculates floating point numbers to 12 decimal places (roughly)
   > but displays only 8 of them (to keep the display a bit more compact). See

   > (info "(org) Formula Syntax for Calc")

   > for details. Here's an example to use fixed-point format with 3 decimals:


   > * Set floating point format to fixed point with 3 decimals                         :noexport:
   > #+begin_src emacs-lisp
   > (setq org-calc-default-modes '(calc-internal-prec 12 calc-float-format
   >                     (fix 3)    ;;; the default here was (float 8)
   >                     calc-angle-mode deg calc-prefer-frac nil calc-symbolic-mode nil calc-date-format
   >                     (YYYY "-" MM "-" DD " " Www
   >                           (" " hh ":" mm))
   >                     calc-display-working-message t))

   > #+end_src

very useful, thanks a lot. Solved my issue

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-26  6:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-25 20:20 rounding when exporting Uwe Brauer
2018-06-25 23:19 ` Nick Dokos
2018-06-26  6:58   ` Uwe Brauer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).