emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] ox-latex and small caps links


From: Rasmus
Subject: Re: [O] ox-latex and small caps links
Date: Wed, 22 Apr 2015 11:08:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Hi,

David Dynerman <address@hidden> writes:

> I've been using links to render text in small caps when exporting to
> LaTeX and HTML, e.g.
>
> [[latex:textsc][this is in small caps]]
>
> This worked fine in 8.2.10, but causes an error in latest. When I try to
> export the file to LaTeX, the export fails with:
>
> Unable to resolve link latex:textsc

Perhaps you did not add the latex link type.  You could also use a macro.

I use the following hack, which (tries to) captures words like ThIs, THIS,
or thIS and export is as \textsc{t}h\textsc{i}s, \textsc{this}, or
th\textsc{is}.  It won't manage e.g. (i).

For html you need to add support for a small-caps class.

  (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}"
                         "<span class=\"small-caps\">%s</span>")))
          (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)

I have also found the slantsc latex package useful for emphases with small
caps.

Here's what I have used for small caps in css.

   body {
       font-family: "Linux Libertine";
       -moz-font-feature-settings:"onum" 1, "kern" 1, "liga" 1;
       -moz-font-feature-settings:"onum=1, kern=1, liga=1";
       -ms-font-feature-settings:"onum" 1, "kern" 1, "liga" 1;
       -o-font-feature-settings:"onum" 1, "kern" 1, "liga" 1;
       -webkit-font-feature-settings:"onum" 1, "kern" 1, "liga" 1;
       font-feature-settings:"onum" 1, "kern" 1, "liga" 1;}

   .small-caps {
       -ms-font-feature-settings: "smcp";
       -moz-font-feature-settings: "smcp";
       -webkit-font-feature-settings: "smcp";
       font-feature-settings: "smcp";
       letter-spacing:.02em;
       font-variant-caps: small-caps;
       text-transform: lowercase;}

Hope it helps,
Rasmus

-- 
I hear there's rumors on the, uh, Internets. . .




reply via email to

[Prev in Thread] Current Thread [Next in Thread]