4

Is it possible to convert column 2 to latex in org-table using a command? It seems that the technology already exists with calc-embed but I don't know how to use it here.

  | G | 7*(-2:5)+5*(4:7)                | \frac{2}{35}  |
  | H | 1:3 + 1:6 + 5:12                | \frac{11}{12} |
  #+TBLFM: $3='(calc-eval $2)

Desired input

   | G | 7* \frac{-2}{5} + 5 * \frac{4}{7}      | \frac{2}{35}  |
   | H | \frac{1}{3}+ \frac{1}{6}+ \frac{5}{12} | \frac{11}{12} |
  #+TBLFM: $3='(calc-eval $2)

Update I forgot to mention just in case someone missed it, calc-embedded need to be activated, calc-embedded-activate

2
  • 1
    I think that calc-embedded-activate is misleading here. From the info: The ‘C-x * a’ (‘calc-embedded-activate’) command scans through the current buffer and activates all embedded formulas that contain ‘:=’ or ‘=>’ symbols.
    – Marco Wahl
    Commented Sep 21, 2015 at 19:41
  • I think this is a nice feature request. Please post it on the Org mailing list.
    – suvayu
    Commented Sep 22, 2015 at 8:25

1 Answer 1

2

Have the region -2:5 in a buffer.

C-0 C-x * e activates calc's embedded mode on that region. Activate calc-latex-language by typing d L if not already done. The marked text has been replaced by \frac{-2}{5}. Key sequence C-x * e deactivates embedded mode.

So I think it's possible to write a command that checks for fractions like -2:5 in a column of an org-table and then applies calc's conversion as pointed out above.

1
  • Thanks for the reply. It's a nice try! I'm aware of this possibility. I was more looking for a way to do it for the whole column in one go with a command.
    – DJJ
    Commented Sep 22, 2015 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.