Quarto: Can't render greek letters in equations - latex

This Github repo, hosts a .qmd file of my dissertation template. In the last few lines of it there's an inline equation like this $Y_i = \beta_0 + \beta_1X_i + e_i$. Thing is, the greek letter \beta doesn't render.
I think may be a conflict in my preamble.tex but I couldn't figure that out.
Edit: 1 minute later I figured out that if I set a font that has greek letters, as in \setmainfont{Times New Roman} it works. I don't know what's the default Quarto font, but maybe that's it.

Setting a font in preamble.tex did the trick: \setmainfont{Times New Roman}

Related

How may I convert a three-digit Arabic number (Perl [0-9][0-9][0-9]) to a three-digit English representation ([zero-nine][zero-nine][zero-nine])

The alternative is to use Roman numerals, for which a package is
available. I am using the LaTeX catchfile package and the \input{}
command to associate a title in a set of TITLE files with \section{}
commands in a set of DOCUMENT files.
I would like to have a file of catchfile definitions, with records
such as:
\CatchFileDef{\t-001}{title-001.tex}{}
\CatchFileDef{\t-002}{title-002.tex}{}
\CatchFileDef{\t-003}{title-003.tex}{}
But LaTeX does not allow numerical labels such as "\title-003".
Roman numerals are workable:
\CatchFileDef{\ti}{title-001.tex}{}
\CatchFileDef{\tii}{title-002.tex}{}
\CatchFileDef{\tiii}{title-003.tex}{}
but are ugly in comparison with:
\CatchFileDef{\tzerozeroone}{title-001.tex}{}
\CatchFileDef{\tzerozerotwo}{title-002.tex}{}
\CatchFileDef{\tzerozerothree}{title-003.tex}{}
On possibility to convert digits into their corresponding words is the numspell package:
\documentclass{article}
\usepackage{numspell}
\usepackage{pgffor}
\begin{document}
\foreach \x in {0,...,9}{
\foreach \y in {0,...,9}{
\foreach \z in {0,...,9}{
\x\y\z : \numspell{\x}\numspell{\y}\numspell{\z}
}}}
\end{document}
In an hour or two, using Emacs, I created a look up table which solved the problem. The English spelling of Arabic numerals appears to be less prone to error than is the use of Roman numerals.

Latex biblatex: bibliography titles aren't doing a break line, they overflow instead [ ]

I recently discovered a problem in my bibliography and I somehow can't solve it. It's appearing when the titles are too long, but its working with URLs normally as you see in the 2nd example as long the as the title is short enough.
It seems that symbols like "[]" beeing generated from something and the log is giving me 2x Overfull \hbox (X pt too wide) in paragraph.
setup: document.tex and bib/literature.bib
settings: pdfLatex (using biber and texindy)
Minimal example:
\documentclass[
11pt,
a4paper
]{scrreprt}
% add bibliography
\usepackage[style=alphabetic, sorting=anyt]{biblatex}
\addbibresource{bib/literature.bib}
\usepackage[colorlinks, urlcolor=blue]{hyperref}
\begin{document}
\cite{Gaedke}
\cite{IOT}
\printbibliography
\end{document}
literature.bib
#online{Gaedke,
author = {Gaedke, Martin and Heil, Andreas},
title = {{GET /dgs HTTP/1.1 Host: www.WebComposition.net.}},
url = {http://www.mendeley.com/research/dgs-http11-host-wwwwebcompositionnet/},
urldate={2018-08-19}
}
#online{IOT,
author = {Litzel, Nico },
title = {Was ist das Internet of Things?},
url = {https://www.bigdata-insider.de/was-ist-das-internet-of-things-a-590806/},
urldate={2018-08-19}
}
According to the biblatex documentation:
biburlnumpenalty: If this counter is set to a value greater than zero, biblatex will permit linebreaks after numbers in all strings formatted with the \url command from the url package. This will affect urls and dois in the bibliography. The breakpoints will be penalized by the value of this counter. If urls and/or dois in the bibliography run
into the margin, try setting this counter to a value greater than zero but less than
10000 (you normally want to use a high value like 9000). Setting the counter to zero
disables this feature. This is the default setting.
So, you can add:
\usepackage[style=alphabetic, sorting=anyt]{biblatex}
\addbibresource{bib/literature.bib
% If you want to break on URL numbers
\setcounter{biburlnumpenalty}{9000}
% If you want to break on URL lower case letters
\setcounter{biburllcpenalty}{9000}
% If you want to break on URL UPPER CASE letters
\setcounter{biburlucpenalty}{9000}
There are two separate issues:
The title, where LaTeX hyphenation does not know how to break www.WebComposition.net. You can do something here using \hyphenation{} in the preamble or see here for the many ways of hyphenation using the LaTeX packages for the German language
The URL, where LaTeX URL breaking (from the url package loaded by hyperref) does not know how to break wwwwebcompositionnet/. For this issue, refer to the answer by Eiji https://stackoverflow.com/a/53388858 or see https://tex.stackexchange.com/questions/3033/forcing-linebreaks-in-url/10419

Customize headers and footers in Latex using Sphinx

We are exploring the features of Sphinx in order to rebuild our legacy manuals. We already ported most of the former manual to Sphinx. Now I'm exploring the possibilities to adapt our company styles.
Especially, we would like to change the appearance of the headers and footers in the PDF manual. Including a company logo and changing the appearance of even and odd pages.
Hence, I included the following preamble in my conf.py with a custom pagestyle using the package fancyhdr.
latex_elements = {
'preamble' : '''\
\\pagestyle{fancy}
\\fancyhf{}
\\fancyhead[LE,RO]{My Header}'''
}
Unfortunately, the headers only changes before begin{document}, afterwards the Sphinx Style File sphinx.sty overwrites somehow my settings.
The following snippet from sphinx.sty might cause the issue:
% Redefine the 'normal' header/footer style when using "fancyhdr" package:
\spx#ifundefined{fancyhf}{}{
% Use \pagestyle{normal} as the primary pagestyle for text.
\fancypagestyle{normal}{
\fancyhf{}
\fancyfoot[LE,RO]{{\py#HeaderFamily\thepage}}
\fancyfoot[LO]{{\py#HeaderFamily\nouppercase{\rightmark}}}
\fancyfoot[RE]{{\py#HeaderFamily\nouppercase{\leftmark}}}
\fancyhead[LE,RO]{{\py#HeaderFamily \#title, \py#release}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
% define chaptermark with \#chappos when \#chappos is available for Japanese
\spx#ifundefined{#chappos}{}
{\def\chaptermark##1{\markboth{\#chapapp\space\thechapter\space\#chappos\space ##1}{}}}
}
% Update the plain style so we get the page number & footer line,
% but not a chapter or section title. This is to keep the first
% page of a chapter and the blank page between chapters `clean.'
\fancypagestyle{plain}{
\fancyhf{}
\fancyfoot[LE,RO]{{\py#HeaderFamily\thepage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt}
}
}
What might be a possible workaround?
The table of contents code (in sphinxmanual.cls) ends up with
\ifdefined\fancyhf\pagestyle{normal}\fi
The comment in sphinx.sty says:
% Use \pagestyle{normal} as the primary pagestyle for text.
Thus the simplest should be for your conf.py setting to overwrite the \fancypagestyle{normal}, just re-issue it to your liking.
You will need to wrap the whole latex in \makeatletter...\makeatother if you use \py#HeaderFamily. And use Python raw strings to avoid having to double all backslashes.
in details, here I copy the original definition to conf.py so that it can be customized from there
latex_elements = {
'preamble': """
\makeatletter
\fancypagestyle{normal}{
\fancyhf{}
\fancyfoot[LE,RO]{{\py#HeaderFamily\thepage}}
\fancyfoot[LO]{{\py#HeaderFamily\nouppercase{\rightmark}}}
\fancyfoot[RE]{{\py#HeaderFamily\nouppercase{\leftmark}}}
\fancyhead[LE,RO]{{\py#HeaderFamily \#title, \py#release}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
% define chaptermark with \#chappos when \#chappos is available for Japanese
\spx#ifundefined{#chappos}{}
{\def\chaptermark##1{\markboth{\#chapapp\space\thechapter\space\#chappos\space ##1}{}}}
}
\makeatother
""",
}

Problem with theorem decimal numbering in LaTeX

Below is the beginning of my LaTeX code. When I compile, theorem numbers do not show the decimal point. For example, the output shows Theorem 11 instead of Theorem 1.1. How can I fix this ?
\documentclass[smallcondensed]{svjour3}
\smartqed
\usepackage{graphicx}
\usepackage{mathptmx}
\usepackage{amssymb,amsmath,amsfonts,latexsym}
\usepackage{tikz}
\newtheorem{thm}{Theorem}[section]
\newtheorem{conj}[thm]{Conjecture}
\newtheorem{defn}[thm]{Definition}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{clm}[thm]{Claim}
\newtheorem{fact}[thm]{Fact}
\newtheorem{lem}[thm]{Lemma}
it looks like this is a setting of the style file you are using (svjour3)
in the version i found here, line 804 contains the line
\def\#thmcountersep{}
which removes the separator. if you want you can add back the period ( \def\#thmcountersep{.} ) but if the style file was provided by a journal their default is probably their default. it may be worth having a look at some example articles from the journal
Have you tried putting a backslash before the period? Perhaps '.' serves some special function when you make theorems.

How to create a white-on-black style for LaTeX listings

I've been looking at Philip Bunge's post on how to create a "Tango" style with LaTeX listings, and trying to adapt this to make the default text style white and the background black (this is for slides, not an article!). This is what I added:
\definecolor{Black}{gray}{0.0}
\definecolor{White}{gray}{0.9}
...
\lstset{
basicstyle=\color{White},
backgroundcolor=\color{Black},
...
}
This assumes that basicstyle sets the default style of all text. The listings documentation says this:
basicstyle is selected at the beginning of each listing. You could use \footnotesize,
\small, \itshape, \ttfamily, or something like that. The last token of must not read any following characters.
The output of this still shows "default" text as black. It is possible to set more style directives that cover most tokens in a given programming language, but even doing this some tokens (such as brackets and other punctuation) will be missed. What did I do wrong?
The following code worked for me, but I converted the .dvi file to a .pdf in order to have the text appear as white, so it might have been your viewer? I'm using xdvi and xpdf.
\documentclass[a4paper, 11pt]{article}
\usepackage{listings}
\usepackage{color}
\definecolor{theWhite}{gray}{0.9}
\definecolor{theBlack}{gray}{0.0}
\lstset { basicstyle=\color{theWhite}, backgroundcolor=\color{theBlack} }
\begin{document}
\begin{lstlisting}
((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
\end{lstlisting}
\end{document}
I hope that helps!

Resources