From: Ihor Radchenko <yantar92@gmail.com>
To: Timothy <tecosaur@gmail.com>
Cc: emacs-orgmode@gnu.org, Daniel Fleischer <danflscr@gmail.com>,
Nicolas Goaziou <mail@nicolasgoaziou.fr>
Subject: Re: [PATCH] New LaTeX code export option: engraved
Date: Thu, 05 May 2022 16:48:39 +0800 [thread overview]
Message-ID: <87sfpogyag.fsf@localhost> (raw)
In-Reply-To: <87wnf1z1w8.fsf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1338 bytes --]
Timothy <tecosaur@gmail.com> writes:
> This patchset accomplishes two things:
> 1. It refactors the overly large `org-latex-src-block' function, and makes a few
> other improvements to pre-existing code
> 2. It adds a new option for exporting code, named (you guessed it!) “engraved”
>
> What is this new option, and why do we want it?
>
> About a year ago I started work on a package that generalises the functionality
> of `htmlize.el', termed `engrave-faces'
> (<https://elpa.gnu.org/packages/engrave-faces.html>). It provides the ability to
> extract font-lock information and export it to a number of formats: html, ansi,
> and (crucially) LaTeX! Since the LaTeX export is built on the `fvextra' (LaTeX)
> package (like pygments), the vast majority of the Minted options you’re used to
> just carry over.
>
> This allows for a result that is, I think, straight up better than all the
> pre-existing options. For starters, you can now apply syntax highlighting to any
> language you have a major mode for.
Thanks!
Implementing fontification using Emacs capabilities is certainly a step
in the right direction. LaTeX support for fontification has always been
tricky.
Some comments:
- I tried to test your patch, and it only works partially. There is some
stray text caused by LaTeX errors:
[-- Attachment #2: test.org --]
[-- Type: application/vnd.lotus-organizer, Size: 396 bytes --]
#+STARTUP: indent
Enable soft indent mode
**** Header Level 4
The text belonging to level-4 header
*************** Inline Task
Text belonging to inline task
*************** END
#+caption: This is caption
#+begin_src emacs-lisp
(message "Hello world and very very very long line afterwards lakjsdlk sjsaldjkjsa ldjalskdjalsjdlalds jalskdjalsjdlas kdjalsdjlsjdals djasdjasljdasljdslj")
#+end_src
[-- Attachment #3: test.pdf --]
[-- Type: application/pdf, Size: 93821 bytes --]
[-- Attachment #4: Type: text/plain, Size: 2329 bytes --]
- You did not add a NEWS entry and did not update the manual in your patch.
- There are many compiler warnings emitted when compiling Org with your patch
> +(defun org-latex-inline-src-block--minted (info code lang)
> + (let ((mint-lang (or (cadr (assq (intern lang)
> +
> +(defun org-latex-inline-src-block--listings (info code lang)
> + (let* ((lst-lang (or (cadr (assq (intern lang)
The docstrings are missing in the above.
> -Alternatively,
> +There are two fancier options for fontification.
> +
> +The first fancy alternative,
I am not sure why, but the word fancy feels slightly annoying here.
> +
> +The styling of the engraved result can customised with
> +`org-latex-engraved-preamble' and `org-latex-engraved-options'.
> +The default preamble also uses the tcolorbox LaTeX package in
> +addition to fvextra.
Since engraved is not entirely relying on LaTeX options, a lot of
customisation is not mentioned in this docstring. AFAIU, color
customisation is only possible by changing defcustoms from engrave-faces
package.
Another related note is what is going to happen in beamer export with
dark background. The default face mapping in engrave-faces is using some
kind of light theme, which may lose all the contrast on not-light
background.
> +\\renewcommand\\theFancyVerbLine{\\footnotesize\\color{black!40!white}\\arabic{FancyVerbLine}}
> +
> +\\providecolor{codebackground}{HTML}{f7f7f7}
> +\\providecolor{codeborder}{HTML}{f0f0f0}
> +\\providecolor{EFD}{HTML}{28292e}
> +(defcustom org-latex-engraved-options
> + '(("commandchars" . "\\\\\\{\\}")
> + ("highlightcolor" . "white!95!black!80!blue")
> + ("breaklines" . "true")
> + ("breaksymbol" . "\\color{white!60!black}\\tiny\\ensuremath{\\hookrightarrow}"))
> + "Association list of options for the latex fvextra package when engraving code.
It feels that codebackground, codeborder, and EFD should be customizable
by org-latex-engraved-options.
> +(defun org-latex-generate-engraved-preamble (info syntax-colours-p)
Docstring?
> +(defun org-latex-inline-src-block--engraved (info code lang)
> + (if (require 'engrave-faces-latex nil t)
> ...
> + (message "Cannot engrave inline src block, `engrave-faces-latex' is unavailible.")
> + (insert (org-latex--text-markup code 'code info))))
Why message instead of error?
Best,
Ihor
next prev parent reply other threads:[~2022-05-05 9:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-04 15:59 [PATCH] New LaTeX code export option: engraved Timothy
2022-05-05 7:52 ` Daniel Fleischer
2022-05-05 16:09 ` Timothy
2022-05-06 2:35 ` Ihor Radchenko
2022-05-06 11:23 ` Timothy
2022-05-05 7:54 ` Daniel Fleischer
2022-05-05 8:48 ` Ihor Radchenko [this message]
2022-05-05 15:17 ` Timothy
2022-05-05 16:13 ` Timothy
2022-05-07 5:16 ` Ihor Radchenko
2022-05-07 6:57 ` Timothy
2022-05-07 10:40 ` Timothy
2022-05-07 11:33 ` Daniel Fleischer
2022-05-08 14:30 ` [PATCH] (v2) " Timothy
2022-05-09 6:20 ` Ihor Radchenko
2022-05-09 12:57 ` Timothy
2022-05-10 8:00 ` Max Nikulin
2022-05-11 11:06 ` Ihor Radchenko
2022-05-11 16:05 ` [PATCH] (v3) " Timothy
2022-05-12 16:40 ` Daniel Fleischer
2022-05-12 16:44 ` Timothy
2022-05-05 16:48 ` [PATCH] " Max Nikulin
2022-05-07 4:13 ` Ihor Radchenko
2022-05-09 19:19 ` Sébastien Miquel
2022-05-10 1:13 ` Timothy
2022-05-10 16:10 ` Timothy
2022-05-10 17:53 ` Sébastien Miquel
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=87sfpogyag.fsf@localhost \
--to=yantar92@gmail.com \
--cc=danflscr@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=mail@nicolasgoaziou.fr \
--cc=tecosaur@gmail.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public 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).