Commit Graph

459 Commits

Author SHA1 Message Date
Ihor Radchenko 8f59e8d93f
Fix native-comp warnings
* lisp/org-fold.el (org-fold-show-set-visibility--text-properties):
Resolve unused variable warning.

* lisp/ob-core.el (org-attach-dir):
* lisp/ob-latex.el (org-at-heading-p):
(org-back-to-heading):
(org-next-visible-heading):
* lisp/org.el (org-agenda-todo-yesterday):
* lisp/ox-ascii.el (org-at-heading-p):
(org-back-to-heading):
(org-next-visible-heading):
* lisp/ox-html.el (org-at-heading-p):
(org-back-to-heading):
(org-next-visible-heading):
* lisp/ox-icalendar.el (org-at-heading-p):
(org-back-to-heading):
(org-next-visible-heading):
* lisp/ox-latex.el (engrave-faces-latex-gen-preamble-line):
(engrave-faces-get-theme):
(engrave-faces-latex-output-style):
(engrave-faces-current-preset-style):
(engrave-faces-latex-mathescape):
* lisp/ox-odt.el (org-at-heading-p):
(org-back-to-heading):
(org-next-visible-heading):
* lisp/ox-publish.el (org-at-heading-p):
(org-back-to-heading):
(org-next-visible-heading):
* lisp/ox.el (org-at-heading-p):
(org-back-to-heading):
(org-next-visible-heading): Add declarations.
2022-06-16 13:19:10 +08:00
Ihor Radchenko d37e4dc0f2
ox-latex: Scale inlinetasks according to column width
* lisp/ox-latex.el (org-latex-format-inlinetask-default-function): Set
inlinetask box width relative to \linewidth in current column.  Using
\textwidth scales the box wider than column in multi-column documents.
2022-05-29 18:06:12 +08:00
Ihor Radchenko 2cb4f46fec
org-latex-compile: Add commentary on fallback compiler command
* lisp/ox-latex.el (org-latex-compile): Clarify when "pdflatex"
constant is used as a fallback.
2022-05-22 11:43:38 +08:00
TEC 5766ddd758
ox-latex: Prefix lst: to source block labels
* lisp/ox-latex.el (org-latex--label): Use the "lst:" prefix when
generating source block labels ("lst" contracted from "listing").
2022-05-13 00:43:18 +08:00
TEC faa5c1887c
ox-latex: Support mathescape'd code with engraved
* lisp/ox-latex.el (org-latex-src-block--engraved,
org-latex-src--engrave-mathescape-p): Using the mathescape functionality
in engrave-faces-latex v0.3.1, we can support the mathescape option of
fvextra well.  Along the way, we fix a minor issue with the localoptions
list in `org-latex-src-block--engraved`.
2022-05-13 00:43:17 +08:00
TEC af4ca40eae
ox-latex: Fix %-captions in minted/engraved code
* lisp/ox-latex.el (org-latex-src-block--engraved,
org-latex-src-block--minted): Refactor float-env to be clearer, and
switch from `format' to `concat' to fix the bug where %-chars in
captions are interpreted as a format specifier.
2022-05-13 00:43:17 +08:00
TEC 4d5805755c
ox-latex: Support setting engraved theme per-block
* lisp/ox-latex.el (org-latex-src-block--engraved,
org-latex-src--engrave-code, org-latex-inline-src-block--engraved,
org-latex-generate-engraved-preamble): Allow for the engraved theme used
to be set on a per-src-block basis with #+attr_latex: :engraved-theme
THEME.  Extra setup code is now generated in
`org-latex-generate-engraved-preamble'.  To facilitate the application
of themes to src blocks, `org-latex-src--engrave-code' now takes on a
larger portion of the transcoding work.
2022-05-13 00:43:17 +08:00
TEC a16e208938
ox-latex: Support setting the engraved theme
* lisp/ox-latex.el (org-latex-generate-engraved-preamble,
org-latex-engraved-theme): Introduce the new export keyword
LATEX_ENGRAVED_THEME with default value given by
`org-latex-engraved-theme'.  This is used to set the engraved theme used
in org-latex-engraved-theme.

This bumps the minimum required version of engrave-faces from v0.2 to
v0.3.
2022-05-13 00:43:17 +08:00
TEC b4e4b3c502
ox-latex: Replace `org-latex-listings'
* lisp/ox-latex.el (org-latex-src-block, org-latex-keyword,
org-latex-inline-src-block, org-latex-template,
org-latex--caption/label-string, org-latex-engraved-preamble,
org-latex-listings): Replace `org-latex-listings' with
`org-latex-src-block-backend', which now can be set to listings/verbatim
and no longer advertises t/nil as valid values.

* lisp/ox-beamer.el (org-beamer-template): Update in the same manner as
`org-latex-template'.

* lisp/org-compat.el: Make `org-latex-listings' an obsolete alias for
`org-latex-src-block-backend'.

* testing/lisp/test-ox.el: Replace `org-latex-listings' reference with
`org-latex-src-block-backend'.

* doc/org-manual.org (Footnotes, LaTeX specific properties, Literal
Examples): Replace references to `org-latex-listings' with
`org-latex-src-block-backend'.

* etc/ORG-NEWS: Add a news entry noting this change.

The variable `org-latex-listings' originally indicated whether source
blocks should use the listings LaTeX package, or not.  This usage has
evolved over the years, and now it sets one of four different
fontification backends.  This renaming should make the variable name a
bit less misleading.
2022-05-13 00:43:17 +08:00
TEC e07b89c31c
ox-latex: Refactor source block transcode fun sigs
* lisp/ox-latex.el (org-latex-src-block--listings,
org-latex-src-block--engraved, org-latex-src-block--minted,
org-latex-src-block--custom): Refactor these --backend functions to use
cl-defun with keys instead of having an 11-argument signature.
(org-latex-src-block): Adjust for the change in signature of the
--backend functions, and refactor the `cond' statement to use `pcase'.
2022-05-13 00:43:17 +08:00
TEC bbba45a07f
ox-latex: Don't use `length' to get string width
* lisp/ox-latex.el (org-latex-src-block--listings,
org-latex-src-block--engraved, org-latex-src-block--minted): Use
`string-width' instead of `length' to gauge the displayed width of the
string in LaTeX.  This may not be a perfect match, but it should be an
improvement.
2022-05-13 00:43:17 +08:00
TEC d30738b786
ox-latex: Introduce "engraved" code highlighting
* lisp/ox-latex.el (org-latex-src-block, org-latex-src-block--engraved,
org-latex-inline-src-block, org-latex-inline-src-block--engraved,
org-latex-src--engrave-code, org-latex-template, org-latex-listings):
Make use of the engraved-faces package (available on ELPA) to provide an
alternative LaTeX code highlighting backend which functions similarly to
htmlize.el for HTML exports.

(org-latex-engraved-preamble, org-latex-engraved-options): Introduce
variables to construct the preamble for engraved code blocks.

* lisp/ox-beamer.el (org-beamer-template): Modify to add engrave-faces
preamble when applicable.
2022-05-13 00:43:17 +08:00
TEC ca91473639
ox-latex: More versitile option construction
* lisp/ox-latex.el (org-latex--make-option-string): Support a custom
option seperator string.

(org-latex--make-option-string, org-latex-minted-options,
org-latex-listings-options): The first line of the docstrings for
`org-latex-minted-options` and `org-latex-listings-options` describe the
variables as "association lists", yet `org-latex--make-option-string`
does not handle association lists and an example of two-value lists is
provided.  To make the behaviour match the docstring,
`org-latex--make-option-string` is modified to work with either a list
two-value lists or an association list, and the examples in
`org-latex-minted-options` and `org-latex-listings-options` updated
accordingly.
2022-05-13 00:43:17 +08:00
TEC 40c559ac3d
ox-latex: Refactor `org-latex-inline-src-block'
* lisp/ox-latex.el (org-latex-inline-src-block,
org-latex-inline-src-block--minted,
org-latex-inline-src-block--listings): Extract the minted and listings
specific logic out of `org-latex-inline-src-block` into the new
functions `org-latex-inline-src-block--minted` and
`org-latex-inline-src-block--listings`.
2022-05-13 00:43:17 +08:00
TEC 61d85bcdb3
ox-latex: Refactor `org-latex-src-block'
* lisp/ox-latex.el (org-latex-src-block): Extract the per-format logic
from `org-latex-src-block' into new dedicated functions:
+ `org-latex-src-block--verbatim'
+ `org-latex-src-block--custom'
+ `org-latex-src-block--minted'
+ `org-latex-src-block--listings'
This makes `org-latex-src-block' much less monolithic, taking it from
175 lines to 30, and I find also makes it easier to understand.
2022-05-13 00:43:17 +08:00
Bastien 81289bddee lisp/ox-latex.el: Add Daniel Fleischer as the maintainer 2022-04-20 08:32:46 +02:00
Juan Manuel Macias 1291e89d2d ox-latex: Add a `t' value for `:float' in tables and figures
* org-latex--inline-image: default `figure' environment
* org-latex--decorate-table: default table environment
* doc/org-manual.org (Tables in LaTeX export): add `t' and arbitrary
`:float' values
* doc/org-manual.org (Images in LaTeX export): add `t' and arbitrary
`:float' values
2022-02-22 20:10:58 +01:00
TEC 6ee45518f3
ox: Add link localisation feature using persist
* lisp/ox.el (org-export-link-remote-p): A new function to determine
whether a link refers to a remote resource.
(org-export-link--remote-local-copy): Download and return the local
location of a remote resource link.
(org-export-link-localise): Transform remote links to refer to a local
copy of the resource.

* lisp/ox-latex.el (org-latex-link, org-latex-inline-image-rules): Make
use of the new functions for remote resources in ox.el to support
embedding https and tramp -linked files.
2022-01-31 19:37:39 +08:00
Kyle Meyer aae2ac3a68 Merge branch 'bugfix' 2022-01-01 15:21:37 -05:00
Kyle Meyer 5a229cbc44 Update copyright year to 2022 2022-01-01 15:17:08 -05:00
Nicolas Goaziou 5e35de34a6 Merge branch 'bugfix' 2021-11-28 20:44:44 +01:00
Rasmus c91271297d ox-latex: Fix asynchronous export
* lisp/ox-latex.el (org-latex-export-to-pdf): Fix "invalid-read-syntax
'#'" when exporting asynchronously with ox-latex.

See also previous bug report: https://lists.gnu.org/archive/html/emacs-orgmode/2021-06/msg00422.html
2021-11-28 20:44:22 +01:00
Juan Manuel Macías 85998490d9 ox-latex: add `options' latex attribute to tables
* lisp/ox-latex.el (org-latex--org-table): The `:options' LaTeX
attribute allows adding an optional argument (`\begin{env}[opt]'),
since certain tabular environments, such as `longtblr', accept optional
arguments.
* doc/org-manual.org (Tables in LaTeX export): this feature in the manual.
* etc/ORG-NEWS (New :options attribute when exporting tables to
LaTeX): this feature in `ORG-NEWS'.
2021-11-06 14:50:27 +01:00
Glenn Morris c3e8709e2d Backport commit f9111d878 from Emacs
* lisp/oc-basic.el (org-cite-basic-sorting-field)
(org-cite-basic-author-year-separator)
(org-cite-basic-max-key-distance)
(org-cite-basic-author-column-end)
(org-cite-basic-column-separator)
(org-cite-basic-mouse-over-key-face):
* lisp/oc-biblatex.el (org-cite-biblatex-options):
* lisp/oc-csl.el (org-cite-csl-link-cites)
(org-cite-csl-html-hanging-indent)
(org-cite-csl-html-label-width-per-char)
(org-cite-csl-latex-hanging-indent):
* lisp/oc.el (org-cite-adjust-note-numbers):
* lisp/org-keys.el (org-return-follows-link):
* lisp/org.el (org-fontify-todo-headline):
* lisp/ox-html.el (org-html-equation-reference-format)
(org-html-wrap-src-lines):
* lisp/ox-latex.el (org-latex-reference-command)
(org-latex-default-quote-environment): Fix :safe property.

The safe-local-variable property is a function (bug#50944)
f9111d8784bf12263abbe127cdfcbe5f409c9b3b
Glenn Morris
Sat Oct 2 10:37:42 2021 -0700
2021-10-02 13:44:34 -04:00
Bastien 806ac1b7f6 *el: Fix indentation 2021-09-29 09:22:47 +02:00
Bastien 777c1c3cb5 Merge branch 'bugfix' 2021-09-25 18:02:19 +02:00
Max Nikulin ec7c16a060 ox-latex: Allow percent sign in 'src-block' caption
* lisp/ox-latex.el (org-latex-src-block): Prevent leak of percent sign
from caption to `format' first argument causing export failure due to
insufficient argument number.  The fix covers only the case of verbatim
environment.
* testing/lisp/test-ox.el
(test-org-export/latex-src-block-verbatim-caption): New test for src
block LaTeX export with cases of various formatting of caption and
verbatim environment.  Check that percent signs in caption and source
block body do not lead to errors.

Reported-by: Charest, Luc <charest.luc@hydroquebec.com>
<https://lists.gnu.org/archive/html/emacs-orgmode/2021-08/msg00017.html>
2021-09-25 18:02:08 +02:00
Stefan Kangas 51cdd6e30f Various minor docfixes found by checkdoc 2021-09-16 21:24:59 +02:00
Nicolas Goaziou 229b018b60 ox-latex: Do not duplicate \texttt on inline source blocks
* lisp/ox-latex.el (org-latex-inline-src-block): When
`org-latex-listings' is nil, simply translate source block as code,
without adding an additional \texttt command.

Reported-by: Maxim Nikulin <manikulin@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-07/msg00489.html>
2021-07-27 21:59:43 +02:00
TEC 32739e35e3
ox-latex: Change default compiler to latexmk
* lisp/ox-latex.el (org-latex-pdf-process): Check for the presence of
latexmk when setting the default, and use it when available.  Fall back
to the current default.  This is important for the incoming citation
support, as PDF generation will now need to involve bibliography
generation.  By using latexmk this is taken care of for us.  The -%latex
part of the command is slightly hacky, but allows latexmk to behave more
intelligently for non-pdflatex options.  Note that latexmk also seems to
care about the order of the arguments.
2021-07-10 00:31:40 +08:00
Nicolas Goaziou 9aa304f957 ox-latex: Fix defcustom keywords.
* lisp/ox-latex.el (org-latex-reference-command): Do not provide
both :version and :package-version.  Add :safe keyword.
2021-06-13 22:28:10 +02:00
TEC f092cb30d9
ox-latex: Allow reference command to be customised
* lisp/ox-latex.el (org-latex-reference-command): Create a new variable
so the user may modify the reference command used.
(org-latex-link): Make use of the new `org-latex-reference-command' when
generating references for labels without a description (previously using
\ref).
(org-latex-prefer-user-labels): Mention the new
`org-latex-reference-command' when describing the generated LaTeX
referencing labels.
2021-06-10 01:37:00 +08:00
Markus Huber 54863e802f ox-latex: Surround option string with braces if it includes brackets
lisp/ox-latex.el (org-latex--make-option-string): If `value' of
a `pair' from `options' contains a bracket the whole `value' is
surrounded by braces.

In case of LaTeX export using listings the dialect of
a language (e.g. [LaTeX]TeX) is surrounded by brackets. For inline
source blocks all options end as optional argument to \lstinline
between brackets which breaks the LaTeX parser.

TINYCHANGE
2021-05-29 22:24:15 +02:00
Juan Manuel Macias f4aac6090d ox-latex: add LaTeX attributes to quote block
* doc/org-manual.org (Quote blocks in LaTeX export): manual updated
* etc/ORG-NEWS (Support quote blocks in LaTeX export): news updated
* lisp/ox-latex.el (latex): add `org-latex-default-quote-environment' to `:options-alist'
(org-latex-default-quote-environment): the default quote environment
is `quote'
(org-latex-quote-block): add two attributes: `environment' and `options'
2021-05-29 22:21:59 +02:00
Juan Manuel Macías 91373e15c8 ox-latex.el: Support specific attributes for verse block
* lisp/ox-latex.el (org-latex-verse-block): Support verse-specific
attributes.

* doc/org-manual.org (Verse blocks in LaTeX export): New section.

Link: https://orgmode.org/list/874kfdn0k5.fsf@posteo.net/
2021-05-15 16:13:49 +02:00
Thomas S. Dye ee40458d00 lisp/ox-latex.el: Allow arbitrary float environments
* lisp/ox-latex.el (org-latex--inline-image)
(org-latex--decorate-table): Recognize arbitrary :float value.

* etc/ORG-NEWS: Announce new :float capability.

LaTeX users are able to define arbitrary float types.
This patch makes them accessible from Org mode.
2021-05-15 16:13:49 +02:00
Nicolas Goaziou 196aae41c5 Merge branch 'maint' 2021-04-06 13:50:46 +02:00
Nicolas Goaziou 7575678959 ox-latex: Fix texttt usage in headlines
* lisp/ox-latex.el (org-latex-headline): Properly call
`org-latex--protect-texttt' on verbatim objects.

Reported-by: Greg Minshall <minshall@umich.edu>
<http://lists.gnu.org/r/emacs-orgmode/2021-04/msg00134.html>
2021-04-06 13:47:04 +02:00
Nicolas Goaziou c881b60593 Merge branch 'maint' 2021-04-04 00:18:04 +02:00
TEC bcfe6f985c ox-latex: convert verbatim text in headings to texttt
* lisp/ox-latex.el (org-latex--protect-texttt): New function.
(org-latex--text-markup): Use new function.
(org-latex-headline): Convert any instances of \verb text with
\texttt.  This is required to work around LaTeX peculiarities that
would otherwise cause compilation to fail (see the code comment for
more information).
2021-04-04 00:16:42 +02:00
Stefan Kangas 2e1c984153 Prefer HTTPS to HTTP in most links 2021-03-21 15:21:22 -04:00
Kyle Meyer bc511b1cb8 Merge branch 'maint' 2021-01-24 23:12:33 -05:00
Basile Pesin 0abd4a44cb ox-latex.el: Use [Objective]Caml dialect
* ox-latex.el (org-latex-listings-langs): Change the binding for
  `ocaml' to "[Objective]Caml"

The "[Objective]Caml" dialect syntax highlighting is different from the
"Caml" one (reflecting the added features of OCaml compared to
Caml-light).

TINYCHANGE
2021-01-24 23:05:53 -05:00
Kyle Meyer 72e368a2e9 Merge branch 'maint' 2021-01-24 22:17:01 -05:00
Tara Lorenz 13e98e2a13 ox-latex.el: fix interpretation of org-latex-pdf-process
* ox-latex.el (org-latex-export-to-pdf):  The documentation for
`org-latex-pdf-process' states that "%bib" will be expanded into the
current binding of `org-latex-bibtex-compiler'.  However, the
`org-latex-export-to-pdf', where the expansion takes place, expects
"%bibtex" instead.  This fix will accept "%bib" as well as "%bibtex"
as markers for `org-latex-bib-compiler'.

This fixes a regression from f6187deca (ox-latex: Small refactor,
2015-09-13).

TINYCHANGE
2021-01-24 22:16:45 -05:00
Kyle Meyer 291993888d Merge branch 'maint' 2021-01-01 15:02:10 -05:00
Kyle Meyer 99eafe3787 Update copyright year to 2021 2021-01-01 14:59:01 -05:00
Nicolas Goaziou 7c8dce72bd ox-latex: Improve handling of footnotes within verse blocks
* lisp/ox-latex.el (org-latex-footnote-reference): Use the footmark +
footnotetext combination for footnotes in verse environments.
(org-latex-verse-block): Use `org-latex--delayed-footnotes-definitions'.

Reported-by: Juan Manuel Macías <maciaschain@posteo.net>
<http://lists.gnu.org/r/emacs-orgmode/2020-12/msg00006.html>
2020-12-05 10:05:46 +01:00
Nicolas Goaziou f4687993c5 ox-latex: Fix links to files with name matching an image type
* lisp/ox-latex.el (org-latex-inline-image-rules): Ensure
caracterization happens on extension only.
2020-08-16 12:01:20 +02:00
Nicolas Goaziou d391364ac9 Merge branch 'maint' 2020-06-01 15:16:01 +02:00