Skip to content

Commit

Permalink
Add multi_lang documentation (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
kai-tub authored Nov 14, 2020
1 parent d03caee commit e1c67ca
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
# *.ps
# *.eps
# *.pdf

# Only used for debugging
Dockerfile
# my personal notes
notes.txt
## Generated if empty string is given at "Please type another file name for output:"
.pdf

Expand Down
53 changes: 48 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ A presentation theme for LaTeX-Beamer that is truly
minimalistic, so that the focus is on the presenter and
not on the slides.

Requires the packages [fira](https://ctan.org/pkg/fira) and
Requires the packages [fira](https://ctan.org/pkg/fira), [noto](https://ctan.org/pkg/noto), and
[silence](https://ctan.org/pkg/silence)
to be installed on your system.
To build the [beamertheme-pure-minimalistic-demo.tex](beamertheme-pure-minimalistic-demo.tex) file,
Expand All @@ -23,7 +23,6 @@ To build the [beamertheme-pure-minimalistic-demo.tex](beamertheme-pure-minimalis
[fontaxes](https://ctan.org/pkg/fontaxes), and
[mwe](https://ctan.org/pkg/mwe) are also required.

<!-- <a href="https://www.buymeacoffee.com/kaitub" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/arial-blue.png" alt="Buy Me A Coffee" style="height: 20px !important;width: 81px !important;" ></a> -->
<a href="https://www.buymeacoffee.com/kaitub" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/arial-blue.png" alt="Buy Me A Coffee" width="162px" height="40px"/></a>

</div>
Expand All @@ -36,11 +35,13 @@ To build the [beamertheme-pure-minimalistic-demo.tex](beamertheme-pure-minimalis
- [Light mode](#light-mode)
- [Download](#download)
- [Instructions](#instructions)
- [Multi-language support](#multi-language-support)
- [Customize](#customize)
- [Customize Logos](#customize-logos)
- [Color](#color)
- [Fonts](#fonts)
- [Footer options](#footer-options)
- [Extras](#extras)
- [Release status](#release-status)
- [License](#license)
- [Contributing](#contributing)
Expand Down Expand Up @@ -108,7 +109,27 @@ LaTeX source file. Then include the theme by writing:
\usetheme[]{pureminimalistic}
```


# Multi-language support
The beamer theme allows users to choose their favorite _LaTeX engine_.
As a result, the theme does not even try to enforce any hard
requirements.

The user should set the correct language and font settings, not
the theme. The theme comes with preloaded fonts, to allow
most _Latin script-based_ countries to use the theme without any
changes, but is easy to configure for other scripts.

For a quick guide on how to use _non-latin scripts_ and
multiple languages in one document see the
following [multi-language README](https://github.com/kai-tub/latex-beamer-pure-minimalistic/tree/master/multi_lang_examples/README.md).

[Here](https://raw.githubusercontent.com/wiki/kai-tub/latex-beamer-pure-minimalistic/multi_lang_examples/lang_comparison.png) are some examples for a _right-to-left_ language (Arabic),
a _standard_ non-latin script (Greek) and a language with special
typographical requirements (Japanese):

[![multi-lang-examples](https://raw.githubusercontent.com/wiki/kai-tub/latex-beamer-pure-minimalistic/multi_lang_examples/lang_comparison.png)](https://github.com/kai-tub/latex-beamer-pure-minimalistic/tree/master/multi_lang_examples/README.md)

# Customize

All options and commands are also described in detail in the
Expand All @@ -123,7 +144,7 @@ folder `logos` relative to the `.sty` file with the names:
But you can easily change the logos used.
There are 3 commands used to define which logos
are used and how they are formatted:
- `\logotitle` – Command used for title page. Here `\linewidth`
- `\logotitle` – Command used for the title page. Here `\linewidth`
corresponds to the entire paper width.
- `\logoheader` – Command used for the header. Here `\linewidth`
corresponds to a smaller box, as the horizontal space is
Expand Down Expand Up @@ -204,14 +225,21 @@ To use the Noto fonts:

![noto-fonts](https://raw.githubusercontent.com/wiki/kai-tub/latex-beamer-pure-minimalistic/minimal_examples/noto_font.png)

If you prefer the default fonts _or_ load your own fonts, disable the Fira Fonts with:
If you prefer the default fonts _or_ load custom fonts, disable the Fira Fonts with:

```latex
\usetheme[customfont, darkmode]{pureminimalistic}
```

![default-fonts](https://raw.githubusercontent.com/wiki/kai-tub/latex-beamer-pure-minimalistic/minimal_examples/default_font.png)

For more information on how to load the custom fonts or
use multiple languages in a document, see the [multi-language README](https://github.com/kai-tub/latex-beamer-pure-minimalistic/tree/master/multi_lang_examples/README.md).

**Important:** By default `beamer` uses _sans-serif_ fonts,
so if you define your own font-settings, be sure to set
sans-serif and not the default font settings!

## Footer options

**Show max slide numbers**
Expand Down Expand Up @@ -255,6 +283,21 @@ To change the word _Page_ in the footer, define a different word with:

![custom-page-word](https://raw.githubusercontent.com/wiki/kai-tub/latex-beamer-pure-minimalistic/minimal_examples/custom_page_word.png)

# Extras
This theme also provides a new environment `vfilleditems`.
It automatically inserts space between items, depending
on the remaining space. Use it with:

```latex
\begin{vfilleditems}
\item My first point
\item My second point
\item My third point
\end{vfilleditems}
```

![vfilleditems](https://raw.githubusercontent.com/wiki/kai-tub/latex-beamer-pure-minimalistic/minimal_examples/vfilleditems.png)

# Release status
The next steps and thoughts about the upcoming release
with possible features can be seen on the [project
Expand Down
2 changes: 1 addition & 1 deletion beamertheme-pure-minimalistic-demo.tex
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
% should also look nice for the classic aspectratio
% of course, than the text has to be refitted
% \documentclass{beamer}
% Will be ignored if LuaTeX engine is used
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetheme[darkmode, showmaxslides]{pureminimalistic}
% \renewcommand{\pageword}{}
Expand Down
20 changes: 20 additions & 0 deletions minimal_examples/vfilleditems.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

\documentclass[aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usetheme[darkmode]{pureminimalistic}

\title[\LaTeX{} vfilleditems]{Long title}
\author{Kai Norman Clasen}
\institute{}
\date{\today}

\begin{document}
\begin{frame}{vfilleditems}
\begin{vfilleditems}
\item My first point
\item My second point
\item My third point
\end{vfilleditems}
\end{frame}
\end{document}
87 changes: 87 additions & 0 deletions multi_lang_examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Short multi-language Guide
This is a quick guide on how to _correctly_ use multiple
languages in a single document, or how to use non-latin scripts:

![multi-lang-examples](https://raw.githubusercontent.com/wiki/kai-tub/latex-beamer-pure-minimalistic/multi_lang_examples/lang_comparison.png)

In both cases, I **highly** recommend using a `UTF-8` based
engine, such as [_LuaLateX_](http://www.luatex.org/) or [_XeTeX_](https://ctan.org/pkg/xetex). I develop and test the beamer-theme
with _LuaLaTeX_, as it has better support for
_special_ languages such as [Japanese](https://www.ctan.org/pkg/luatexja) and [right-to-left written
languages](https://en.wikibooks.org/wiki/LaTeX/Internationalization).
As a result, I suggest _LuaLaTeX_ over _XeTeX_.

For a more detailed discussion for why a `UTF-8`-based engine is necessary in the first place, see the introductory discussion
on [Overleaf](https://www.overleaf.com/learn/latex/Articles/Unicode,_UTF-8_and_multilingual_text:_An_introduction).

If you chose LuaLaTeX or XeTeX, the next step is to decide on the
language package. Here, I _highly_ recommend to use the
`babel` package over the `polyglossia` package.

The `babel` package allows to easily switch to the correct font
if a different script is encountered and automatically
makes many typographical adjustments.
These typographical adjustments are especially important for
_right-to-left_ written languages.
For a full tutorial see the [Overleaf](https://de.overleaf.com/learn/latex/Multilingual_typesetting_on_Overleaf_using_babel_and_fontspec) tutorial, or the [babel guide](https://ctan.org/pkg/babel).


Some notable points:
- Beamer uses `sans serif` fonts as the default font!
- Sans serif fonts are easier to read and should be used
- As a result, we need to set the fonts with `\babelfont{sf}{...}`
- Custom fonts should be installed system-wide
- The example files use local versions so that the files can be
compiled in the CI/CD pipeline
- Check out the example files to see how local fonts can be used

So let's see how we use the Greek script:

```latex
% Load as usual
\documentclass[aspectratio=169]{beamer}
\usetheme[darkmode, showmaxslides]{pureminimalistic}
% Load babel instead of polyglossia
\usepackage{babel}
% Define the main language to greek
% By default typographical adjustments according
% to the greek language are used
\babelprovide[import, main]{greek}
% Import english as a second language
\babelprovide[import]{english}
% \babelfont automatically loads fontspec package!
% For the greek language (here our default language)
% we set the font to Noto Sans
% Make sure to install the fonts system-wide!
\babelfont[greek]{sf}{Noto Sans}
% For the english language we set the font to
% Fira Sans
\babelfont[english]{sf}{Fira Sans}
\begin{document}
\begin{frame}{Σύγκριση}
Γεια πως εισαι?
{
% Use english defaults for typographical adjustments
% and Fira Sans Fonts!
\selectlanguage{english}
Short example with a different language
}
\end{frame}
\end{document}
```

To support a right-to-left language, we only need to
change two lines!
```latex
\usepackage[bidi=basic]{babel}
\babelprovide[main, import]{arabic}
```
So by default, the Arabic typographical settings are used.
This will also affect the theme to automatically set the
title and logos from right-to-left!

For Japanese, I recommend using the `luatexja-fontspec` package.
See the [example file](japan_example.lua.tex) for a basic usage.

0 comments on commit e1c67ca

Please sign in to comment.