如何在Org模式下使用LaTeX导出的csquotes? [英] How can I use csquotes with LaTeX export in Org-mode?

查看:240
本文介绍了如何在Org模式下使用LaTeX导出的csquotes?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据上下文使用csquotes添加 csquotes 引号时。这可以通过使用 \enquote 宏标记报价,即 \enquote {text} 。从组织模式引号导出到LaTeX时,将标记为`` '',例如作为``text''



可以将组织模式导出到LaTeX,报价由 \enquote



我发现 http://comments.gmane.org/gmane.emacs.orgmode/43689 这样的功能正在计划中,但我不明白是否被实现。 p>




在相关注释中有 csquotes在AUCTeX中的集成。整合是当文档加载csquotes时,扩展为 \enquote {} 这不是我要求的,但可能有一些代码可能有兴趣设置组织模式导出由 \enquote

解决方案

在线程结束之后,然后查看7.7的更改日志(请参阅标题为7.7版本)发布我发现他们添加了一个变量 org-latex-export-quotes 。我不完全确定这将如何定制,但我怀疑它必须结束如下:



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

  defcustom org-export-latex-quotes 
'((fr(\\(\\ s-\\ | [[(] \\)\。«〜)(\\(\\S- \\)\。 〜)(\\(\\s- \\ |(\\)'。'))
(en(\\\ \\(\\s- \\ | | [[()\\)\。``)(\\(\\S- \\) \。)(\\(\\s- \\ |(\\)'。`)))


此单项中每个项目的CAR是语言代码
此同义词中每个项目的CDR是三个CONS的列表:
- 第一个CONS定义开头报价;
- 第二个CONS定义关闭报价;
- 最后一个CONS定义单引号

对于一个CONS,第一个字符串是在引号之前/之后允许的字符的正则表达式
,第二个
字符串定义了该引号的替换字符串。
/ pre>

To:

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

我刚刚测试过,并且按照预期执行。示例文件:

  * test 
这是this的测试

export as(preamble省略):

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

这是\enquote {this}
的测试

我不知道是否可以在7.6中轻松添加此功能,更容易的解决方案可能是升级。否则,7.6中更容易的解决方案可能是创建自定义链接(参见: Org教程)。这不会很快,但是在7.6提供的功能中提供了期望的结果。


When using csquotes quotation marks are added by csquotes according to context. This is done by marking up quotation with the \enquote macro, i.e. as \enquote{text}.

When exporting to LaTeX from Org-mode quotation marks are marked up as `` and '', e.g. as ``text''.

Can Org-mode export to LaTeX with quotations marked up by \enquote?

I found http://comments.gmane.org/gmane.emacs.orgmode/43689 where such a feature is being planned but I do not understand whether it was implemented.


On a related note there is integration of csquotes in AUCTeX. The integration is that when a document loads csquotes then " is expanded to \enquote{ and } respectively. This is not what I am asking for but there might be bits of code that can be interested in setting up Org-mode to export quotations marked up by \enquote.

解决方案

Following that thread to the end and then looking at the changelog for the 7.7 (see Headline for version 7.7) release I find that they have added a variable org-latex-export-quotes. I'm not entirely sure how this would have to be customized, but I suspect it would have to end up something as follows:

Original (included since it only appears in 7.7 and I believe you're running 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."

To:

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

I just tested this and it does perform as expected. The sample file:

* test
this is a test of "this"

exports as (preamble omitted):

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

this is a test of \enquote{this}

I do not know if it is possible to easily add this feature within 7.6, the easier solution would likely be to upgrade. Otherwise the easier solution in 7.6 would likely be to create a custom link (see: Org Tutorials). This would not be as fast but does provide the desired results within the features provided by 7.6.

这篇关于如何在Org模式下使用LaTeX导出的csquotes?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆