Archive for the ‘LaTeX’ Category.

Liste aller Beamer Themes in TeX Live

Unter https://github.com/UweZiegenhagen/LaTeX-Beamer-Theme-Overview habe ich ein Projekt begonnen, das alle in einem TeX Live vorhandenen Beamer-Themes anhand von Beispielbildern vorstellt.

Direkter Link zur Übersicht: https://github.com/UweZiegenhagen/LaTeX-Beamer-Theme-Overview/blob/main/OVERVIEW.md

Technisch funktioniert es so, dass der Name des Themes aus dem Dateinamen extrahiert wird, dazu nutze ich mein Varsfromjobname-Paket. Die einzelnen PDFs werden dann über ein Python-Skript mit LaTeX erzeugt, mittels imagemagick in einzelne PNGs zerlegt und in der Overview.md verlinkt.

Hinweis: Nicht bei allen in TeX Live vorhandenen Themes funktioniert dieser Weg, die Autoren der nicht funktionierenden Themes werde ich anschreiben.

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Silbentrennung und Kerning anzeigen mit showhyphenation und showkerning

Für LuaLaTeX gibt es mit showhyphenation und showkerning zwei interessante Pakete, die die möglichen Trennstellen bzw. das Kerning anzeigen.

%!TEX TS-program = lualatex
\documentclass[12pt,ngerman]{scrartcl}
 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{blindtext}
\usepackage{microtype}
 
\usepackage{showhyphenation}
\usepackage[ontop]{showkerning}
\begin{document}
 
\blindtext
 
\blindtext
 
 
\end{document}

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

LaTeX Briefe mit KOMA-Script und dem scrletter Paket

Neben der Nutzung der scrlttr2 Klasse gibt es in aktuelleren KOMA-Script Versionen auch die Möglichkeit, das scrletter-Paket zu nutzen. Hier ein Beispiel:

\documentclass[12pt,ngerman]{scrartcl}
 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{booktabs}
\usepackage{babel}
\usepackage{graphicx}
\usepackage{csquotes}
\usepackage{paralist}
\usepackage{xcolor}
\usepackage{palatino}
\usepackage{blindtext}
\usepackage{scrletter}
 
\setkomavar{fromname}{Max Mustermann}
\setkomavar{fromemail}{Max@Mustermann.de}
 
\setkomavar{fromaddress}{Musterweg 221, 12345 Musterstadt}
 
\setkomavar{firstfoot}{\usekomavar{fromemail}}
 
 
\begin{document}
\begin{letter}{Maria Mustermann \\ Mustergasse 1 \\ 12346 Musterstadt}
 
\opening{Hallo Maria,}
 
\blindtext[2]
 
\closing{Mit freundlichen Grüßen}
 
\end{letter}
\end{document}

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

XCharter – Der passende Mathematik-Font zur Charter

Hier ein Beispiel für das XCharter Paket, das einen passenden Mathe-Font für die Charter bereitstellt.

%!TEX TS-program = LuaLaTeX
\documentclass[12pt,ngerman]{scrartcl}
 
\usepackage{fontspec}
\usepackage{babel}
\usepackage{unicode-math}
\setmathfont{XCharter-Math.otf} % Call by file name or
\setmathfont{XCharter Math} % Call by font name
 
\setmainfont{XCharter}
\setsansfont{Cabin}[Scale=MatchLowercase] % sf
\setmonofont{Inconsolatazi4}[Scale=MatchLowercase] % tt
 
\usepackage{blindtext}
 
\begin{document}
 
\blindtext
 
\begin{equation}
\int_{x=1}^{\infty} -\frac{p}{2} \pm \sqrt{ \left(\frac{p}{2}  \right)^2 -q   } 
\end{equation}
 
\blindtext
 
\end{document}

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Pocketmod – TODO Listen in A3

Zum Thema Pocketmod hatte ich schon früher etwas geschrieben (https://www.uweziegenhagen.de/?p=1294), hier nun ein Template für ein TODO-Listen Pocket in DIN A3.

Das fertige PDF sieht dann so aus: PocketMod_for_A3

\documentclass[21pt]{scrartcl}
\usepackage[left=2cm,right=2cm, top=2cm,bottom=2cm,a3paper]{geometry}
 
\usepackage{forloop}
\setlength{\parindent}{0pt}
\usepackage{tikz}
 
\newcounter{ct} 
\usepackage{pgfpages}
 
\def\pgfpageoptionheight{\the\paperwidth} % landscaped by default
\def\pgfpageoptionwidth{\the\paperheight}
\def\pgfpageoptionborder{0pt}
\def\pgfpageoptionfirstshipout{1}
 
\pgfpagesphysicalpageoptions{%
    logical pages=8,%
    physical height=\pgfpageoptionheight,%
    physical width=\pgfpageoptionwidth,%
    current logical shipout=\pgfpageoptionfirstshipout%
}
 
    \pgfpageslogicalpageoptions{1}{%
      border shrink=\pgfpageoptionborder,%
      resized width=.25\pgfphysicalwidth,%
      border code=\pgfusepath{stroke},%
      resized height=0.5\pgfphysicalheight,%
      center=\pgfpoint{.875\pgfphysicalwidth}{.75\pgfphysicalheight}%
    }%
    \pgfpageslogicalpageoptions{2}
    {%
      border shrink=\pgfpageoptionborder,%
      resized width=.25\pgfphysicalwidth,%
      border code=\pgfusepath{stroke},%
      rotation=180,%      
      resized height=0.5\pgfphysicalheight,%
      center=\pgfpoint{.875\pgfphysicalwidth}{.25\pgfphysicalheight}%
    }%
 
    \pgfpageslogicalpageoptions{3}
    {%
      border shrink=\pgfpageoptionborder,%
      resized width=.25\pgfphysicalwidth,%
      border code=\pgfusepath{stroke},%
      rotation=180,%      
      resized height=0.5\pgfphysicalheight,%
      center=\pgfpoint{.625\pgfphysicalwidth}{.25\pgfphysicalheight}%
    }%
    \pgfpageslogicalpageoptions{4}
    {%
      border shrink=\pgfpageoptionborder,%
      resized width=.25\pgfphysicalwidth,%
      border code=\pgfusepath{stroke},%
      rotation=180,%      
      resized height=0.5\pgfphysicalheight,%
      center=\pgfpoint{.375\pgfphysicalwidth}{.25\pgfphysicalheight}%
    }%
 
    \pgfpageslogicalpageoptions{5}
    {%
      border shrink=\pgfpageoptionborder,%
      resized width=.25\pgfphysicalwidth,%
      border code=\pgfusepath{stroke},%
      rotation=180,%
      resized height=0.5\pgfphysicalheight,%
      center=\pgfpoint{.125\pgfphysicalwidth}{.25\pgfphysicalheight}%
    }%
    \pgfpageslogicalpageoptions{6}
    {%
      border shrink=\pgfpageoptionborder,%
      resized width=.25\pgfphysicalwidth,%
      border code=\pgfusepath{stroke},%
      resized height=0.5\pgfphysicalheight,%
      center=\pgfpoint{.125\pgfphysicalwidth}{.75\pgfphysicalheight}%
    }%
 
    \pgfpageslogicalpageoptions{7}
    {%
      border shrink=\pgfpageoptionborder,%
      resized width=.25\pgfphysicalwidth,%
      border code=\pgfusepath{stroke},%
      resized height=0.5\pgfphysicalheight,%
      center=\pgfpoint{.375\pgfphysicalwidth}{.75\pgfphysicalheight}%
    }%
    \pgfpageslogicalpageoptions{8}
    {%
      border shrink=\pgfpageoptionborder,%
      resized width=.25\pgfphysicalwidth,%
      border code=\pgfusepath{stroke},%
      resized height=0.5\pgfphysicalheight,%
      center=\pgfpoint{.625\pgfphysicalwidth}{.75\pgfphysicalheight}%
    }%
 
 
\begin{document}%
 
\forloop{ct}{1}{\value{ct} < 9}{%
\begin{tikzpicture}
\foreach \i in {0,...,-17}{%
\draw[very thick] (0,\i*2) -- ++(0,1.5) -- ++(1.5,0) -- ++(0,-1.5)--cycle; 
\draw[very thick] (2.5,\i*2) -- (22,\i*2);
\draw[very thick] (23,\i*2) -- ++(0,1.5) -- ++(1.5,0) -- ++(0,-1.5)--cycle; 
}
\end{tikzpicture}
\clearpage
}
 
\end{document}

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Gittermuster erstellen mit gridpapers

Hier ein Beispiel dafür, wie man mit dem gridpapers Paket Muster auf Papier bringen kann, hier ein Punktmuster.

%!TEX TS-program = Arara
% arara: pdflatex: {shell: yes}
\documentclass[12pt,ngerman]{scrartcl}
\areaset{8cm}{16cm}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\pagestyle{empty}
\usepackage[pattern=dot,% 
colorset=std,
geometry={left=2.25cm,right=1.25cm,top=1cm,bottom=1.25cm},%
textarea,%
patternsize={5mm},%
dotsize={1pt}
]{gridpapers}
 
\begin{document}
~
 
\end{document}

Auszug aus der A4-Seite:

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Dymo Labels mit LaTeX und ticket.sty gestalten

Hier ein kurzes Beispiel, wie man mit LaTeX auch Dymo-Labels erzeugen kann, im Beispiel für die Label-Größe 57*32mm. Zum allgemeinen Verständnis von ticket.sty siehe auch meinen DTK Artikel in Ausgabe 1/2021.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[landscape,paperheight=57mm,paperwidth=32mm,left=0mm,top=0mm,right=0mm,bottom=0mm]{geometry}
%\usepackage[sfdefault]{plex-sans}
\usepackage{palatino}
 
\begin{filecontents}[overwrite]{Dymo5732.tdf}
\unitlength=1mm
\hoffset=-25.4mm
\voffset=-29mm
\ticketNumbers{1}{1}
\ticketSize{57}{32} % Breite und Hoehe der Labels in mm
\ticketDistance{0}{0} % Abstand der Labels
\end{filecontents}
 
\usepackage[Dymo5732]{ticket}
 
\renewcommand{\ticketdefault}{}%
\makeatletter
\@boxedfalse % Rahmen um Ticket
\@emptycrossmarkfalse % Falzmarken
\@cutmarkfalse % Schnittmarken
\makeatother
 
\newcommand{\myticket}[2]{
\ticket{%
\put(10,10){\scalebox{#1}{\bfseries #2}}
}}
 
\newcommand{\myticketml}[4]{
\ticket{%
\put(5,20){\scalebox{#1}{\bfseries #2}}
\put(5,15){\scalebox{#1}{\bfseries #3}}
\put(5,10){\scalebox{#1}{\bfseries #4}}
}}
 
 
\begin{document}
\myticketml{1.25}{Dr. Max  Mustermann}{Musterweg 123}{54321~Musterstadt}
\myticket{2}{Steuern}
\end{document}

PDF

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Nützliche Kommandozeilen-Einzeiler für LaTeX

Unter https://gist.github.com/iwishiwasaneagle/2f91f63f3cb0107b94b501aa284a18ca gibt es eine Sammlung an nützlichen Einzeilern für die Arbeit mit LaTeX.

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Aktienkurse mit Python und LaTeX auswerten

Hier ein einfaches Beispiel, wie man mit Python und LaTeX ein PDF mit Kursinformationen erstellen kann.

Zuerst der Python-Teil, der die Apple-Kursdaten seit dem 1.1.2021 in einen Dataframe lädt und dann in eine LaTeX-Tabelle schreibt:

import pandas
import pandas_datareader.data as web
 
YAHOO_TODAY="http://download.finance.yahoo.com/d/quotes.csv?s=%s&f=sd1ohgl1vl1"
 
history = web.DataReader('AAPL', "yahoo", start="2021-1-1")
history.to_latex('aapl.tex')

Dann noch der LaTeX-Teil, der a) den Python-Code aus dem LaTeX-Lauf heraus ausführt und b) die erzeugte Tabellen-Datei nur dann einbindet, wenn sie wirklich auch erzeugt wurde.

\documentclass[12pt,ngerman]{scrartcl}
\usepackage[a4paper, top=1cm,bottom=1cm,left=1cm, right=1cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{booktabs}
 
\makeatletter
\newcommand{\testfileexists}[1]{%
  \IfFileExists{#1}%
    {\def\inputtestedfile{\@@input #1 }}
    {\let\inputtestedfile\@empty}%
}
\makeatother
 
\begin{document}
 
\write18{python runpy.py}
 
  \testfileexists{aapl}
      \inputtestedfile
 
 
\end{document}

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Farbige Boxen in LaTeX mit tcolorbox

Hier einige Beispiele für farbige Boxen mit dem tcolorbox Paket, entnommen der Paketbeschreibung

\documentclass[12pt,ngerman]{scrartcl}
 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{booktabs}
\usepackage{babel}
\usepackage{graphicx}
\usepackage{csquotes}
\usepackage{paralist}
\usepackage{xcolor}
\usepackage{blindtext}
\usepackage{microtype}
 
\usepackage{empheq}
\usepackage[most]{tcolorbox}
\tcbuselibrary{theorems}
 
\newtcbtheorem[number within=section]{mytheo}{My Theorem}%
{colback=green!5,colframe=green!35!black,fonttitle=\bfseries}{th}
 
\begin{document}
 
 
\begin{tcolorbox}
Hallo Welt!
\end{tcolorbox}
 
 
\begin{tcolorbox}
\blindtext
\end{tcolorbox}
 
\begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,title=My nice heading]
This is another \textbf{tcolorbox}.
\tcblower
Here, you see the lower part of the box.
\end{tcolorbox}
 
\begin{mytheo}{This is my title}{theoexample}
This is the text of the theorem. The counter is automatically assigned and,
in this example, prefixed with the section number. This theorem is numbered with
\ref{th:theoexample}, it is given on page~\pageref{th:theoexample}.
\end{mytheo}
 
 
\begin{equation}
\tcbset{fonttitle=\footnotesize}
\tcboxmath[colback=yellow!25!white,colframe=blue]{ a^2 = 16 }
\quad \Rightarrow \quad
\tcboxmath[colback=blue!25!white,colframe=red,title=Implication]%
{ a = 4 ~\vee~ a=-4. }
\end{equation}
 
 
\newtcbox{\otherbox}[1][]{nobeforeafter,math upper,tcbox raise base,
enhanced,frame hidden,boxrule=0pt,interior style={top color=green!10!white,
bottom color=green!10!white,middle color=green!50!yellow},
fuzzy halo=1pt with green,#1}
\begin{empheq}[box=\otherbox]{align}
a&=\sin(z)\\
E&=mc^2 + \int_a^b x\, dx
\end{empheq}
\begin{equation}
\tcbhighmath{E} = \otherbox{mc^2}
\end{equation}
 
 
\newtcolorbox{mybox}[2][]{colback=red!5!white,
colframe=red!75!black,fonttitle=\bfseries,
colbacktitle=red!85!black,enhanced,
attach boxed title to top center={yshift=-2mm},
title=#2,#1}
\begin{mybox}[colback=yellow]{Hello there}
This is my own box with a mandatory title
and options.
\end{mybox}
 
\begin{tcolorbox}[enhanced,
size=minimal,auto outer arc,
width=2.1cm,octogon arc,
colback=red,colframe=white,colupper=white,
fontupper=\fontsize{6mm}{6mm}\selectfont\bfseries\sffamily,
halign=center,valign=center,
square,arc is angular,
borderline={0.2mm}{-1mm}{red} ]
STOP
\end{tcolorbox}
 
\begin{tcolorbox}[enhanced,
size=minimal,auto outer arc,
width=2.1cm,octogon arc,
colback=green,colframe=white,colupper=black,
fontupper=\fontsize{6mm}{6mm}\selectfont\bfseries\sffamily,
halign=center,valign=center,
square,arc is angular,
borderline={0.2mm}{-1mm}{green}]
GO
\end{tcolorbox}
\end{document}

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website