I’m using Emacs (Aquamacs) on Mac for my LaTex files.
I always want to use LaTex (not Tex) and always produce a PDF file.
The .emacs File contains
(setq TeX-PDF-mode t)
besides some other stuff.
Usually everything works just fine, but some files are driving me crazy.
If I open them:
TeX-PDF-mode is not enabled and a “.dvi” file is created.
The View command opens TeXShop instead of Skim.
I don’t see any difference to other files, why is this happening?
\documentclass{article}
\usepackage{graphicx}
\usepackage{epsfig,psfrag,mathrsfs,amsmath,amsfonts,amssymb}
\usepackage{color}
\usepackage{multirow}
\usepackage{authblk}
\usepackage{hyperref}
\usepackage{pgf}
\usepackage{tikz}
\providecommand{\keywords}[1]{\textbf{\textit{Keywords:}} #1}
%\providecommand{\preprint}[1]{{\small #1}}
\newtheorem{remark}{Remark}
\newtheorem{example}{Example}
\newcommand\preprint[1]{
\begingroup
\renewcommand\thefootnote{}\footnote{\\#1}
\addtocounter{footnote}{-1}
\endgroup
}
\begin{document}
\title{Some title}
\author{some one}
\date{January 29, 2014}
\maketitle
\preprint{Preprint submitted to {\em Journal of Scientific Computing}.}
\begin{abstract}
some text
\end{abstract}
\section{Introduction}
More text.\cite{article:BS2000}
\begin{thebibliography}{10}
\bibitem{article:BS2000}
No one.
\newblock foo foo.
\newblock {\em J.\ Comput.\ Phys.}.
\end{thebibliography}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
Related
Hello, I'm using Emacs's org mode for editing my documents. As you can see I have a first level heading (the blueish color) and a second level heading (yellow).
My table of contents doesn't show up and I have no idea why, but the biggest issue is aligning those headings to the left in the PDF and make them bold.
I'm using the following xelatex settings in the Emacs config if this helps:
"article"
"\\documentclass[11pt,a4paper]{article}
\\usepackage{fontspec}
\\setmainfont{Charis SIL}
\\usepackage{geometry}
\\geometry{a4paper, left=0.67in, right=0.67in,
top=0.5in, bottom=0.67in}
\\setlength{\\parindent}{0pt}
Here's the content of the .TEX file that is also generated along the PDF.
% Created 2020-11-14 Sat 22:47
% Intended LaTeX compiler: xelatex
\documentclass[11pt,a4paper]{article}
\usepackage{fontspec}
\setmainfont{Charis SIL}
\usepackage{geometry}
\geometry{a4paper, left=0.67in, right=0.67in,
top=0.5in, bottom=0.67in}
\setlength{\parindent}{0pt}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\author{Author}
\date{\today}
\title{Test Document}
\hypersetup{
pdfauthor={Author},
pdftitle={Test Document},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 27.1 (Org mode 9.3)},
pdflang={English}}
\begin{document}
\maketitle
\tableofcontents
Org mode, as it says on the official web page is for keeping notes, maintaining TODO lists, doing project planning, and authoring with a fast and effective plain-text system. Beginning with Emacs 22.2 and XEmacs 22.1 it has been part of Emacs. The following is a simple tutorial to help you get started using Emacs and Org mode.
\begin{enumerate}
\item The absolute minimum you need to know about Emacs
\label{sec:orgf515372}
The absolute minimum you need to know about Emacs, to be able to do anything, is more then you need to know about many other applications. But, you might compare it to a regular toy and lego. Lego is harder to begin with (you start with a box with little plastic pieces), but in the long run, you can do more with it.
Emacs is heavy on shortcuts. starting out, that is rather annoying, but in time you'll notice you start to use the mouse less and less, and you actually start to work quicker.
\begin{enumerate}
\item Starting Org mode
\label{sec:orgb4df8b1}
New shortcuts in this chapter:
C-x C-s – save document
C-x C-f – open document
\end{enumerate}
\end{enumerate}
\end{document}
I am using VScode (macOS operating system) as a pseudo overleaf (trying to prevent connectivity issues). I am using a revtex template and want to use a bib file to hold all my references. For some reason the bib file is not parsing. When I save the bibtex file, the references I've entered just disappear.
This is the error that I get when I save my file:
"Bibtex parser failed with error: Expected ",", "=", "\r\n", [ \t\n], or [^#={}", \t\r\n] but "}" found."
I want to set up my VScode like overleaf, so if anyone has any simple solutions please do comment!
Below is my code
\documentclass[a4paper, amsfonts, amssymb, amsmath, reprint, showkeys, nofootinbib, twoside, aps, pra]{revtex4-1}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[colorinlistoftodos, color=green!40, prependcaption]{todonotes}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{physics}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage[left=23mm,right=13mm,top=35mm,columnsep=15pt]{geometry}
\usepackage{adjustbox}
\usepackage{placeins}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage{csquotes}
% \usepackage{biblatex}
\usepackage[pdftex, pdftitle={Article}, pdfauthor={Author}]{hyperref} % For hyperlinks in the PDF
\def\bibsection{\section*{\refname}} % removes ugly line above bibliography
%\setlength{\marginparwidth}{2.5cm}
% \bibliographystyle{apsrev4-1}
% \addbibresource{LitReviewNotes.bib}
\begin{document}
I would like to export inline quotations in an org-document to \enquote{} commands. The csquotes package then ensures French quotation marks « » are used in the resulting pdf document.
I am well aware this question has been asked before here - and that solutions have been suggested by #Jonathan Leech-Pepin and #Christophe Poile. I tried all solutions suggested, without success. I would like to avoid (1) hardcoding the correct quotation marks or (2) using the latex command in my org document. OSX 10.15.5, emacs 26.2, org 9.2.5.
Org document header:
#+Title: GS
#+AUTHOR: HDV
#+SEQ_TODO:
#+TAGS:
#+STARTUP: indent
#+LANGUAGE: fr
#+LaTeX_CLASS: article
#+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside]
#+LATEX_HEADER: \usepackage[utf8]{inputenc}
#+LATEX_HEADER: \usepackage{ae,lmodern}
#+LATEX_HEADER: \usepackage[french]{babel}
#+LATEX_HEADER: \usepackage[T1]{fontenc}
#+LATEX_HEADER: \usepackage{graphicx}
#+LATEX_HEADER: \usepackage[babel=true]{csquotes}
Exported latex preamble:
% Created 2020-07-07 Tue 20:45
% Intended LaTeX compiler: pdflatex
\documentclass[a4paper,11pt,twoside]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage{ae,lmodern}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[babel=true]{csquotes}
\author{}
\date{\today}
\title{}
\hypersetup{
pdfauthor={},
pdftitle={},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 26.2 (Org mode 9.2.5)},
pdflang={French}}
\begin{document}
I used to use the following code to convert #xxx# to \hl{xxx} (using the soul LaTeX package). You might be able to adapt this to convert "xxx" to \enquote{xxx}?
** convert #highlighted# text on export to ~\hl{highlighted}~
#+begin_src emacs-lisp
(defun esf/latex-filter-highlight (text backend info)
"Convert #...# to \hl{...} in LaTeX export."
(when (org-export-derived-backend-p backend 'latex)
(replace-regexp-in-string "#\\([^#]+\\)#" "\\\\hl{\\1}" text)))
(add-to-list 'org-export-filter-plain-text-functions
'esf/latex-filter-highlight)
#+end_src
You do not need csquotes or \enquote{} to get guillemets; there is smart quote support out of the box in Org mode. The following suffices:
#+OPTIONS: ':t
#+LANGUAGE: fr
#+LATEX_HEADER: \usepackage[french]{babel}
* foo
As somebody once said:
"You cannot explain anything to a stone."
You turn on smart quotes, set the #+LANGUAGE to fr to select the french style of smart quotes and then let babel figure it out. The TeX file produced looks like this (only the significant parts are shown):
...
\usepackage[french]{babel}
...
\begin{document}
...
\section{foo}
\label{sec:orgd0ec1fc}
As somebody once said:
\og You cannot explain anything to a stone.\fg{}
\end{document}
If you really want \enquote, you can modify the value of org-export-smart-quotes-alist. I think the best way is to duplcate the current section for fr, modify it for your purposes and add it to the beginning of the alist where it is going to shadow the existing entry:
(setq fr-quotes '("fr"
(primary-opening :utf-8 "« " :html "« " :latex "\\enquote{" :texinfo "#guillemetleft{}#tie{}")
(primary-closing :utf-8 " »" :html " »" :latex "}" :texinfo "#tie{}#guillemetright{}")
(secondary-opening :utf-8 "« " :html "« " :latex "\\\enquote{" :texinfo "#guillemetleft{}#tie{}")
(secondary-closing :utf-8 " »" :html " »" :latex "\\}" :texinfo "#tie{}#guillemetright{}")
(apostrophe :utf-8 "’" :html "’"))
(add-to-list 'org-export-smart-quotes-alist fr-quotes)
As you can see I changed the opening and closing quotes for LaTeX to use \enquote{ to open and } to close. Adding it to the front of the list allows you to get rid of it quickly if you want to go back to the default:
(setq org-export-smart-quotes-alist (cdr org-export-smart-quotes-alist))
gets rid of the first entry (the added "fr" entry) allowing the default "fr" entry to be seen. You should probably do C-h v org-export-smart-quotes-alist and look at its value carefully.
Then the Org mode file becomes:
#+OPTIONS: ':t
#+LANGUAGE: fr
#+LATEX_HEADER: \usepackage[french]{babel}
#+LATEX_HEADER: \usepackage[babel=true]{csquotes}
* foo
As somebody once said:
"You cannot explain anything to a stone."
and the resulting tex file looks like this (again, only the significant parts are shown):
...
\usepackage[french]{babel}
\usepackage[babel=true]{csquotes}
...
\begin{document}
...
\section{foo}
\label{sec:orgb8fcb36}
As somebody once said:
\enquote{You cannot explain anything to a stone.}
\end{document}
I'm currently trying to write up my thesis in emacs org-mode, and have run into some problems with file inclusions.
When I include figures with:
#+NAME: fig:banana
#+CAPTION: this is a figure caption
[[/path/to/image.png]]
(or using a pdf) it works fine. But when I insert another image, it is somehow moved to the end of the file instead of being inserted where it is called.
My pdf-export process (in my ~/.emacs file) looks like this:
(setq org-latex-pdf-process
'("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f %f"))
Any ideas on how to fix this?
A friend of mine pointed me to the LaTex package placeins.
#+LATEX_HEADER: \usepackage{placeins}
* section 1
** hi!
#+TITLE: fig:banana
#+CAPTION: this is a banana figure
[[/link/to/banana.png]]
\FloatBarrier
* section 2
The FloatBarrier stops floats (figures are floats) from jumping over them. I will need to look into passing [tbh] options to figures from org mode further.
Check the org-mode manual on how to pass placement options such as [h], [t] etc. to theLaTeX compiler.
If you're not sure how to control where figures (more precisely, floats) get placed by LaTeX, please refer to any introduction.
Or do you want the figure to be placed where you include it? If so, you might not need it to be a float.
Original Response:
I was trying to figure out how in auctex mode latex doesn't seem to highlight any latex functions with flyspell turned on. Is this a custom dictionary file or how is this implemented? Can this be easily incorporated into an org-mode file so it doesn't highlight inserted latex code that will get exported.
Edit:
Simple example taken from top of file and in the text. Basically so latex syntax like ref or label inside {} won't be spell checked (this has been fixed by using (setq ispell-parser tex). Then also setting up a function that specific labels with #+ as the first text on the line won't be checked. I would want the caption checked but not #+LABEL: or #+TYP_TODO: (not shown. Also a way to add TODO keywords to not get checked. I can think of a way to do this is on startup add these to the LOCALWORDS: ispell places at the bottom of the file if not already there but is there an easier or better way to do this.
#+TAGS: NOTE REPORT export noexport MEETING
#+TYP_TODO: TODO Weekly WAITING NEXT | Meeting DONE
#+STARTUP: hidestars content hideblocks
The exponential running mean is shown for various alpha values in Figure \ref{fig:saturation_varying_alphaval_00f6set2}.
#+CAPTION: Plot of varying alpha values for the exponential running mean ($EM$) with $S_{min} = 0.0008 \text{ and } P_m = 0.20$
#+LABEL: fig:saturation_varying_alphaval_00f6set2
#+ATTR_LaTeX: width=0.4\textwidth placement=[h!tb]
flyspell internally uses ispell-mode. To change the way that ispell parses files set the variable ispell-parser to 'tex.
(add-hook 'org-mode-hook (lambda () (setq ispell-parser 'tex)))
Most likely auctex is using flyspell-mode-predicate to define what portions of the buffer shouldn't be spellchecked. (This answer shows how to do something similar for MoinMoinWiki.) org-mode already has such a function, org-mode-flyspell-verify, which apparently doesn't work properly for you... A quick look at the source suggests that org-remove-flyspell-overlays-in should be called for buffer portions containing code samples etc.
Sorry about the handwavy answer; marking this as community wiki to invite improvements.