Tikz font in beamer export - emacs

I'm exporting a presentation from an org file that includes a block of tikz code. This is my minimal working example:
#+TITLE: Beamer Question
#+AUTHOR: J. Doe
#+OPTIONS: H:2 toc:t
#+LATEX_CLASS: beamer
#+LATEX_CLASS_OPTIONS: [presentation, aspectratio=169]
#+LATEX_HEADER: \usepackage{graphicx}
#+BEAMER_THEME: Hannover
#+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col)
* Introduction
** Problem
*** Normal text
:PROPERTIES:
:BEAMER_col: 0.4
:END:
This is how normal text looks; with sans serif font
*** Tikz image
:PROPERTIES:
:BEAMER_col: 0.6
:END:
#+begin_src latex :file tikz.pdf :packages '(("" "tikz")) :border 1pt :results raw % Define block styles
\begin{tikzpicture}[ text/.style={text width=5cm, align=center}]
\node (n) [text] at (0,0) {But if I write text in a tikz picture, it uses the default Latex font (serif)};
\end{tikzpicture}
#+end_src
Exporting this with M-x org-beamer-export-to-pdf produces this slide:
My question is, how can I tell tikz to use the same font as the rest of the beamer presentation?
Things I've tried:
Search online. Found nothing
Export to latex file. The result is that orgmode executes the tikz code, produces a pdf (with the wrong font) and inserts the produced pdf as an image. The problem persists
EDIT: As requested, this is the latex code generated by orgmode
% Created 2020-03-29 dom. 09:45
% Intended LaTeX compiler: pdflatex
\documentclass[presentation, aspectratio=169]{beamer}
\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{graphicx}
\usetheme{Hannover}
\author{J. Doe}
\date{\today}
\title{Beamer Question}
\hypersetup{
pdfauthor={J. Doe},
pdftitle={Beamer Question},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 26.1 (Org mode 9.1.9)},
pdflang={English}}
\begin{document}
\maketitle
\begin{frame}{Outline}
\tableofcontents
\end{frame}
\section{Introduction}
\label{sec:org689fb7a}
\begin{frame}[label={sec:org3b759e9}]{Problem}
\begin{columns}
\begin{column}{0.4\columnwidth}
This is how normal text looks; with sans serif font
\end{column}
\begin{column}{0.6\columnwidth}
\includegraphics[width=.9\linewidth]{tikz.pdf}
\end{column}
\end{columns}
\end{frame}
\end{document}

The problem is that using a src block causes org to invoke LaTeX on that block and this does not inherit any settings from the document. What if you change begin_src...end_src to begin_export latex ... end_export?

Related

Emacs org-mode latex export doesnt export bibliography

I tried to export a document with orgmode to a pdf. Unfortunately it doesnt export the citations. I make a minimal example of and export it. Same Problem. So maybe i think there is a Problem with the \printbibliography.
org file
# Latexheader
#+LATEX_HEADER: \documentclass[12pt]{article}
#+LATEX_HEADER: \usepackage[a4paper, left=4cm, right=2cm, top=3cm, bottom=3cm,margin=2cm]{geometry}
#+LATEX_HEADER: \usepackage{biblatex}
# Bibliography
#+bibliography: ../lit.bib
#+cite_export: csl <PATH>/ieee.csl
# Document
* Heading
Test [cite:#all]
#+print_bibliography:
lit.bib
#inproceedings{all,
title={papertitle},
author={paperauthor},
booktitle={PAPER3000},
year={2002}
}
tex file
% Created 2022-09-20 Di 20:59
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{minted}
\documentclass[12pt]{article}
\usepackage[a4paper, left=4cm, right=2cm, top=3cm, bottom=3cm,margin=2cm]{geometry}
\author{xdobx}
\date{\today}
\title{}
\hypersetup{
pdfauthor={xdobx},
pdftitle={},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 28.1 (Org mode 9.5.2)},
pdflang={English}}
\makeatletter
\newcommand{\citeprocitem}[2]{\hyper#linkstart{cite}{citeproc_bib_item_#1}#2\hyper#linkend}
\makeatother
\usepackage[notquote]{hanging}
\begin{document}
\tableofcontents
\section{Heading}
\label{sec:org89209e9}
Test TEST [1]
\printbibliography
\end{document}
The output is unsatisfying.
PDF without bibliography
I tried different ways:
wrap \printbibliography in a #+begin_latex/#+end_latex block.
install citeproc-org: but this only brought more errors
add biblatex with #+LATEX_HEADER: \usepackage{biblatex} as #samcarter_is_at_topanswers.xyz suggest
: correct export of header, but no difference in .pdf
How can i get a nice IEEE-Style formatted bibliography at the end of my document?
Edit I
rewrite \printbibliography to #+print_bibliography: and it works in the minimal example, if i tried it at the original document it only works if i don't use #+cite_export: csl <PATH>/ieee.csl.
If i use it, i get a error: unknown bibliography extension: nil
Edit II
the rewrite from Edit I works, i just forget a #+BIBLIOGRAPHY: here from citeproc-org somewhere in the big file.
The correct solution is to load \biblatex with
#+LATEX_HEADER: \usepackage{biblatex} and insert bibliography with#+print_bibliography: where you want. Correct minimal example .org :
# Latexheader
#+LATEX_HEADER: \documentclass[12pt]{article}
#+LATEX_HEADER: \usepackage[a4paper, left=4cm, right=2cm, top=3cm, bottom=3cm,margin=2cm]{geometry}
#+LATEX_HEADER: \usepackage{biblatex}
# Bibliography
#+bibliography: ../lit.bib
#+cite_export: csl <PATH>/ieee.csl
# Document
* Heading
Test [cite:#all]
#+print_bibliography:

Org-mode: Latex Export. I would like borders for examples

I would like to have borders for my examples. I am using the code
#+ATTR_LATEX: :options frame=single
#+begin_example
- stuRollNo:String
# stuName:name
+ subject:Subject
marks:Double
#+end_example
However, when exported to PDF, I am not getting the expected single line border. Any idea where I am doing the mistake?

How can I make the headings in xelatex document align at the left?

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}

How to export inline quotations from emacs org mode to latex csquotes syntax?

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}

Exporting footnotes to Beamer places them too low on the frame

How do I define the space allocated to the footnotes in an Org file that is intended to be exported as a Beamer presentation? The problematic result is shown below:
The relevant bit of Org file looks like this:
#+STARTUP: beamer
#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [bigger]
#+BEAMER_FRAME_LEVEL: 2
#+COLUMNS: %40ITEM %10BEAMER_env(Env) %9BEAMER_envargs(Env Args) %4BEAMER_col(Col) %10BEAMER_extra(Extra)
* Role of Org-Babel
** Overview :B_verse:
:PROPERTIES:
:BEAMER_env: verse
:END:
=org-babel= is a facility that provides inline code evaluation,
highlighting and tangling[fn:1: Tangling and untangling is the
process employed in literate programming for hiding and displaying
code blocks.].
PS. Of course literate programming.
Add the following option in your header:
#+LaTeX_HEADER:\addtobeamertemplate{footnote}{}{\vspace{2ex}}