From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: small caps Date: Thu, 29 Oct 2015 21:37:28 +0100 Message-ID: <87mvv12yyf.fsf@gmx.us> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zrtx7-0002ss-B1 for emacs-orgmode@gnu.org; Thu, 29 Oct 2015 16:37:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zrtx3-0007tX-AA for emacs-orgmode@gnu.org; Thu, 29 Oct 2015 16:37:41 -0400 Received: from plane.gmane.org ([80.91.229.3]:43589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zrtx2-0007se-T5 for emacs-orgmode@gnu.org; Thu, 29 Oct 2015 16:37:37 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Zrtwz-0002wV-V0 for emacs-orgmode@gnu.org; Thu, 29 Oct 2015 21:37:34 +0100 Received: from 46.166.188.221 ([46.166.188.221]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 29 Oct 2015 21:37:33 +0100 Received: from rasmus by 46.166.188.221 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 29 Oct 2015 21:37:33 +0100 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 Matt Price writes: > do we have a syntax for the "small caps" text attribute in Org? If not, > should we? It is available in odt, html, and latex, and is used in some I use the following filter(s) (second one is not essential). Example input: CO_2 fOO Fo1O /FoO/ Example output: \textsc{co}\(_{\text{2}}\) f\textsc{oo} \textsc{f}o1\textsc{o} \emph{\textsc{f}o\textsc{o}} For emph to play nice with textsc in latex use the slantsc package. (defun rasmus/org-guess-textsc (content backend info) "Automatically downcase and wrap all-caps words in textsc. The function is a bit slow... TODO: Make the function work with headlines, but without doing it on subsequent text. TODO: Add ODT support." (if (org-export-derived-backend-p backend 'latex 'html) (let* (case-fold-search (latexp (org-export-derived-backend-p backend 'latex)) (wrap (if latexp "\\textsc{%s}" "%s"))) (replace-regexp-in-string "\\w+" (lambda (str) (if (or (string-equal str (downcase str)) (string-equal str (capitalize str))) str (replace-regexp-in-string "[[:upper:]]+" (lambda (x) (format wrap (downcase x))) str t t))) content t t)) content)) (add-to-list 'org-export-filter-plain-text-functions 'rasmus/org-guess-textsc) (defun rasmus/org-guess-textsc-html-cleanup-title (content backend info) (when (org-export-derived-backend-p backend 'html) (replace-regexp-in-string "\\(.*\\)" (lambda (str0) (format "%s" (replace-regexp-in-string "\\(.*?\\)" (lambda (str) (upcase (match-string 1 str))) (match-string 1 str0)))) content))) -- ⠠⠵