On 21/10/2022 10:41, Ihor Radchenko wrote:
Max Nikulin writes:

On 20/10/2022 12:07, Ihor Radchenko wrote:
When transcoding children (e.g. table rows), the sibling rows can always
be accessed using org-export-get-previous-element and

Decision if escaping is necessary should be based on export result, not
on the source element.

I am not sure. The export result may originate from constructs like

#+MACRO: pagebreak @@latex:\\@@

Some paragraph {{{pagebreak}}}
src_elisp[:results raw]{(format "@@latex:[%dpt]@@" (or my-spacing-value 0))}

The point is: it can be done on purpose for some reason.

I agree that it can be done for purpose and I am not happy that due to table syntax it is not easy to emit custom code between rows.

Since you declined an idea to mark default line breaks with some unique comment to use it in search pattern in a filter, I may suggest to change custom code to either remove newline before brackets or to add a comment after \\

Some paragraph
src_elisp[:results raw]{(format "@@latex:\\\\[%dpt]@@" (or my-spacing-value 0))}

or #+MACRO: pagebreak @@latex:\\%@@

With any variant such line break will be ignored by "optimizing" filter.

Concerning element vs. exported text, consider a derived backend that ignores italics markers if a paragraph has some attribute. Usually
     Paragraph \\
does not cause any problem, however if italics is ignored it is an error
That is why namely exported code of adjacent leaf node should be examined. Ideally there should be a possibility to add some attributes or properties to distinguish raw export snippet. Unfortunately it requires complete redesign of org-export.

Reply via email to