From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Hofer Subject: Re: [PATCH] latex export - title placement Date: Sat, 28 May 2011 14:59:56 +0200 Message-ID: <87vcwvdlpv.wl%sebhofer@gmail.com> References: <87wrhbdmjk.wl%sebhofer@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="Multipart_Sat_May_28_14:59:56_2011-1" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:43651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQJ7u-00088S-No for emacs-orgmode@gnu.org; Sat, 28 May 2011 09:00:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QQJ7t-0005I0-C3 for emacs-orgmode@gnu.org; Sat, 28 May 2011 09:00:22 -0400 Received: from lo.gmane.org ([80.91.229.12]:44487) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQJ7t-0005Ha-2D for emacs-orgmode@gnu.org; Sat, 28 May 2011 09:00:21 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QQJ7q-0003c0-Hw for emacs-orgmode@gnu.org; Sat, 28 May 2011 15:00:18 +0200 Received: from ahgate1.aei.uni-hannover.de ([130.75.117.49]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 28 May 2011 15:00:18 +0200 Received: from sebhofer by ahgate1.aei.uni-hannover.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 28 May 2011 15:00:18 +0200 In-Reply-To: <87wrhbdmjk.wl%sebhofer@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --Multipart_Sat_May_28_14:59:56_2011-1 Content-Type: text/plain; charset=US-ASCII I just now saw the FAQ entry on sending patches, sorry for that! I'm reposting the patch with the proper mime-type. Hope it's correct this time! Sebastian --Multipart_Sat_May_28_14:59:56_2011-1 Content-Type: text/plain; type=patch; charset=US-ASCII Content-Disposition: attachment; filename="org-patch.diff" Content-Transfer-Encoding: 7bit diff --git a/lisp/org-exp.el b/lisp/org-exp.el index d6ed193..e8086a6 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -618,6 +618,8 @@ table.el tables." (defvar org-min-level nil) ; dynamically scoped variable (defvar org-levels-open nil) ; dynamically scoped parameter +;; patched +;; Time-stamp: <2011-05-27 19:12:11 c705264> (defconst org-export-plist-vars '((:link-up nil org-export-html-link-up) (:link-home nil org-export-html-link-home) @@ -672,7 +674,13 @@ table.el tables." (:select-tags nil org-export-select-tags) (:exclude-tags nil org-export-exclude-tags) - (:latex-image-options nil org-export-latex-image-default-option)) + (:latex-image-options nil org-export-latex-image-default-option) + (:latex-title-position "tpos" org-export-latex-title-position) + (:latex-with-author "wauth" org-export-latex-with-author) + (:latex-with-date "wdate" org-export-latex-with-date) + (:latex-with-title "wtitle" org-export-latex-with-title) + (:latex-with-maketitle "wmtitle" org-export-latex-with-maketitle) + ) "List of properties that represent export/publishing variables. Each element is a list of 3 items: 1. The property that is used internally, and also for org-publish-project-alist diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 764a48d..c2dc8df 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -78,6 +78,26 @@ ;;; User variables: +;; begin patched +;; Time-stamp: <2011-05-27 18:31:51 c705264> + +(defvar org-export-latex-title-position "b" + "Determines if \\title, \\author, \\email and \\date commands are inserted before (default) or + after (\"a\") \\begin{document}.") + +(defvar org-export-latex-with-maketitle t + "Determines if \\maketitle is inserted") + +(defvar org-export-latex-with-author t + "Determines if \\author is inserted") + +(defvar org-export-latex-with-date t + "Determines if \\date is inserted") + +(defvar org-export-latex-with-title t + "Determines if \\title is inserted") +;; end patched + (defgroup org-export-latex nil "Options for exporting Org-mode files to LaTeX." :tag "Org Export LaTeX" @@ -1334,6 +1354,8 @@ LEVEL indicates the default depth for export." "The function formatting returning the string to create the table of contents. The function mus take one parameter, the depth of the table of contents.") +;; patched +;; Time-stamp: <2011-05-27 19:06:33 c705264> (defun org-export-latex-make-header (title opt-plist) "Make the LaTeX header and return it as a string. TITLE is the current title from the buffer or region. @@ -1344,7 +1366,12 @@ OPT-PLIST is the options plist for current buffer." (email (replace-regexp-in-string "_" "\\\\_" (org-export-apply-macros-in-string - (plist-get opt-plist :email))))) + (plist-get opt-plist :email)))) + (title-position (plist-get opt-plist :latex-title-position)) + (with-author (plist-get opt-plist :latex-with-author)) + (with-date (plist-get opt-plist :latex-with-date)) + (with-title (plist-get opt-plist :latex-with-title)) + (with-maketitle (plist-get opt-plist :latex-with-maketitle))) (concat (if (plist-get opt-plist :time-stamp-file) (format-time-string "%% Created %Y-%m-%d %a %H:%M\n")) @@ -1359,33 +1386,43 @@ OPT-PLIST is the options plist for current buffer." (org-export-apply-macros-in-string org-export-latex-append-header) ;; define alert if not yet defined "\n\\providecommand{\\alert}[1]{\\textbf{#1}}" + "\n\n" + ;; beginning of the document (title after \begin{document}) + (when (not (string= "b" title-position)) + "\n\\begin{document}\n\n") ;; insert the title - (format - "\n\n\\title{%s}\n" - (org-export-latex-fontify-headline title)) + (when with-title + (format + "\\title{%s}\n" + (org-export-latex-fontify-headline title))) ;; insert author info - (if (plist-get opt-plist :author-info) - (format "\\author{%s%s}\n" - (org-export-latex-fontify-headline (or author user-full-name)) - (if (and (plist-get opt-plist :email-info) email - (string-match "\\S-" email)) - (format "\\thanks{%s}" email) - "")) - (format "%%\\author{%s}\n" - (org-export-latex-fontify-headline (or author user-full-name)))) + (when with-author + (if (plist-get opt-plist :author-info) + (format "\\author{%s%s}\n" + (org-export-latex-fontify-headline (or author user-full-name)) + (if (and (plist-get opt-plist :email-info) email + (string-match "\\S-" email)) + (format "\\thanks{%s}" email) + "")) + (format "%%\\author{%s}\n" + (org-export-latex-fontify-headline (or author user-full-name))))) ;; insert the date - (format "\\date{%s}\n" - (format-time-string - (or (plist-get opt-plist :date) - org-export-latex-date-format))) - ;; beginning of the document - "\n\\begin{document}\n\n" + (when with-date + (format "\\date{%s}\n" + (format-time-string + (or (plist-get opt-plist :date) + org-export-latex-date-format)))) + ;; insert the title command - (when (string-match "\\S-" title) + (when (and (string-match "\\S-" title) with-maketitle) + "\n\n" (if (string-match "%s" org-export-latex-title-command) (format org-export-latex-title-command title) org-export-latex-title-command)) "\n\n" + ;; beginning of the document (maketitle before \begin{document}) + (when (string= "b" title-position) + "\n\\begin{document}\n\n") ;; table of contents (when (and org-export-with-toc (plist-get opt-plist :section-numbers)) --Multipart_Sat_May_28_14:59:56_2011-1--