Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using Emacs 24.2.1 and I don't think I have any special settings that should interfere. If I enter the following text, there is no problem:

/cite{BibtexRef} Text that is not italicized. /cite{BibtexRef}

But then there is an issue here:

*/cite{BibtexRef} I don't want italics here. /I only want them here./*

I'm not understanding why the formatting gets messed up in the second case but not the first. Can someone explain?

To get things to look a bit closer to what I want, I am italicizing all my citations, like this.

*/cite{BibtexRef}/* Not italicized. */Italicized./*

Could this cause problems with Bibtex? Is there a better solution?

share|improve this question

migrated from stackoverflow.com Jan 13 '13 at 5:35

This question came from our site for professional and enthusiast programmers.

    
I guess I can't use italics in a blockquote? That's what the *s in my examples are supposed to denote. –  Brian Z Feb 16 '13 at 10:10
    
Maybe you should post a new question about that. Might fit better on Stack Overflow though if I get the topic right. –  N.N. Feb 16 '13 at 11:52

2 Answers 2

up vote 3 down vote accepted

This seems to be a syntactic misunderstanding and not problem with Org-mode.

You seem to have confused slash, /, and backslash, \. Enclosing text in (forward) slashes are indeed used for emphasizing in Org-mode but (forward) slashes are not used to refer to a TeX macro. To refer to a TeX macro you use backslash followed by the name of the macro, e.g. \printbibliography.

So, since TeX macros are not referred to by a leading slash a leading backslash they do not interfere with Org-mode's syntax for emphasizing text.

Here is an example to clarify. The following is an Org-mode document:

#+title: Title

#+options: toc:nil

#+LaTeX_HEADER: \usepackage[style=authoryear]{biblatex}

#+LaTeX_HEADER: \begin{filecontents*}{bibliography.bib}
#+LaTeX_HEADER: @book{thebook,
#+LaTeX_HEADER:   title        = {Title},
#+LaTeX_HEADER:   author       = {Author},
#+LaTeX_HEADER:   year         = {2000}
#+LaTeX_HEADER:   }
#+LaTeX_HEADER: \end{filecontents*}

#+LaTeX_HEADER: \bibliography{bibliography}

/italicized/ \cite{thebook} not italicized /italicized/

\printbibliography

If it is exported to LaTeX (C-c C-e l) and compiled (e.g. via latexmk) part of the output will be as follows:

Output of Org-mode document

As you can see the emphasize is correct. This is also confirmed by the emphasize in the Org-mode buffer:

Org-mode buffer

share|improve this answer
    
Ah, such a simple, silly mistake. This might also explain problems I was having with the citations when rendering the LaTeX. Your example is very helpful. Thanks! @N.N. –  Brian Z Feb 16 '13 at 5:12

This isn't an answer per se, but a bit too long for a comment:

You might also want to make all your citations italicized on the LaTeX level, not in your org code, since then you wouldn't violate the DRY principle. One way to do it could be like this:

\let\originalcite=\cite
\def\cite#1{\emph{\cite#1}}

This, however, breaks with optional parameter to \cite (which may be fixed with a suitable \newcommand). Maybe a better solution (though admittedly a bit dirty-hackish) could be

\usepackage{etoolbox}
\pretocmd{\cite}{\emph\bgroup}{}{}
\apptocmd{\cite}{\egroup}{}{}

This solution should work irrespective of whether you use things like amsrefs or not. If, however, you don't modify the LaTeX2e's \cite command (by \usepackageing \amsrefs, for instance), this is probably the simplest and best way:

\makeatletter
\def\@cite#1#2{\emph{[{#1\if@tempswa , #2\fi}]}}
\makeatother

However, I have to admit that I do not understand the point of your question: why on earth would anyone want to italicize \cites? And even if you do, this would probably be the way:

\makeatletter
\def\@cite#1#2{[\emph{{#1\if@tempswa , #2\fi}}]}
\makeatother

since it is very bad style to italicize brackets (and I am sure people with access to English version of Bringurst's book could give you a reference for this claim;)). And if you italicize this, you might also want to italicize entries in bibliography as well.

And while we're at it, seemingly no-one pointed you to biblatex (which is superior to old bibtex) or amsrefs (which is better than bibtex, though probably weaker, but easier to start using than biblatex) yet. So check them out!

share|improve this answer
    
I never actually wanted the citations to be italicized. That was just the very bad and totally unnecessary way that I found to "fix" the problem. This was only before I realized that I was using a slash "/" where I should have used a backslash "\". –  Brian Z Feb 16 '13 at 9:50
    
But thanks anyway @mbork. Before now I didn't realize there was this whole range of different packages for handling citations. –  Brian Z Feb 16 '13 at 10:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.