emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "R. Michael Weylandt" <michael.weylandt@gmail.com>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: [PATCH] Empty inline tasks in latex export
Date: Thu, 15 May 2014 22:19:04 -0400	[thread overview]
Message-ID: <CAAmySGPU4RLvwUqzu=kWME5yvs1e7DVcY+2sLxXKHSQL6a7W+Q@mail.gmail.com> (raw)

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

If the body if the inline task is empty, org-latex-inlinetask writes
nil in the exported document. This patch skips including contents (and
the bar above it) if it's nil.

Michael

[-- Attachment #2: 0001-Handle-empty-tasks-without-printing-nil-in-org-latex.patch --]
[-- Type: application/octet-stream, Size: 1321 bytes --]

From ea2156ca9d6bfe1ec98cc767af8e2d7bc5a1442d Mon Sep 17 00:00:00 2001
From: Michael Weylandt <michael.weylandt@gmail.com>
Date: Thu, 15 May 2014 22:06:47 -0400
Subject: [PATCH] Handle empty tasks without printing nil in
 org-latex-inlinetask

* ox-latex.el (org-latex-inlinetask): Skip printing of task body if
  contents is nil

TINYCHANGE
---
 lisp/ox-latex.el | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index cea21be..7129efd 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1625,16 +1625,17 @@ holding contextual information."
 	       title
 	       (when tags (format "\\hfill{}\\textsc{:%s:}"
 				  (mapconcat 'identity tags ":"))))))
-	 (format (concat "\\begin{center}\n"
-			 "\\fbox{\n"
-			 "\\begin{minipage}[c]{.6\\textwidth}\n"
-			 "%s\n\n"
-			 "\\rule[.8em]{\\textwidth}{2pt}\n\n"
-			 "%s"
-			 "\\end{minipage}\n"
-			 "}\n"
-			 "\\end{center}")
-		 full-title contents))))))
+	 (concat "\\begin{center}\n"
+		 "\\fbox{\n"
+		 "\\begin{minipage}[c]{.6\\textwidth}\n"
+		 (format "%s\n\n" full-title)
+		 (if contents
+		     (format "\\rule[.8em]{\\textwidth}{2pt}\n\n%s"
+			     contents))		 
+		 "\\end{minipage}\n"
+		 "}\n"
+		 "\\end{center}"))))))
+		 
 
 
 ;;;; Italic
-- 
1.8.3.4 (Apple Git-47)


             reply	other threads:[~2014-05-16  2:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16  2:19 R. Michael Weylandt [this message]
2014-05-16  8:39 ` [PATCH] Empty inline tasks in latex export Nicolas Goaziou
2014-05-16 13:03   ` Michael Weylandt

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='CAAmySGPU4RLvwUqzu=kWME5yvs1e7DVcY+2sLxXKHSQL6a7W+Q@mail.gmail.com' \
    --to=michael.weylandt@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).