2012-01-29 54 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行位於您的組織文件的頂部。如果您不這樣做,那麼組織出口商將不會調用上述內容。

相關問題