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.
#N.N. and others, the new org-mode export function in org 8.0 has a list named org-export-smart-quotes-alist. You can add the following to your init.el and it will turn regular " double quotes into enquote{}, and ' single quotes into 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 "’")))
A word of warning: if you want this to work in your org file's language, make sure you either have org-export-default-language set to "am" (or whatever you choose to use in the above form), or you put the appropriate #+LANGUAGE: am line at the top of your org file. If you don't, the org exporter won't call the above.
Related
I want to be able to disable strikethrough happening when I type + in an org-mode document. Specifically it is for entries in a table. Is there an easy way of doing this for a specific org-mode document since I only want to disable it for one document in particular. If not a way to toggle this would be nice.
I know I can have a literal + symbol with \plus but I would like to be able to see it in the document rather than reading the \plus.
To disable strikethrough in a specific file, add the following to your file:
-*- org-emphasis-alist: (("*" bold) ("/" italic) ("_" underline) ("=" org-verbatim verbatim) ("~" org-code verbatim) ("+" (:strike-through nil))); -*-
The down-side is that it will complain that the file may contain values that are not safe (see here). You can also use the longer version at the bottom of your file, as mentioned here.
To do it for all your org files is a simpler, and will not ask questions:
(setq org-emphasis-alist (quote (("*" bold "<b>" "</b>")
("/" italic "<i>" "</i>")
("_" underline "<span style=\"text-decoration:underline;\">" "</span>")
("=" org-code "<code>" "</code>" verbatim)
("~" org-verbatim "<code>" "</code>" verbatim))))
Sources: Bernt Hansen's org-mode notes(a must-read) and the org manual
I was able to do it by using local variables in the file
# Local Variables:
# org-emphasis-alist: (everything but strike through)
# End:
You can set org-emphasis-alist for just one file:
-*- org-emphasis-alist: nil -*-
+not struckout+
Of course, this removes all emphasis (bold, italic, etc.). I cannot figure out how to remove just strikeout in just one file (specifically, I can't figure out how to delete an element of the alist locally).
You might be able to achieve this by defining an overlay (+) for the literal plus (\plus). There is a library called "Auto Overlays" that
allows you to define overlays that are created (and updated and destroyed) automatically when text in a buffer matches a regular expression
(quoted from the home page of the author).
You can download a standalone version of the library from here. If you are on Emacs 24 and have the Marmalade Repo enabled, you can install the predictive package via
M-x package-install RET predictive RET
which apparently includes "Auto Overlays".
The documentation for this library is here.
When you use babel with French (set by, \usepackage[francais]{babel} emacs replaces automatically quotations marks (") by \og and \fg (you need only to restart emacs after adding babel).
It could be quite cool. But I'm using csquotes package which allows to have the good quotation marks by simply writing ".
\usepackage[babel]{csquotes}
\MakeOuterQuote{"}
So this amazing feature of emacs (the automatic replacement of " by \og or \fg) is useless for me and even painful.
How do I remove it?
It seems it is the font-latex-quotes variable which manage this. But options are only French (<< >>) or German (>> <<). I would like to redefine this variable to consider "test" as quote with test in color.
Assuming you are using auctex. you need to customize the value of variable TeX-quote-language to 'override.
This special value makes that language-related styles inhibit to modify its value, so quoting magic is deactivated.
I fixed this issue by modifying the variables LaTeX-csquotes-open-quote and LaTeX-csquotes-close-quote.
I define the first variable as \enquote{ and the second as }.
In text, can I make org-mode ignore forward slashes somehow? Phonetics uses /s/ to denote a certain level of analysis.
I assume that you do not want the text to appear emphasized in the buffer, nor in the output. This is a slightly more complex answer which will achieve that result:
There is a variable defined by Org-mode called org-emphasis-alist which defines the different emphasis modes, what their plain-text syntaxes are, and how they are exported to HTML. You can achieve the result you want by changing the value of this variable before Org-mode has been loaded. That last part is critical so note it well—Org-mode reads the value of org-emphasis-alist when it is loaded and uses that value to generate a regular expression for highlighting ("font-lock") purposes.
Here are two routes to that:
Add the following lines to your .emacs file above the lines that load Org-mode:
(setq org-emphasis-alist
`(("*" bold "<b>" "</b>")
;; ("/" italic "<i>" "</i>")
("_" underline "<span style=\"text-decoration:underline;\">" "</span>")
("=" org-code "<code>" "</code>" verbatim)
("~" org-verbatim "<code>" "</code>" verbatim)
("+" ,(if (featurep 'xemacs) 'org-table '(:strike-through t))
"<del>" "</del>")))
(Notice the commented out line.)
Make the change through Emacs' customization facility:
M-x customize RET
In the search box enter Org Emphasis and click Search.
Click the down arrow next to Org Emphasis Alist to reveal its value.
Find and click the second DEL button—corresponding to the italic list item.
Click the Save for future sessions button at the top of the buffer.
You can use
#+OPTIONS: *:nil
to turn off text-emphasis (bold,italics,underline). This will however only work on export itself, the emphasis will still be visible.
See the manual for other export options.
If you like the standard emphasis functionality of the forward slashes in org-mode, you could also just define a new environment. I put something like the following in the preamble whenever I do phonetics/phonology typesetting:
\newcommand\uRep[1]{$/$\textipa{#1}$/$}
How do I get Emacs org-mode to create proper typographic marks when I export to HTML, including converting straight quotes to smart quotes ("curly quotes") and converting hyphens --- to m-dashes —?
#+LANGUAGE: de
#+OPTIONS: ':t
also does the right thing now
This is now built into org-mode 8.x. To activate it, add the following to your Emacs configuration file:
(setq org-export-with-smart-quotes t)
It works for single quotes, double quotes, and apostrophes.
Source: #Ista
This is only available in very recent versions of org-mode. If you are not already running the latest git version see http://orgmode.org/worg/org-faq.html#keeping-current-with-Org-mode-development for instructions on upgrading. Then (setq org-export-with-smart-quotes t) will do what you want with quotes, and m-dashes will also be exported correctly.
A way to insure that smart quotes are entered in your org file is to insert the code at the following url into your init.el file. Then type M-x smart-quotes-mode and your all set.
https://github.com/gareth-rees/smart-quotes/blob/master/smart-quotes.el
MNH
How can I make org-mode markup work for a part of a word? For example, I'd like it to work for cases like this:
=Class=es
and this:
/Method/s
Based on my tests it seems like org-mode markup syntax works on complete words only.
These days, there is a way to do this (without using quoted HTML tags):
(setcar org-emphasis-regexp-components " \t('\"{[:alpha:]")
(setcar (nthcdr 1 org-emphasis-regexp-components) "[:alpha:]- \t.,:!?;'\")}\\")
(org-set-emph-re 'org-emphasis-regexp-components org-emphasis-regexp-components)
Explanation
The manual says that org-emphasis-regexp-components can be used to
fine tune what characters are allowed before and after the markup characters [...].
It is a list containing five entries. The first entry lists characters that are allowed to immediately precede markup characters, and the second entry lists characters that are allowed to follow markup characters. By default, letters are not included in either one of these entries. So in order to successfully apply formatting to strings immediately preceded or followed by a letter, we have to add [:alpha:] (which matches any letter) to both entries.
This is what the calls to setcar do. The purpose of the third line is to rebuild the regular expression for emphasis based on the modified version of org-emphasis-regexp-components.
I don't think you can do it so that it shows up in the buffer as bold. If you just need it so that it appears bold when you export it to html, you can use:
th#<b>is is ha#</b>lf bold
See Quoting HTML tags
No, you can't do that. I searched for the same solution before and found nothing. A (very) bad hack is to do something like *Class* es (with a whitespace).
Perhaps you can write a short message to the creator, Carsten Dominik (Homepage), and ask him for a solution. He seems to be a nice guy.
A solution that has not been mentioned is to use a unicode zero width space (U+200B) in between the desired bolded and unbolded parts of a word.
To get the desired bolding of the word "Classes":
Type 'Class*es' in the buffer (without quotes).
Move the cursor between the '*' and 'e' characters.
Press C-x 8 RET (to execute the insert-char command).
Type 'zero width space' (without quotes) and press RET.
Move the cursor to the beginning of the word and insert a '*' character.
The word "Classes" should now have the desired appearance.
Note that there is the possibility that this will cause problems when exporting.
src_latex{\textbf{Class}es and \textit{Method}s}
Building up on the previous excellent answer
I had to modify it a bit in order to make it work with spacemacs. Indeed, from the spacamacs org-layer documentation, available here, we can read
Because of autoloading, calling to org functions will trigger the
loading up of the org shipped with emacs which will induce conflicts.
One way to avoid conflict is to wrap your org config code in a
with-eval-after-load block [...]
So, I put the following lines inside my dotspacemacs/user-config ()
(eval-after-load "org"
'(progn
(setcar org-emphasis-regexp-components " \t('\"{[:alpha:]")
(setcar (nthcdr 1 org-emphasis-regexp-components) "[:alpha:]- \t.,:!?;'\")}\\")
(org-set-emph-re 'org-emphasis-regexp-components org-emphasis-regexp-components)
))