90 lines
1.8 KiB
TeX
90 lines
1.8 KiB
TeX
\documentclass[ngerman,german,10pt,a5paper,final,twoside,titlepage]{scrbook}
|
|
\usepackage[utf8]{inputenc}
|
|
\usepackage[T1]{fontenc}
|
|
\usepackage{babel}
|
|
\usepackage{graphicx}
|
|
\usepackage{calc}
|
|
|
|
|
|
\newlength{\mylength}
|
|
|
|
\newcommand{\fooo}[1]{ % Befehl zur Berechnung der Wortlänge
|
|
\settowidth{\mylength}{#1} % Breite des Wortes berechnen und in Längenvariable speichern
|
|
\hspace{\mylength}
|
|
}
|
|
|
|
|
|
\begin{document}
|
|
|
|
%\berechnewortlaenge{Hallo} % Beispielaufruf
|
|
|
|
%\hspace{\blaenge{Hallo}}. aa
|
|
|
|
%\blaenge{Hallo}
|
|
\textbf{Antwort:}
|
|
|
|
\fooo{\textbf{Antwort:}}blub
|
|
|
|
\textbf{Antwort222:}
|
|
|
|
\fooo{\textbf{Antwort222:}}blub2
|
|
|
|
|
|
\rule{\textwidth}{1pt}
|
|
%%%%%Test zur Ermittlung der Breite eines Buchstabens (ich glaube es heisst hier Tiefe)
|
|
|
|
%\the\fontcharwd\font`\f
|
|
|
|
\the\fontcharwd\font`x
|
|
|
|
\the\fontcharwd\font`y
|
|
|
|
\the\fontcharwd\font`W
|
|
|
|
|
|
\newdimen\mywidth
|
|
\setbox0=\hbox{\textbf{Antwort: }}
|
|
\mywidth=\wd0
|
|
|
|
|
|
|
|
|
|
|
|
\rule{\textwidth}{1pt}
|
|
%https://tex.stackexchange.com/questions/495009/how-to-get-depth-and-other-lengths-of-a-font
|
|
%https://tex.stackexchange.com/questions/18576/get-width-of-a-given-text-as-length
|
|
\setbox0\hbox{x}
|
|
height: \the\ht0\par
|
|
depth: \the\dp0\par
|
|
width: \the\wd0
|
|
|
|
% use even registers in 0-9 as local scratch registers
|
|
\setbox0\hbox{x}
|
|
\setbox2\hbox{yf}
|
|
distance above the x: \the\dimexpr\ht2-\ht0\relax\par
|
|
distance below the x: \the\dimexpr\dp2-\dp0\relax
|
|
|
|
%https://texwelt.de/fragen/1315/was-macht-der-befehl-strut
|
|
{\huge \textbf{!}} \raisebox{-0.5\height+\ht\strutbox}{Nachfolgender Text}
|
|
|
|
|
|
|
|
|
|
|
|
%\newcommand{\berechnewortlaenge}[1]{ % Befehl zur Berechnung der Wortlänge
|
|
|
|
%\newlength{\wortlaenge} % Neue Längenvariable erstellen
|
|
|
|
% \settowidth{\wortlaenge}{#1} % Breite des Wortes berechnen und in Längenvariable speichern
|
|
%Die Länge des Wortes \textit{#1} beträgt \the\wortlaenge.
|
|
%}
|
|
|
|
%\berechnewortlaenge{\textbf{Antwort:}} % Beispielaufruf
|
|
|
|
|
|
|
|
|
|
|
|
\end{document}
|
|
|