diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-09-30 16:49:42 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-09-30 16:49:42 +0200 |
| commit | de306ceccf9edccf08c890742f124b157444b679 (patch) | |
| tree | e29d6507d5a04ec3a57aa325c4b5932b651c5f13 | |
| parent | a360ae9ebf8c76adbd8e2390eba0a7b9651de90c (diff) | |
| download | unterricht-de306ceccf9edccf08c890742f124b157444b679.tar.gz unterricht-de306ceccf9edccf08c890742f124b157444b679.zip | |
add new ruletoend command drawing a rule for the remaining hsize
| -rw-r--r-- | latex/common.tex | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/latex/common.tex b/latex/common.tex index 55f6c2b6..031af2c4 100644 --- a/latex/common.tex +++ b/latex/common.tex @@ -117,3 +117,36 @@ \DeclarePairedDelimiter\abs{\lvert}{\rvert}% \newcommand{\dist}[1]{\abs{\overline{#1}}} + +% Commands to determine the remaining hsize of a line +% See: https://tex.stackexchange.com/questions/17349/is-there-a-way-to-measure-the-remaining-space-of-a-line-of-text +\newcommand{\currentsidemargin}{% + \ifodd\value{page}% + \oddsidemargin% + \else% + \evensidemargin% + \fi% +} + +\newlength{\whatsleft} + +\newcommand{\measureremainder}[1]{% +\begin{tikzpicture}[overlay,remember picture] + % Helper nodes + \path (current page.north west) ++(\hoffset, -\voffset) + node[anchor=north west, shape=rectangle, inner sep=0, minimum width=\paperwidth, minimum height=\paperheight] + (pagearea) {}; + + + \path (pagearea.north west) ++(1in+\currentsidemargin,-1in-\topmargin-\headheight-\headsep) + node[anchor=north west, shape=rectangle, inner sep=0, minimum width=\textwidth, minimum height=\textheight] + (textarea) {}; + + % Measure distance to right text border + \path let \p0 = (0,0), \p1 = (textarea.east) in + [/utils/exec={\pgfmathsetlength#1{\x1-\x0}\global#1=#1}]; + +\end{tikzpicture}% +} + +\newcommand{\ruletoend}[1]{\measureremainder{\whatsleft}\rule{\whatsleft}{#1}} |
