emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: emacs-org list <emacs-orgmode@gnu.org>
Subject: [PATCH] ox-latex: Scale inlinetasks according to column width
Date: Fri, 31 Dec 2021 11:55:01 +0800	[thread overview]
Message-ID: <87k0fl1l9m.fsf@localhost> (raw)

[-- Attachment #1: Type: text/plain, Size: 214 bytes --]

Hi,

I recently had a need to export org into multi-column latex and noticed
that inlinetasks are exported into boxes that are wider than column
width. That looks ugly.

The attached patch fixes this.

Best,
Ihor


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-latex-Scale-inlinetasks-according-to-column-width.patch --]
[-- Type: text/x-diff, Size: 1264 bytes --]

From 40f6e9a4e66ca733f9be27097bfa6cc814868032 Mon Sep 17 00:00:00 2001
Message-Id: <40f6e9a4e66ca733f9be27097bfa6cc814868032.1640922780.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Fri, 31 Dec 2021 11:51:01 +0800
Subject: [PATCH] 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.
---
 lisp/ox-latex.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 32d29cc44..8f50c06f3 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2191,10 +2191,10 @@ (defun org-latex-format-inlinetask-default-function
 			    (mapcar #'org-latex--protect-text tags)))))))
     (concat "\\begin{center}\n"
 	    "\\fbox{\n"
-	    "\\begin{minipage}[c]{.6\\textwidth}\n"
+	    "\\begin{minipage}[c]{.6\\linewidth}\n"
 	    full-title "\n\n"
 	    (and (org-string-nw-p contents)
-		 (concat "\\rule[.8em]{\\textwidth}{2pt}\n\n" contents))
+		 (concat "\\rule[.8em]{\\linewidth}{2pt}\n\n" contents))
 	    "\\end{minipage}\n"
 	    "}\n"
 	    "\\end{center}")))
-- 
2.32.0


                 reply	other threads:[~2021-12-31  3:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=87k0fl1l9m.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: [PATCH] ox-latex: Scale inlinetasks according to column width' \
    /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).