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: Sat, 07 May 2022 13:16:09 +0800 [thread overview] Message-ID: <875ymhzzvq.fsf@localhost> (raw) In-Reply-To: <87sfpoyn0l.fsf@gmail.com> Timothy <tecosaur@gmail.com> writes: Thanks for the updated patch! See some more comments below. > +The first two options provide basic syntax > +highlighting (listings), or none at all (verbatim). > ... > -Alternatively, > +There are two options for more comprehensive fontification. The > +first can be set with, Maybe "The other two options"? Also, using first/second here is a bit confusing because: (1) they are actually 3/4 in the above list; (2) engraved is listed last. > +The second more comprehensive option can be used with, *can be set with > -causes source code to be exported using the minted package as > -opposed to listings. If you want to use minted, you need to add > -the minted package to `org-latex-packages-alist', for example > +which causes source code to be exported using the minted package > +as opposed to listings. If you want to use minted, you need to > +add the minted package to `org-latex-packages-alist', for example > using customize, or with I feel slightly confused about using the word "package" here. Which one refers to LaTeX package and which one to Emacs? I would state "Emacs package" explicitly to highlight contrast with "LaTeX package". > +(defcustom org-latex-engraved-preamble > + "\\usepackage{fvextra} > + > +[FVEXTRA-SETUP] > + > +\\renewcommand\\theFancyVerbLine{\\footnotesize\\color{black!40!white}\\arabic{FancyVerbLine}} I'd like to see a comment on what it does. > +\\usepackage{xcolor} > + > +\\providecolor{codebackground}{HTML}{f7f7f7} > +\\providecolor{codeborder}{HTML}{f0f0f0} > +\\providecolor{EFD}{HTML}{28292e} > + > +% TODO have code boxes keep line vertical alignment > +\\usepackage[breakable,xparse]{tcolorbox} > +\\DeclareTColorBox[]{Code}{o}% Same request to provide a comment. Also, what it that % TODO doing there? It is confusing. Also, it is unclear what the [breakable,xparse] options to tcolorbox are doing there and what will happen if the user removes them. Further, I am wondering what is going to happen if the user happens to have tcolorbox without options loaded via org-latex-packages-alist. > +There is quite a lot of flexibility in what this preamble can be, as long as it: > +- Loads the fvextra package. > +- Loads the package xcolor (if it is not already loader elsewhere). > +- Defines a \"Code\" environment (note the capital C), which can be > + later used to wrap \"Verbatim\" environments (provided by fvextra). The last point is not very clear. What kind of environment? > +(defun org-latex-generate-engraved-preamble (info syntax-colours-p) > + "Generate the preamble to setup engraved code. > +The result is constructed from `org-latex-engraved-preamble' and > +`org-latex-engraved-options'." This is relying on (:latex-engraved-options nil nil org-latex-engraved-options) (:latex-engraved-preamble nil nil org-latex-engraved-preamble) If it changes any time in future (e.g. to allow per-file settings), the docstring may be overlooked. > + (let ((src-p (org-element-map (plist-get info :parse-tree) > + '(src-block inline-src-block) #'identity)) > + (fixedw-p > + (org-element-map (plist-get info :parse-tree) > + '(example-block fixed-width) #'identity))) I'd use FIRST-MATCH argument for org-element-map. It will be slightly faster on large buffers. > - (downcase org-lang))) > + (downcase lang))) I am not sure if this belongs to this patch. Please double check. > + (mapcar 'length > + (org-split-string (car code-info) > + "\n"))))) I am not sure how well it will work with e.g. Chinese characters in comments. Best, Ihor
next prev parent reply other threads:[~2022-05-07 5:17 UTC|newest] Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-04 15:59 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 2022-05-05 15:17 ` Timothy 2022-05-05 16:13 ` Timothy 2022-05-07 5:16 ` Ihor Radchenko [this message] 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=875ymhzzvq.fsf@localhost \ --to=yantar92@gmail.com \ --cc=danflscr@gmail.com \ --cc=emacs-orgmode@gnu.org \ --cc=mail@nicolasgoaziou.fr \ --cc=tecosaur@gmail.com \ --subject='Re: [PATCH] New LaTeX code export option: engraved' \ /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).