summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-01-01 20:50:34 +0000
committerKarl Berry <karl@freefriends.org>2024-01-01 20:50:34 +0000
commit75b739cfeea6b5159a4d97c63dc210fec5ff1ae8 (patch)
treea130a1ca1f43eba5e14d22ad5511295583aa108c
parent4d8ff3b2a5b9ca8f62591a036088152d0e7e6879 (diff)
freealign (1jan24)
git-svn-id: svn://tug.org/texlive/trunk@69267 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/freealign/README3
-rw-r--r--Master/texmf-dist/doc/latex/freealign/freealign.pdfbin0 -> 51001 bytes
-rw-r--r--Master/texmf-dist/doc/latex/freealign/freealign.tex62
-rw-r--r--Master/texmf-dist/tex/latex/freealign/freealign.sty70
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rw-r--r--Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/freealign.tlpsrc0
7 files changed, 137 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/freealign/README b/Master/texmf-dist/doc/latex/freealign/README
new file mode 100644
index 00000000000..5ea9b1d1cde
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/freealign/README
@@ -0,0 +1,3 @@
+Package: Align math formulas in different lines
+Author: Jianrui Lyu <tolvjr@163.com>
+License: The LaTeX Project Public License 1.3c \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/freealign/freealign.pdf b/Master/texmf-dist/doc/latex/freealign/freealign.pdf
new file mode 100644
index 00000000000..4a16b2551c6
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/freealign/freealign.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/freealign/freealign.tex b/Master/texmf-dist/doc/latex/freealign/freealign.tex
new file mode 100644
index 00000000000..4c1a5944937
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/freealign/freealign.tex
@@ -0,0 +1,62 @@
+% -*- coding: utf-8 -*-
+\documentclass[oneside,12pt]{article}
+\usepackage[a4paper,margin=2cm]{geometry}
+
+\newcommand*{\myversion}{2024A}
+\newcommand*{\mydate}{Version \myversion\ (\the\year-\mylpad\month-\mylpad\day)}
+\newcommand*{\mylpad}[1]{\ifnum#1<10 0\the#1\else\the#1\fi}
+
+\setlength{\parindent}{0pt}
+\setlength{\parskip}{4pt plus 1pt minus 1pt}
+
+\usepackage{freealign}
+\usepackage{codehigh}
+\usepackage{hyperref}
+\hypersetup{
+ colorlinks=true,
+ urlcolor=blue3,
+ linkcolor=green3,
+}
+
+
+\begin{document}
+
+\title{\textsf{\color{green3}FreeAlign: Align math formulas in different lines}}
+\author{Jianrui Lyu (tolvjr@163.com)}
+\date{\mydate}
+\maketitle
+
+This package provides several commands for aligning math formulas in different lines.
+Here is the first example:
+
+\vskip1em\hrule
+We have $(a+b)^2 \? = (a+b)(a+b)$ \\
+ \+$= a^2+2ab+b^2$\hfill$\cdots\cdots$2 points
+\vskip0.6em\hrule\vskip0.5em
+\begin{codehigh}
+We have $(a+b)^2 \? = (a+b)(a+b)$ \\
+ \+$= a^2+2ab+b^2$\hfill$\cdots\cdots$2 points
+\end{codehigh}
+
+The \verb!\?! command \underline{inside} the first formula saves current horizontal position,
+and the \verb!\+! command \underline{before} the second formula jumps to previously saved position.
+
+Here is another example:
+
+\vskip1em\hrule
+We have \? $(a+b)^2 = (a+b)(a+b)$ \\
+ \< $= a^2+2ab+b^2$ \hfill$\cdots\cdots$2 points
+\vskip0.6em\hrule\vskip0.5em
+\begin{codehigh}
+We have \? $(a+b)^2 = (a+b)(a+b)$ \\
+ \< $= a^2+2ab+b^2$ \hfill$\cdots\cdots$2 points
+\end{codehigh}
+
+The \verb!\?! command \underline{before} the first formula saves current horizontal position,
+and the \verb!\<! command \underline{before} the second formula jumps to the left
+of previously saved position by the width of $=$.
+
+Because this package uses \verb!zref! package to save positions,
+you need two compilations to get correct results.
+
+\end{document}
diff --git a/Master/texmf-dist/tex/latex/freealign/freealign.sty b/Master/texmf-dist/tex/latex/freealign/freealign.sty
new file mode 100644
index 00000000000..a00717045c2
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/freealign/freealign.sty
@@ -0,0 +1,70 @@
+% -*- coding: utf-8 -*-
+% ----------------------------------------------------------------------------
+% Author: Jianrui Lyu <tolvjr@163.com>
+% License: The LaTeX Project Public License 1.3c
+% ----------------------------------------------------------------------------
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{freealign}[2024-01-01 v2024A Align math formulas in different lines]
+
+\RequirePackage{etoolbox,zref-savepos}
+
+\@ifundefined{zsaveposx}{\let\zsaveposx\zsavepos}{} % 旧版本无 \zsaveposx 命令
+
+\newcounter{saveposcnt}
+\newcounter{useposcnt}
+\renewcommand*{\thesaveposcnt}{savepos\number\value{saveposcnt}}
+\renewcommand*{\theuseposcnt}{usepos\number\value{useposcnt}}
+
+\def\my@alignment@offset{}
+
+\def\my@alignment@list{}
+\forcsvlist{\listadd\my@alignment@list}{=,<,>,\le,\ge,\leq,\geq,\approx}
+
+\newlength{\my@alignment@kern}
+
+\newcommand*{\my@alignment@check}[1]{%
+ \ifx\my@let@token #1%
+ \def\my@alignment@offset{5}%
+ \expandafter\listbreak
+ \fi
+}
+
+\newcommand{\my@alignment@next}{%
+ \ifdefempty{\my@alignment@offset}{%
+ \def\my@alignment@offset{0}%
+ \forlistloop{\my@alignment@check}{\my@alignment@list}%
+ }{}%
+ \settowidth{\my@alignment@kern}{$\mkern\my@alignment@offset mu$}%
+ \stepcounter{saveposcnt}%
+ \rlap{\kern\my@alignment@kern\zsaveposx{\thesaveposcnt}}%
+}
+
+\newcommand*{\tabpoint}[1][]{%
+ \leavevmode
+ \def\my@alignment@offset{#1}%
+ \futurelet\my@let@token\my@alignment@next
+}
+\let \? = \tabpoint
+
+\newcommand*{\tabto}{%
+ \stepcounter{useposcnt}%
+ \zsaveposx{\theuseposcnt}%
+ \noindent
+ \hskip\zposx{\thesaveposcnt}sp\relax
+ \hskip-\zposx{\theuseposcnt}sp\relax
+ \ignorespaces
+}
+\let \+ = \tabto
+
+\newcommand*{\tableft}{%
+ \settowidth{\my@alignment@kern}{$=\mkern5mu$}%
+ \stepcounter{useposcnt}%
+ \zsaveposx{\theuseposcnt}%
+ \noindent
+ \hskip\zposx{\thesaveposcnt}sp\relax
+ \hskip-\zposx{\theuseposcnt}sp\relax
+ \hskip-\my@alignment@kern
+ \ignorespaces
+}
+\let \< = \tableft
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 6d86a578245..875f5a8e7f8 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -357,7 +357,7 @@ my @TLP_working = qw(
fouridx fourier fouriernc
fp fpl
fragmaster fragments frame framed francais-bst frankenstein frcursive
- frederika2016 frege frenchmath frimurer frletter frontespizio
+ frederika2016 freealign frege frenchmath frimurer frletter frontespizio
froufrou frpseudocode
ftc-notebook ftcap ftnxtra
fullblck fullminipage fullwidth
diff --git a/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc b/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc
index 3faa9f2a0ee..8bedec3e26d 100644
--- a/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc
@@ -100,6 +100,7 @@ depend fixmath
depend fnspe
depend formal-grammar
depend fouridx
+depend freealign
depend functan
depend galois
depend gastex
diff --git a/Master/tlpkg/tlpsrc/freealign.tlpsrc b/Master/tlpkg/tlpsrc/freealign.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/freealign.tlpsrc