Re: caption width in LateX export
On Mon, 27 Dec 2021 13:28:08 +, Juan Manuel Macías wrote: > Sebastian P. Luque writes: >> Thank you, Juan. Unfortunately, there is a price for this solution >> as it is now impossible to name and refer to this segment as usual: > I see. Have you tried the option with LuaTeX that I put in my other > message? You can compile with LuaTeX also using latexmk: > (setq org-latex-pdf-process '("latexmk -lualatex -e > '$lualatex=q/lualatex %%O -shell-escape %%S/' %f")) I haven't tried this yet, but it's great to know latexmk can use LuaTex. > In any case, since this is a simple substitution, you can use also a > function in Elisp as a final output filter[1]: > #+BIND: org-export-filter-final-output-functions (caption-auto-width) > #+begin_src emacs-lisp :exports results :results none > (defun caption-auto-width (text backend info) (when > (org-export-derived-backend-p backend 'latex) (with-temp-buffer > (insert text) (save-excursion (goto-char (point-min)) (while > (re-search-forward "\\(includegraphics.+\\)" nil t) (replace-match > "sbox0{\\1}" t nil))) (save-excursion (goto-char (point-min)) > (while (re-search-forward "\\(caption.+\\)" nil t) (replace-match > "begin{minipage}{wd0}usebox0\\1end{minipage}" t nil))) > (setq text (buffer-string) #+end_src > Vid. [[fig:1]] > #+NAME: fig:1 #+CAPTION: Lorem ipsum dolor sit amet, consectetuer > adipiscing elit. Donec hendrerit tempor tellus. Donec pretium posuere > tellus > #+ATTR_LaTeX: :width .3\linewidth [[my-image.jpg]] > [1] You need to set this variable as non-nil, in order to use bind > keywords: (setq org-export-allow-bind-keywords t) > Hope this works, This is great, and very interesting to learn about the BIND keyword. Thank you, -- Seb
Re: caption width in LateX export
On Mon, 27 Dec 2021 07:41:59 +, Juan Manuel Macías wrote: [...] > If you use the caption package (https://www.ctan.org/pkg/caption), you > can indicate in each figure the width of the caption. In this case, > you would have to introduce the code using raw latex via the > `:caption' property: > #+LaTeX_Header: \usepackage{caption} > #+ATTR_LaTeX: :caption \captionsetup{width=.3\linewidth}\caption{Lorem > ipsum dolor sit amet, consectetuer adipiscing elit} #+ATTR_LaTeX: > :width .3\linewidth [[file_path]] Thank you, Juan. Unfortunately, there is a price for this solution as it is now impossible to name and refer to this segment as usual: #+LATEX_HEADER: \usepackage{caption} See [[fig1]]. #+NAME: fig1 #+ATTR_LATEX: :caption \captionsetup{width=0.5\textwidth}\caption{Lorem ipsum dolor sit amet, consectetuer adipiscing elit} [[file_path]] leads to this (I compile with latexmk): Latexmk: Summary of warnings from last run of *latex: Latex failed to resolve 1 reference(s) -- Seb
Re: [O] indentation error in python source block
On Sat, 10 Nov 2018 08:30:50 +0100, Nicolas Goaziou wrote: [...] > I cannot reproduce your error. You may want to upgrade Org. I'm already using the latest Org from Elpa (9.1.14), and get the error with: $ emacs -q -l emacs_pkg_init.el ╭─ [ emacs_pkg_init.el ] │ (setq package-archives │(quote │ (("gnu" . "http://elpa.gnu.org/packages/;) │ ("melpa" . "http://melpa.org/packages/;) │ ("marmalade" . "https://marmalade-repo.org/packages/;) │ ("org" . "http://orgmode.org/elpa/; │ (package-initialize) │ (org-babel-do-load-languages │ 'org-babel-load-languages │ '((python . t))) ╰─ -- Seb
Re: [O] Bug: Editing cookie in table column breaks tabbing [9.1.9 (9.1.9-3-gb1a639-elpa @ /home/foo/.emacs.d/elpa/org-20180402/)]
On Wed, 11 Apr 2018 13:17:49 +0200, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote: > Hello, "Sebastian P. Luque" <splu...@gmail.com> writes: >> When `org-startup-align-all-tables' is t, then editing the cookie >> in a table causes subsequent tabbing inside the table to throw the >> following trace: >> Debugger entered--Lisp error: (args-out-of-range #("abcde" 0 1 >> (help-echo "Clipped table field, use `\\[org-table-edit-field]' to >> edit. Full value is: > Could you provide an ECM? I couldn't reproduce the issue. Biensur: ╭─ [ emacs_init.el ] │ (package-initialize) │ (toggle-debug-on-error) │ (setq org-startup-align-all-tables t) ╰─ First line is to ensure the Elpa Org package is available. ╭─ [ bug.org ] │ * Column width alignment │ │ | A |B | C | │ | | | <5> | │ | 123 | 1234 | 56789 | ╰─ and then do: emacs -q -l emacs_init.el bug.org Now edit the column width cookie a few times, hitting TAB after each edit. I haven't yet found what sequence of edits that triggers the error in this example, as it seems inconsistent. I tried switching between different permutations of 2, 3, 4, 5, and eventually the debugger is entered. During normal use cases, I get into the error right away. -- Seb
[O] Bug: Editing cookie in table column breaks tabbing [9.1.9 (9.1.9-3-gb1a639-elpa @ /home/foo/.emacs.d/elpa/org-20180402/)]
Hello, When `org-startup-align-all-tables' is t, then editing the cookie in a table causes subsequent tabbing inside the table to throw the following trace: ------ Debugger entered--Lisp error: (args-out-of-range #("abcde" 0 1 (help-echo "Clipped table field, use `\\[org-table-edit-field]' to edit. Full value is: abcde" fontified t face org-table) 1 3 (help-echo "Clipped table field, use `\\[org-table-edit-field]' to edit. Full value is: abcde" fontified t face org-table) 3 5 (help-echo "Clipped table field, use `\\[org-table-edit-field]' to edit. Full value is: abcde" fontified t face org-table invisible org-cwidth)) 0 6) org-table-align() org-table-next-field() funcall-interactively(org-table-next-field) call-interactively(org-table-next-field) org-cycle(nil) funcall-interactively(org-cycle nil) call-interactively(org-cycle nil nil) command-execute(org-cycle) --- --- Emacs : GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.28) of 2018-02-19, modified by Debian Package: Org mode version 9.1.9 (9.1.9-3-gb1a639-elpa @ /home/foo/.emacs.d/elpa/org-20180402/) current state: == (setq org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate) org-occur-hook '(org-first-headline-recenter) org-metaup-hook '(org-babel-load-in-session-maybe) org-confirm-shell-link-function 'yes-or-no-p org-startup-align-all-tables t org-after-todo-state-change-hook '(org-clock-out-if-current) org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-agenda-before-write-hook '(org-agenda-add-entry-text) org-babel-pre-tangle-hook '(save-buffer) org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-block-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes) org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-archive-hook '(org-attach-archive-delete-maybe) org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-show-empty-lines org-optimize-window-after-visibility-change) org-confirm-elisp-link-function 'yes-or-no-p org-metadown-hook '(org-babel-pop-to-session-maybe) org-link-parameters '(("id" :follow org-id-open) ("rmail" :follow org-rmail-open :store org-rmail-store-link) ("mhe" :follow org-mhe-open :store org-mhe-store-link) ("irc" :follow org-irc-visit :store org-irc-store-link) ("info" :follow org-info-open :export org-info-export :store org-info-store-link) ("gnus" :follow org-gnus-open :store org-gnus-store-link) ("docview" :follow org-docview-open :export org-docview-export :store org-docview-store-link) ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link) ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link) ("w3m" :store org-w3m-store-link) ("file+sys") ("file+emacs") ("ipynb" :follow ein:org-open :help-echo "Open ipython notebook." :store ein:org-store-link) ("doi" :follow org--open-doi-link) ("elisp" :follow org--open-elisp-link) ("file" :complete org-file-complete-link) ("ftp" :follow (lambda (path) (browse-url (concat "ftp:" path ("help" :follow org--open-help-link) ("http" :follow (lambda (path) (browse-url (concat "http:" path ("https" :follow (lambda (path) (browse-url (concat "https:" path ("mailto" :follow (lambda (path) (browse-url (concat "mailto:; path ("news" :follow (lambda (path) (browse-url (concat "news:; path ("shell" :follow org--open-shell-link)) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) )
Re: [O] Python loops with ":results output"
On Tue, 21 Feb 2017 08:58:59 -0500, John Kitchinwrote: > On Mon, Feb 20, 2017 at 11:04 PM, Seb wrote: > #+BEGIN_SRC python :session :results output :exports results for i > in range(3): print("Iter {0}".format(i)) > #+END_SRC > Try using ob-ipython. It doesn't have that issue for me. Thank you; unfortunately, this seems to work with Jupyter/Ipython kernels running as a service, which adds quite an overhead to the workflow. -- Seb