* Defining a new emphasis
@ 2012-05-07 8:28 Francesco Pizzolante
2012-05-07 9:28 ` Nicolas Goaziou
0 siblings, 1 reply; 4+ messages in thread
From: Francesco Pizzolante @ 2012-05-07 8:28 UTC (permalink / raw)
To: mailing-list-org-mode
Hi,
I'm trying to define a new emphasis that would work like org-code (=) except
that it would export to \textsf instead of \texttt in LaTeX.
I tried several combinations using org-emphasis-alist and
org-export-latex-emphasis-alist, but I must admit that I'm lost amongst all
parameters controlling how the emphasis is processed:
- org-emphasis-alist defines a 'verbatim' optional parameter
- org-export-latex-emphasis-alist defines a protected (t/nil) parameter
- special format string like \\verb or \\protectedtexttt may also be used
Here are tests I've made (using the option ^:nil) with this reference string
=look_at:my~ti ny\reference^string=:
| verbatim | protected | format string | Resulting LaTeX code | Comment |
|----------+-----------+-------------------+---------------------------------------------------------------------------------------+-----------------------------|
| no | nil | \\textsf{%s} | look\_{}at:my\~{}ti ny\reference\^{}string | OK except for the backslash |
| no | t | \\textsf{%s} | look_at:my~ti ny\reference^string | NOT OK |
| yes | nil | \\textsf{%s} | look_at:my~ti ny\reference^string | NOT OK |
| yes | t | \\textsf{%s} | look_at:my~ti ny\reference^string | NOT OK |
| yes | nil | \\protectedtexttt | look\_at:my\textasciitilde\{}ti ny\textbackslash\{}reference\textasciicircum\{}string | NOT OK |
| yes | t | \\protectedtexttt | look\_at:my\textasciitilde{}ti ny\textbackslash{}reference\textasciicircum{}string | OK |
I would like to get the exact same output as == gives (no interpretation of
the chars I write) except that I'd like to use \textsf instead of \texttt but
I can't find the right combination for the parameters (verbatim, protected) to
achieve this goal.
Any help or comment is welcome.
Thanks a lot.
Francesco
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Defining a new emphasis
2012-05-07 8:28 Defining a new emphasis Francesco Pizzolante
@ 2012-05-07 9:28 ` Nicolas Goaziou
[not found] ` <87lil449xx.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2012-05-07 9:28 UTC (permalink / raw)
To: Francesco Pizzolante; +Cc: mailing-list-org-mode
Hello,
"Francesco Pizzolante"
<fpz-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org> writes:
> I'm trying to define a new emphasis
Please don't. We're in the process of hard-coding emphasis markers.
> that would work like org-code (=) except that it would export to
> \textsf instead of \texttt in LaTeX.
If that's related to export, you can tweak the export of verbatim
(=text=) output.
For example, in the new exporter (if you use development Org, you can
(require 'org-export) and just call M-x org-export-dispatch), it just
means to change \texttt into \textsf through verbatim filters (list of
function applied to the output of each verbatim object).
It's a way to have the last words over export engine.
Here is the code:
#+begin_src emacs-lisp
(defun my-latex-verbatim-filter (text backend info)
"In `e-latex' backend, change \"texttt\" into \"textsf\"."
;; No change for other backends.
(if (not (eq backend 'e-latex)) text
(replace-regexp-in-string "\\`\\\\texttt" "\\\\textsf" text)))
(add-to-list 'org-export-filter-verbatim-functions 'my-latex-verbatim-filter)
#+end_src
If you call `org-export-dispatch' on a buffer containing:
=look_at:my~ti ny\reference^string=
you will get:
\textsf{look\_at:my\textasciitilde{}ti ny\textbackslash{}reference\textasciicircum{}string}
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-07 10:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-07 8:28 Defining a new emphasis Francesco Pizzolante
2012-05-07 9:28 ` Nicolas Goaziou
[not found] ` <87lil449xx.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-05-07 10:23 ` Francesco Pizzolante
2012-05-07 10:39 ` Nicolas Goaziou
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.