emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sébastien Miquel" <sebastien.miquel@posteo.eu>
To: Matt Huszagh <huszaghmatt@gmail.com>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Patch to align baseline of latex fragments and surrounding text
Date: Fri, 10 Dec 2021 15:49:49 +0000	[thread overview]
Message-ID: <b341a28b-5434-b151-494e-c6847c364009@posteo.eu> (raw)
In-Reply-To: <87ilvxmngf.fsf@gmail.com>

Matt Huszagh writes:
>> I couldn't get ~org--match-text-baseline-ascent~ to compute the
>> ascent : the ~xml-get-attribute~ call returns
>>    : ("-16.945024" "12.153473" "16.148855" "8.064997")
>> which gives an ascent < -100, and the code then defaults to 'center.
> I'd need to know more about your setup for generating latex
> fragments. Did you follow all the directions in
> org--match-text-baseline-ascent? How is your org-format-latex-header
> set? In particular, are you using \documentclass[preview]{standalone}?
> If you can provide me with the TeX file used to generate the fragment,
> as well as the SVG file you get as a result, that would be helpful too.
My mistake. For some reason, I had thought that
=\documentclass[preview]{standalone}= was used by default for LaTeX
previews. Setting it as described in your patch, it now works
properly, even with the default value of =dvisvgm=.

>> If there are no drawbacks, perhaps this behaviour should be the
>> default. Otherwise, it should at least be easier to toggle.
> I didn't attempt to make this the default because it requires a specific
> setup, which is also different from the current default setup in other
> respects. Most importantly, it requires using the standalone document
> class, though I believe article is used at the moment.

To make this behavior easier to toggle, you could
  1. Change the default value of =org-format-latex-header=. The
     =standalone= class makes sense, but I don't know if that might
     break things.
  2. Specify the =:latex-header= of the default =dvisvgm= option. Same
     caveat applies.
  3. Add a =dvisvgm-with-ascent= option to the default value of
     =org-preview-latex-process-alist=.

Instead of the new variable =org-latex-fragment-overlay-ascent=,
perhaps the function used to compute the ascent could be provided as
another property, such as =:ascent=, added to the relevant options in
=org-preview-latex-process-alist=. It seems to make more sense since
it only applies to svg output, and it makes it easier to have this
behavior as default. It would require =org--make-preview-overlay= to
take the ascent as an additional argument.

Please note that I am not a maintainer, these are just a few thoughts.
I do hope your work can be applied and that LaTeX fragments can be
properly aligned by default.

You should add [PATCH] to the subject of your mail, so that it gets
listed at https://updates.orgmode.org/ and not forgotten. A maintainer
will reply eventually, but it might take up to a few months.

Regards,

-- 
Sébastien Miquel



  reply	other threads:[~2021-12-10 15:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-10 23:23 Matt Huszagh
2021-10-10 23:29 ` Matt Huszagh
2021-12-03  2:32   ` Matt Huszagh
2021-12-09 20:59     ` Sébastien Miquel
2021-12-09 22:18       ` Matt Huszagh
2021-12-10 15:49         ` Sébastien Miquel [this message]
2021-12-11  4:53           ` [Patch] Align " Matt Huszagh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b341a28b-5434-b151-494e-c6847c364009@posteo.eu \
    --to=sebastien.miquel@posteo.eu \
    --cc=emacs-orgmode@gnu.org \
    --cc=huszaghmatt@gmail.com \
    --subject='Re: Patch to align baseline of latex fragments and surrounding text' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this 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).