texlive[64672] Master/texmf-dist: centeredline (10oct22)
commits+karl at tug.org
commits+karl at tug.org
Mon Oct 10 22:22:06 CEST 2022
Revision: 64672
http://tug.org/svn/texlive?view=revision&revision=64672
Author: karl
Date: 2022-10-10 22:22:05 +0200 (Mon, 10 Oct 2022)
Log Message:
-----------
centeredline (10oct22)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/centeredline/README.md
trunk/Master/texmf-dist/tex/latex/centeredline/centeredline.sty
Modified: trunk/Master/texmf-dist/doc/latex/centeredline/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/centeredline/README.md 2022-10-10 20:21:43 UTC (rev 64671)
+++ trunk/Master/texmf-dist/doc/latex/centeredline/README.md 2022-10-10 20:22:05 UTC (rev 64672)
@@ -2,9 +2,9 @@
Author: Jean-Francois Burnol
Package: centeredline
- Version: 1.1 (2019/05/03)
+ Version: 1.2 (2022/10/10)
License: LPPL 1.3c
- Copyright (C) 2019 Jean-Francois Burnol
+ Copyright (C) 2019, 2022 Jean-Francois Burnol
<jfbu at free dot fr>
# DESCRIPTION #
@@ -13,22 +13,38 @@
\centeredline{....}
-to get the argument centered, in a better way than with `\centerline`:
+to get the argument centered, without ending the current paragraph, and
+without adding extra vertical spacing, in a better way than if using
+`\centerline`:
1. `\verb` or other catcode changes inside the argument are allowed,
-2. the centering (with respect to the surrounding text paragraph) will
+2. The centering (with respect to the surrounding text paragraph) will
be as expected if this all happens inside an item from a LaTeX list
environment.
+3. One does not need to use `\newline` before and after (or at least
+ leave a space token after). Doing so does not hurt, though.
-Material whose natural width exceeds the linewidth will get properly
-centered too.
+The macro itself may be used while in paragraph or in vertical mode.
+Like `\centerline`, if used in vertical mode, it does not enter
+paragraph mode.
-The macro itself may be encountered in paragraph or in vertical mode.
-It places the argument inside a `\hbox` (inside an extra simple group).
+The macro places its argument in a `\hbox` and assignments done inside
+the argument see thus their scope limited to the line.
+The macro is usable from inside a (paragraph mode) table cell.
-# HISTORY #
+It can be nested (for example the argument is a `tabular` or a `\parbox`
+and inside it another `\centeredline` is used).
+Material whose natural width exceeds the line width will get properly
+centered too, the extra width going into the margins (or into the
+neighboring cells, if used in a paragraph mode table cell).
+
+
+# CHANGE LOG #
+
+Initial statement:
+
I have used this macro since 2013 and it has served me well.
I am making it public as is, without any re-thinking about whether it may
@@ -36,11 +52,15 @@
Suggestions for improvements are welcome, and will be recorded although I do
not expect to update the package anytime soon.
-
-# CHANGE LOG #
-
- v1.0 (2019/04/27): First release.
-- v1.1 (2019/05/03): Improved description (this file).
+- v1.1 (2019/05/03): Improve this README.
+- v1.2 (2022/10/10):
+ * make the macro usable in table cells
+ (thanks to Antoine Missier for pointing out this limitation;
+ see his package `spacingtricks` for another centering macro)
+ * avoid an extra empty line if the macro is used following a `\\`
+ or a `\newline` (but why should it be? ;-) )
+ (thanks to Kroum Tzanev for a related discussion)
# LICENSE #
Modified: trunk/Master/texmf-dist/tex/latex/centeredline/centeredline.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/centeredline/centeredline.sty 2022-10-10 20:21:43 UTC (rev 64671)
+++ trunk/Master/texmf-dist/tex/latex/centeredline/centeredline.sty 2022-10-10 20:22:05 UTC (rev 64672)
@@ -1,26 +1,18 @@
%% File: centeredline.sty
-%% Version: 1.1 (2019/05/03)
+%% Version: 1.2 (2022/10/10)
%% License: LPPL 1.3c
-%% Copyright (C) 2019 Jean-Francois Burnol <jfbu at free dot fr>
+%% Copyright (C) 2019, 2022 Jean-Francois Burnol <jfbu at free dot fr>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{centeredline}[2019/05/03 v1.1 centering a line the JFB way]
+\ProvidesPackage{centeredline}[2022/10/10 v1.2 centering a line the JFB way]
% \centeredline: OUR OWN LITTLE MACRO FOR CENTERING LINES
%
-% 7 mars 2013
-% \ignorespaces added June 9, 2013
+% March 7, 2013 : first version
+% June 9, 2013 : \ignorespaces added
+% Oct. 10, 2022 : \unpenalty\newline replaces \\\relax
%
-% This macro allows to conveniently center a line inside a paragraph and still
-% allow usage therein of \verb or other macros changing catcodes.
-%
-% It works nicely in list environments (as it uses \linewidth, not \hsize...;
-% maybe there is an even better LaTeX parameter to use, but I don't know
-% LaTeX2e that well enough and never typeset in two-column mode.)
-%
-% Note: \centeredline is scope limiting for assignments done during execution
-% of its argument.
-%
+% See README.md for documentation.
\newcommand*\centeredline{%
- \ifhmode \\\relax
+ \ifhmode \unpenalty\newline
\def\centeredline@@{\hss\egroup\hskip\z at skip\ignorespaces}%
\else
\def\centeredline@@{\hss\egroup}%
More information about the tex-live-commits
mailing list.