* ox-latex and small caps links
@ 2015-04-22 0:59 David Dynerman
2015-04-22 1:27 ` Thomas S. Dye
2015-04-22 9:08 ` Rasmus
0 siblings, 2 replies; 5+ messages in thread
From: David Dynerman @ 2015-04-22 0:59 UTC (permalink / raw
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 485 bytes --]
Hi there,
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
Is this a bug? Is there a better way to render text in small caps? This
latex:XXXX trick in a link was the standard way to bracket text with any
latex command, right?
Thanks,
David
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 841 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ox-latex and small caps links
2015-04-22 0:59 ox-latex and small caps links David Dynerman
@ 2015-04-22 1:27 ` Thomas S. Dye
2015-04-22 1:41 ` David Dynerman
2015-04-22 9:08 ` Rasmus
1 sibling, 1 reply; 5+ messages in thread
From: Thomas S. Dye @ 2015-04-22 1:27 UTC (permalink / raw
To: David Dynerman; +Cc: emacs-orgmode
Aloha David,
David Dynerman <david@block-party.net> writes:
> This
> latex:XXXX trick in a link was the standard way to bracket text with any
> latex command, right?
The latex:XXXX link trick was invented for pre Org mode 8. AFAIK, it
should still work, but I haven't been paying full attention.
However, in the meantime a syntax for inline latex code has been
developed:
,---------------------------------------------
| Code within @@latex:some code@@ a paragraph.
`---------------------------------------------
This new syntax might prove to be more robust in the long run.
hth,
Tom
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ox-latex and small caps links
2015-04-22 1:27 ` Thomas S. Dye
@ 2015-04-22 1:41 ` David Dynerman
2015-04-22 2:59 ` Thomas S. Dye
0 siblings, 1 reply; 5+ messages in thread
From: David Dynerman @ 2015-04-22 1:41 UTC (permalink / raw
To: Thomas S. Dye; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 440 bytes --]
> ,---------------------------------------------
> | Code within @@latex:some code@@ a paragraph.
> `---------------------------------------------
This works great! Thanks Tom!
It might be nice to document this somehwere, to make the transition a
little easier when 8.3 rolls out and the old [[latex:textsc][Hello]]
links cause export errors.
I'd be happy to write something. Where would a good place be? The NEWS
file? The wiki?
David
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 841 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ox-latex and small caps links
2015-04-22 1:41 ` David Dynerman
@ 2015-04-22 2:59 ` Thomas S. Dye
0 siblings, 0 replies; 5+ messages in thread
From: Thomas S. Dye @ 2015-04-22 2:59 UTC (permalink / raw
To: David Dynerman; +Cc: emacs-orgmode
Aloha David,
David Dynerman <david@block-party.net> writes:
>> ,---------------------------------------------
>> | Code within @@latex:some code@@ a paragraph.
>> `---------------------------------------------
>
> This works great! Thanks Tom!
Good news.
> It might be nice to document this somehwere, to make the transition a
> little easier when 8.3 rolls out and the old [[latex:textsc][Hello]]
> links cause export errors.
I just tested the latex link type and it seems to work fine here with a
recent Org mode from master.
I executed the source code block and then exported the following buffer
to LaTeX.
,------------------------------------------------------------------------------
| #+LATEX_CLASS: article
| #+DATE: \today
|
| * Test link type
| This is [[latex:textsc][small caps]].
|
| * Link type :noexport:
| #+begin_src emacs-lisp
| (org-add-link-type
| "latex" nil
| (lambda (path desc format)
| (cond
| ((eq format 'html)
| (format "<span class=\"%s\">%s</span>" path desc))
| ((eq format 'latex)
| (format "\\%s{%s}" path desc)))))
| #+end_src
`------------------------------------------------------------------------------
The LaTeX output looks fine:
,-----------------------------
| \begin{document}
|
| \tableofcontents
|
| \section{Test link type}
| \label{sec-1}
| This is \textsc{small caps}.
| \end{document}
`-----------------------------
Did your recent Org mode upgrade lose the latex link type somehow?
All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ox-latex and small caps links
2015-04-22 0:59 ox-latex and small caps links David Dynerman
2015-04-22 1:27 ` Thomas S. Dye
@ 2015-04-22 9:08 ` Rasmus
1 sibling, 0 replies; 5+ messages in thread
From: Rasmus @ 2015-04-22 9:08 UTC (permalink / raw
To: emacs-orgmode
Hi,
David Dynerman <david@block-party.net> 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. . .
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-04-22 9:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-22 0:59 ox-latex and small caps links David Dynerman
2015-04-22 1:27 ` Thomas S. Dye
2015-04-22 1:41 ` David Dynerman
2015-04-22 2:59 ` Thomas S. Dye
2015-04-22 9:08 ` Rasmus
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.