Hello Everyone, I wanted to chime in to say I encountered a very similar problem. I author my math papers in LaTeX but I really wanted to use org to have an interconnected corpus of math notes with definitions, proofs, ideas, attempted computations, etc. Then they could be exported to LaTeX or even better: HTML to make for quite nice interactive notes (with popups backlinking to definitions of mathematical objects, etc...) (I was writing the latter in some JS). Unfortunately, HTML (+mathjax or whatever) is much more flexible than PDFs
>I suggest that special block in LateX export >(https://orgmode.org/manual/Special-blocks-in-LaTeX-export.html) may be >treated differently. Once again, I'm new to org-mode, but here is my intuition: >- What is happening now. The #+BEGIN_proof / #+END_proof keywords cause my >proof to be seen as a block. Therefore, babel fontification is called to >highlight syntax of my proof within my buffer. Timothy already discussed here >how inefficient the >babel fontification is. >- What could happen. Changing (somewhere) the treatment of #BEGIN_proof & co >the following way: Assign them to a new face "latex_export_sugar" and ignore >them while editing. Doing this, the fontification of the org proof will be >made as usual and >will be fast enough. While exporting, replace #+BEGIN_proof >by \begin{proof} and so on... Exactly! Before HTML export becomes relevant, I if I tried to use #+BEGIN_proof #+END_proof or #+BEGIN_definition #+END_definition insertion in these environments slowed very quickly down to a crawl. If I remember correctly the profiler told me that it was due to fontification. For me, the slowness in fontification INSIDE actual latex math blocks (the only place where I need fontification, and I would prefer to use AucTeX to do that, since it is really good at it) is generally not an issue since I mostly have latex previews and use the edit source command to work on the formulae. It would allow for a greater variety of workflows if one could specify that some blocks lines should be ignored for fontification purposes and the contents be treated as usual org-mode text. If you think it can be useful I can try to dig up my (abandoned) attempts and try to provide test cases to improve performance. > If proof environment is still required, maybe it is possible to > customize export backend to have proofs as a headings with some property > in the source document. Unfortunately this is not really fitting with my workflow (and I think this is not only my issue). In Org Mode, headings cannot "terminate" i.e. only a new section can stop a previous one. So, essentially, one would need to do a very non-elegant trick similar to one used by the "inline TODOs" i.e. having a very deep level of heading (10?) that "starts" a proof and then an artificial one that "ends" it. Also, the point of having "proof" blocks and "example" blocks that often, when reading math, you do not want to go through the proof on the first reading. One issue that many colleagues have agreed when discussing is that it would be so great to have a "collapsible" environment or block. When we write notes or explanations of material, often we are tasked with making a call: do we do computations step by step and risk being verbose, or do we write only the main steps and leave it to the reader to fill in the intermediate ones. Both these approaches have downsides. The former makes seeing the main points of the reasoning difficult to catch and forces a reader to commit significant effort to completely read the paper or notes (even if they just want the gist of it). The other approach may frustrate the reader interested in details because he/she has to work through the material to fill in all the gaps, often spending a lot of time on omitted intermediate steps. I was actually trying to come up with a natural system through org and HTML export to avoid this dilemma and have sections that are hidden by default but can be "expanded" on request. > On the other hand my impression was that \begin{proof} environment is > intended to emphasize a paragraph or two to separate it from regular > text on the same page. My expectation is that 4-page long proof should > be formatted as ordinary sections and subsections. Unfortunately this goes against the standard of mathematical writing (that I at least am familiar with). Proofs are often long and technical and can span multiple pages. If there are self-contained results in the proofs you separate them out in statements (lemmata) with their own (shorter) proofs. Text outside proofs is usually explanations and "glue" that explains the process, the idea, but does so on a more "informal" level. Having "proof" environments is also very useful as a method of having "namespaces", often you need to introduce auxiliary objects, expressions, operations, that are relevant only for the proof of the result but that should not be "polluting" the full paper or writeup. For example, if you introduce something inside a proof and denote it with a symbol (e.g. $\phi$) then as soon as you hit the QED symbol at the end of the proof, that symbol is freed and can be used in other proofs/constructions. It is very bad form, for example, to reference objects inside proofs of theorems outside the proofs themselves. If something is an object of general interest then it should be "defined" (included in a definition) on its own. I apologize for going on a tangent. Thanks again to everyone for the great package that is ORG, that I am progressively trying to incorporate in more and more of my day-to-day work and life. Best! Gena -- Gennady Uraltsev <gennady.uralt...@gmail.com> (https://guraltsev.gitlab.io)