From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Hennig Subject: Patch for latex export supporting nested emphasis Date: Fri, 20 Aug 2010 16:30:19 +0200 Message-ID: <4C6E917B.30004@freylax.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060308090007030406040905" Return-path: Received: from [140.186.70.92] (port=41363 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OmSc7-0007SW-1R for emacs-orgmode@gnu.org; Fri, 20 Aug 2010 10:30:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OmSc5-0002uF-It for emacs-orgmode@gnu.org; Fri, 20 Aug 2010 10:30:34 -0400 Received: from h1666135.stratoserver.net ([85.214.157.189]:59741) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmSc5-0002tM-Do for emacs-orgmode@gnu.org; Fri, 20 Aug 2010 10:30:33 -0400 Received: from localhost ([127.0.0.1]) by h1666135.stratoserver.net with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1OmSbw-0007Rr-UI for emacs-orgmode@gnu.org; Fri, 20 Aug 2010 16:30:25 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode This is a multi-part message in MIME format. --------------060308090007030406040905 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Dear Orgmode maintainers, I would like to provide a patch which allows nested emphasis for the latex export. The problem of handling nested emphasis was solved by applying the org-export-latex-fontify recursively. The example Now *you /can/ write* /nested/ */emphasis/ recursively!* will be translated to: Now \textbf{you \emph{can} write} \emph{nested} \textbf{\emph{emphasis} recursively!} Best regards, yours faithful Robert Hennig --------------060308090007030406040905 Content-Type: text/x-patch; name="org-latex.el.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="org-latex.el.diff" --- org-latex.el 2010-08-20 15:58:28.000000000 +0200 +++ org-latex.mod.el 2010-08-20 16:06:26.000000000 +0200 @@ -1795,8 +1795,24 @@ (defun org-export-latex-fontify () "Convert fontification to LaTeX." + ;; max recursive level set to 2, + ;; so one level of nested emphasis works + (org-export-latex-fontify-recursive 2) +) + +(defun org-export-latex-fontify-recursive (reclevel) + "Convert fontification to LaTeX, recursive part." (goto-char (point-min)) (while (re-search-forward org-emph-re nil t) + (if (> reclevel 1) + (let ((mdata (match-data))) + (unwind-protect + ;; now it is ok to change the original match data. + (save-excursion + (save-restriction + (narrow-to-region (match-beginning 4) (match-end 4)) + (org-export-latex-fontify-recursive (1- reclevel)))) + (set-match-data mdata)))) ;; The match goes one char after the *string*, except at the end of a line (let ((emph (assoc (match-string 3) org-export-latex-emphasis-alist)) --------------060308090007030406040905 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --------------060308090007030406040905--