* Ihor Radchenko <yanta...@posteo.net> [2023-02-13 17:50]: > Gustaf Waldemarson <gustaf.waldemar...@gmail.com> writes: > > > Does something like that already exist in org-mode? Alternatively, > > what is the recommended and most portable approach to placing images > > side-by-side? > > No, AFAIK.
Org is already a text structure that has elementary objects defined, as you said, not everything is granular, but there is no limit what users can define in Org. Elementary Objects: https://www.dougengelbart.org/content/view/110/460/#2a1a So anything can be elementary object, no matter in what kind of a system. By having that in mind, I think other objects could be used to get what user wants. In Asciidoctor I can make table with invisible lines, and position pictures inside of cells, or place some text on sides. There exists Asciidoc export for Org. What you read is now my thoughts about it, development towards possible solution: | My left | My right | |---------+----------| | left | right | Giving this with Asciidoc Org export: [width="80%",options="header"] |==== | My left| My right | left| right |==== Then this here: | [[./img/a.jpg]] | [[./img/b.jpg]] | Get correctly exported as: [width="80%"] |==== | image:./img/a.jpg[]| image:./img/b.jpg[] |==== in Asciidoctor. One can use that as fundamental point. Instead of using Asciidoctor export, one could use source blocks to generate LaTeX export by using Asciidoctor markup. Here is only the idea: #+BEGIN_SRC asciidoctor-to-latex [width="80%"] |==== | image:./img/a.jpg[]| image:./img/b.jpg[] |==== #+END_SRC Then based on following function, one can conevert that above: (defun rcd-asciidoc-snippet-no-header-footer-to-latex (text) "Return LaTeX for Asciidoc snippet TEXT without header and footer." (let* ((text (rcd-asciidoctor text "-s" "-b" "docbook5")) (text (rcd-pandoc-convert-string text "docbook" "latex"))) text)) (rcd-asciidoc-snippet-no-header-footer-to-latex " [width=\"80%\"] |==== | image:./img/a.jpg[]| image:./img/b.jpg[] |==== ") ➜ "\\begin{longtable}[]{@{} >{\\raggedright\\arraybackslash}p{(\\columnwidth - 2\\tabcolsep) * \\real{0.4000}} >{\\raggedright\\arraybackslash}p{(\\columnwidth - 2\\tabcolsep) * \\real{0.4000}}@{}} \\toprule\\noalign{} \\endhead \\bottomrule\\noalign{} \\endlastfoot \\includegraphics{./img/a.jpg} & \\includegraphics{./img/b.jpg} \\\\ \\end{longtable} " and by using the above think process, it is possible to make following, by using the Org snippet: #+BEGIN_SRC org-to-asciidoc-to-latex | [[./img/a.jpg]] | [[./img/b.jpg]] | #+END_SRC then such Org snippet can be converted to Asciidoc, then to docbook5, then to LaTeX or to HTML. Solution is right there by using pandoc, asciidoctor and "elementary objects" as Org Babel source blocks. And this may not be the only solution. > There are two problems: > 1. We currently lack object-granular control over export attributes. > Attributes for images are set for the whole paragraph and Org uses a > paragraph starting with image as a special case, assigning paragraph > to the image. By using above method, that is solved for each individual user how they wish and want. It does not need much adaptation IMHO. > 2. There is no easy universal way to create side-by-side images for all > possible backends. As if you do not control those backends, there is also no need for that. However, by using the above method, it is possible to solve it for all backends straight from Org, by only adding conversion function. > The best thing we might provide is merging multiple images into one > using, for example, a LaTeX minipage export to create merged image > to be included into the exported document. Merging multiple images sounds to me as hard coding. Providing small conversion functions for various exports like HTML, Org would just make it work. I did not provide final example in this e-mail, but now you could, I gave you the thought process and functionality. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/