2012-01-29 53 views
3

使用csquotes时,引号是由csquotes根据上下文添加的。这是通过用\enquote宏标记报价来完成的,即作为\enquote{text}如何在组织模式下使用csquotes与LaTeX导出?

当从组织模式引号导出到胶乳标为``'',例如如``text''

可以将Org-mode导出到LaTeX,报价为\enquote

我发现http://comments.gmane.org/gmane.emacs.orgmode/43689正在计划这样一个功能,但我不明白它是否已经实施。


与此相关的还有integration of csquotes in AUCTeX。整合是,当一个文档加载csquotes然后扩展到\enquote{}分别。这不是我所要求的,但可能有一些代码可能有兴趣设置组织模式导出报价标记同比\enquote

回答

4

继该线程结束,然后看的changelog为7.7(见Headline for version 7.7)发布我发现,他们增加了一个变量org-latex-export-quotes,我不能完全肯定这将如何必须定制,但我怀疑它将不得不结束如下:

原来的(包括,因为它只出现在7.7和我相信你正在运行7.6):

(defcustom org-export-latex-quotes 
    '(("fr" ("\\(\\s-\\|[[(]\\)\"" . "«~") ("\\(\\S-\\)\"" . "~»") ("\\(\\s-\\|(\\)'" . "'")) 
    ("en" ("\\(\\s-\\|[[(]\\)\"" . "``") ("\\(\\S-\\)\"" . "''") ("\\(\\s-\\|(\\)'" . "`"))) 
    "Alist for quotes to use when converting english double-quotes. 

The CAR of each item in this alist is the language code. 
The CDR of each item in this alist is a list of three CONS: 
- the first CONS defines the opening quote; 
- the second CONS defines the closing quote; 
- the last CONS defines single quotes. 

For each item in a CONS, the first string is a regexp 
for allowed characters before/after the quote, the second 
string defines the replacement string for this quote." 

要:

(setq org-export-latex-quotes 
    '(("en" ("\\(\\s-\\|[[(]\\)\"" . "\\enquote{") ("\\(\\S-\\)\"" . "}") ("\\(\\s-\\|(\\)'" . "`")))) 

我只是测试这一点,它不会达到预期效果。示例文件:

* test 
this is a test of "this" 

出口为(序言略):

\section{test} 
\label{sec-1} 

this is a test of \enquote{this} 

我不知道是否有可能轻松在7.6添加此功能,简单的解决方案很可能会升级。否则,7.6中更简单的解决方案可能是创建自定义链接(请参阅:Org Tutorials)。这不会像7.6所提供的功能一样快,但能够提供所需的结果。

+0

很高兴它在新版本中实现。我对elisp不太好,所以我可以确定[diff](http://orgmode.org/w/?p=org-mode)。GIT中; A = blobdiff; F =口齿不清/ ORG-latex.el; H = 34ceca9041732ec47d5947d50c61a928420dc8f5; HP = e1c85ce581a3a5093eb3b419cf4364671b6d2388; HB = 2b9afb9e63d2fd60a3bb09e33c9d4abb01586339; HPB = 9fc6daa3d28cb1dcec87fcd769997b8f121e286c)可以被反向移植到7.6容易。 – 2012-02-01 19:46:19

+0

也许解决方案是安装'emacs-snapshot'?它会给你emacs 24预测(这是稳定的),以及碰到高达7.8的组织。 (请参阅:http://www.mikeyboldt.com/2011/11/30/install-emacs-24-in-ubuntu/)简单过程 – 2012-02-01 20:27:05

+0

是否可以扩展此解决方案以导出“test”为'\ enquote * {}测试'? – 2012-04-30 08:21:12

4

@ N.N。以及其他组织,组织8.0中新的组织结构导出功能有一个名为org-export-smart-quotes-alist的列表。您可以将以下内容添加到您的init.el中,它会将"双引号变为enquote{},并将'单引号变成enquote*{}

(add-to-list 'org-export-smart-quotes-alist 
      '("am" 
       (primary-opening :utf-8 "“" :html "“" :latex "\\enquote{" :texinfo "``") 
       (primary-closing :utf-8 "”" :html "”" :latex "}"   :texinfo "''") 
       (secondary-opening :utf-8 "‘" :html "‘" :latex "\\enquote*{" :texinfo "`") 
       (secondary-closing :utf-8 "’" :html "’" :latex "}"   :texinfo "'") 
       (apostrophe  :utf-8 "’" :html "’"))) 

一句警告:如果你想这在你的组织文件的语言工作,确保你要么org-export-default-language设置为"am"(或任何你选择在上述形式使用),或者你把合适的#+LANGUAGE: am行位于您的组织文件的顶部。如果您不这样做,那么组织出口商将不会调用上述内容。

相关问题