7

Let's assume we have a table that looks like this:

table with correct alignment

After running org-preview-latex-fragment command I get this:

table with broken alignment

As you can see the top row is not aligned with the other rows.

How can one view latex formulas inside org-mode tables without breaking table alignment?

itsjeyd
  • 14,586
  • 3
  • 58
  • 87
Empty_Mind
  • 1,341
  • 12
  • 27
  • 1
    The `$$` syntax (for centered maths, and deprecated anyway) would probably break a latex table as well. Does alignment work better if you use the `$` syntax (inlined maths)? – T. Verron May 29 '15 at 05:39
  • @T.Verron my guess is that the result will be better by 2 spaces, which is still 2 short of being right. – Malabarba May 29 '15 at 23:32
  • 2
    @T.Verron : Same result for `\(` `\[` `$` operators. – Empty_Mind May 30 '15 at 00:29

1 Answers1

1

The alignment in org-mode tables is handled assuming that the content of the table is shown using a fixed width font. Take a look at how a normal table looks like when it is displayed using a variable width font:

variable width font

org-preview-latex-fragment creates images for the mathematical formulas that do not have fixed widths and this is what causes the misalignment. I am not sure that there are many things you can do about this, but do take a look at this question and the solution given there.

  • Solution in provided link is not sufficient to this problem. Think solution would be calculating given space in a cell, then generate picture with appropriate size. To avoid distortion simple resizing is not enough. Another shortcoming is, formulas in table will be of different length. Solution in link gives only fixed size of image. – Empty_Mind Jun 08 '18 at 21:17