texlive[42577] Master/texmf-dist: cals (25nov16)

commits+karl at tug.org commits+karl at tug.org
Fri Nov 25 23:39:45 CET 2016


Revision: 42577
          http://tug.org/svn/texlive?view=revision&revision=42577
Author:   karl
Date:     2016-11-25 23:39:44 +0100 (Fri, 25 Nov 2016)
Log Message:
-----------
cals (25nov16)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/cals/README
    trunk/Master/texmf-dist/doc/latex/cals/cals.pdf
    trunk/Master/texmf-dist/doc/latex/cals/examples/demo.pdf
    trunk/Master/texmf-dist/doc/latex/cals/examples/demo.tex
    trunk/Master/texmf-dist/doc/latex/cals/test/README
    trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_060_alignment.chk
    trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_060_alignment.tex
    trunk/Master/texmf-dist/doc/latex/cals/test/support/LatexTest.py
    trunk/Master/texmf-dist/doc/latex/cals/test/support/run_tests.py
    trunk/Master/texmf-dist/doc/latex/cals/test/table/test_40_issuerow.chk
    trunk/Master/texmf-dist/doc/latex/cals/test/table/test_50_row.chk
    trunk/Master/texmf-dist/doc/latex/cals/test/table/test_70_lrskip.chk
    trunk/Master/texmf-dist/doc/latex/cals/test/template.txt
    trunk/Master/texmf-dist/source/latex/cals/cals.dtx
    trunk/Master/texmf-dist/source/latex/cals/cals.ins
    trunk/Master/texmf-dist/source/latex/cals/cell.dtx
    trunk/Master/texmf-dist/source/latex/cals/table.dtx
    trunk/Master/texmf-dist/tex/latex/cals/cals.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/cals/examples/bididemo.pdf
    trunk/Master/texmf-dist/doc/latex/cals/examples/bididemo.tex
    trunk/Master/texmf-dist/doc/latex/cals/examples/biditable1.tex
    trunk/Master/texmf-dist/doc/latex/cals/examples/biditable2.tex
    trunk/Master/texmf-dist/doc/latex/cals/examples/biditable3.tex
    trunk/Master/texmf-dist/doc/latex/cals/examples/biditable4.tex
    trunk/Master/texmf-dist/doc/latex/cals/notes.pdf
    trunk/Master/texmf-dist/doc/latex/cals/tb101parashchenko.pdf
    trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_070_clean_backup_row.chk
    trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_070_clean_backup_row.tex
    trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_075_vstraddled_retain_rowsep.chk
    trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_075_vstraddled_retain_rowsep.tex
    trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_080_never_pagebreak_in_float.chk
    trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_080_never_pagebreak_in_float.tex
    trunk/Master/texmf-dist/source/latex/cals/rtl.dtx

Modified: trunk/Master/texmf-dist/doc/latex/cals/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/README	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/doc/latex/cals/README	2016-11-25 22:39:44 UTC (rev 42577)
@@ -4,7 +4,7 @@
 with repeatable headers and footers, with cells spanned over
 rows and columns. Decorations are supported: padding, background
 color, width of separation rules. The code is compatible with
-multicols and pdfsync.
+multicols and bidi.
 
 The work is released to public (LaTeX license, see below)
 by bitplant.de GmbH, a company which provides technical
@@ -16,7 +16,7 @@
 README:
   This file.
 
-cals.pdf:
+cals.pdf, tb101parashchenko.pdf, notes.pdf:
   Documentation.
 
 dev/
@@ -28,15 +28,16 @@
   The file "demo.pdf", produced from "demo.tex" and several
   include files, demonstrates features of the cals package.
   To re-generate demo.pdf, after you got cals.ins:
-  $ export TEXINPUTS=../cals:
+  $ ln -s ../dev/cals.sty
   $ pdflatex demo.tex
+  $ xelatex bididemo.tex
 
-tests/
+test/
   Unit tests. See "README" inside.
 
 
-Copyright (C) 2010 by Oleg Parashchenko <olpa uucode com>
- 
+Copyright (C) 2010+ by Oleg Parashchenko <olpa uucode com>
+
 Files from this pacjage may be distributed and/or modified under the
 conditions of the LaTeX Project Public License, either version 1.3c
 of this license or (at your option) any later version.
@@ -44,5 +45,5 @@
 
 http://www.latex-project.org/lppl.txt
 
-and version 1.3c or later is part of all distributions of LaTeX 
+and version 1.3c or later is part of all distributions of LaTeX
 version 2006/05/20 or later.

Modified: trunk/Master/texmf-dist/doc/latex/cals/cals.pdf
===================================================================
(Binary files differ)

Added: trunk/Master/texmf-dist/doc/latex/cals/examples/bididemo.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/cals/examples/bididemo.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/examples/bididemo.pdf	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/doc/latex/cals/examples/bididemo.pdf	2016-11-25 22:39:44 UTC (rev 42577)

Property changes on: trunk/Master/texmf-dist/doc/latex/cals/examples/bididemo.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/cals/examples/bididemo.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/examples/bididemo.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/cals/examples/bididemo.tex	2016-11-25 22:39:44 UTC (rev 42577)
@@ -0,0 +1,59 @@
+\documentclass[twocolumn]{minimal}
+\usepackage[paper=a5paper,landscape=true,margin=1cm,
+  twocolumn=true,columnsep=1cm]{geometry}
+\usepackage{helvet}
+\usepackage{times}
+\usepackage{color}
+\usepackage{fancyvrb}
+\usepackage{multicol}
+
+\usepackage[RTLdocument]{bidi}
+\usepackage{cals}
+
+\newcommand\newcolumn{\vfil\penalty-10000 }
+\newcommand\small{\fontsize{9pt}{11pt}\selectfont}
+\newcommand\Small{\fontsize{8pt}{9pt}\selectfont}
+\newcommand\Large{\fontsize{12pt}{14pt}\selectfont}
+
+\newcommand\header[1]{\noindent{\Large\bfseries#1\strut}\par\bigskip}
+
+\showboxdepth=100
+\showboxbreadth=100
+
+\begin{document}
+\makeatletter
+
+\header{CALS tables demo}
+\newcolumn
+\parindent=0pt
+by Oleg Parashchenko\par
+\textless{}olpa uucode com\textgreater\par
+\par
+24 May 2013\par
+\clearpage
+
+\header{Simple table}
+\input biditable1
+\newcolumn
+\VerbatimInput{biditable1.tex}
+\clearpage
+
+\header{Decorations}
+\input biditable2
+\newcolumn
+\VerbatimInput[fontsize=\small]{biditable2.tex}
+\clearpage
+
+\header{Cell spanning}
+\input biditable3
+\newcolumn
+\VerbatimInput[fontsize=\small]{biditable3.tex}
+\clearpage
+
+\header{Multipage table (in a multicols in a table)}
+\input biditable4
+\newcolumn
+\VerbatimInput[fontsize=\small]{biditable4.tex}
+\clearpage
+
+\end{document}

Added: trunk/Master/texmf-dist/doc/latex/cals/examples/biditable1.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/examples/biditable1.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/cals/examples/biditable1.tex	2016-11-25 22:39:44 UTC (rev 42577)
@@ -0,0 +1,18 @@
+\begin{calstable}
+\colwidths{{3cm}{4cm}}
+\thead{
+ I'm a caption in the header\par
+ \bfseries
+ \brow \cell{head 1.1}\cell{head 1.2} \erow
+ \brow \cell{head 2.1}\cell{head 2.2} \erow
+ \mdseries}
+
+\tfoot{
+ \brow \cell{foot 1.1} \cell{foot 1.2} \erow
+ \lastrule
+ I'm a caption in the footer\par}
+
+\brow \cell{body 1.1}\cell{body 1.2} \erow
+\brow \cell{body 2.1}\cell{body 2.2} \erow
+\brow \cell{body 3.1}\cell{body 3.2} \erow
+\end{calstable}

Added: trunk/Master/texmf-dist/doc/latex/cals/examples/biditable2.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/examples/biditable2.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/cals/examples/biditable2.tex	2016-11-25 22:39:44 UTC (rev 42577)
@@ -0,0 +1,33 @@
+\makeatletter
+\newcommand\bbrow{\brow\setbox\cals at current@row=
+ \hbox{\vbox to 2.9cm{}}}
+
+\newenvironment{decotable}{\begin{calstable}
+\fontsize{15pt}{17pt}\selectfont
+\cals at setpadding{Ag}\cals at setcellprevdepth{Al}
+\cals at paddingL=0pt \relax
+\cals at paddingR=0pt \relax
+\def\cals at framecs@width{2pt}
+\def\cals at rs@width{8pt}
+\def\cals at cs@width{4pt}
+}{\end{calstable}}
+
+\begin{decotable}
+\colwidths{{2.9cm}{2.9cm}{2.9cm}}
+\bbrow
+ \cell{left,\\top}
+ \alignC \cell{center,\\top}
+ \def\cals at borderL{0pt}\def\cals at borderB{0pt}
+ \alignR \cell{right,\\top} \erow
+ \let\cals at borderL=\relax \let\cals at borderB=\relax
+\bbrow
+ \alignL \cell{\vfil left,\\middle}
+ \alignC \cell{\vfil center,\\middle}
+ \alignR \cell{\vfil right,\\middle} \erow
+\bbrow
+ \def\cals at bgcolor{green}
+ \alignL \cell{\vfill left,\\bottom}
+ \def\cals at bgcolor{}
+ \alignC \cell{\vfill center,\\bottom}
+ \alignR \cell{\vfill right,\\bottom} \erow
+\end{decotable}

Added: trunk/Master/texmf-dist/doc/latex/cals/examples/biditable3.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/examples/biditable3.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/cals/examples/biditable3.tex	2016-11-25 22:39:44 UTC (rev 42577)
@@ -0,0 +1,33 @@
+\makeatletter \let\olderow=\erow
+\def\erow{\ht\cals at current@row=1.3cm \olderow}
+
+\begin{calstable}
+\def\cals at framecs@width{.4pt}
+\def\cals at framers@width{.4pt}
+\colwidths{{1.3cm}}
+\brow
+  \cell{a6} \cell{b6} \cell{c6}
+  \cell{d6} \cell{e6} \cell{f6} \erow
+\brow
+  \cell{a5} \nullcell{ltb} \nullcell{tb}
+  \nullcell{rtb}\spancontent{b5, c5, d5}
+  \nullcell{ltr} \cell{f5} \erow
+\brow
+  \cell{a4} \nullcell{ltr} \nullcell{tl}
+  \nullcell{tr} \nullcell{lr} \cell{f4} \erow
+\brow
+  \cell{a3} \nullcell{lr} \nullcell{lb}
+  \nullcell{rb}\spancontent{c3, c4, d3, d4}
+  \nullcell{lrb}\spancontent{e3, e4, e5}
+  \cell{f3} \erow
+\brow
+  \cell{a2}
+  \nullcell{lrb}\spancontent{b2, b3, b4}
+  \nullcell{ltb} \nullcell{tb}
+  \nullcell{tbr}\spancontent{c2, d2, e2}
+  \cell{f2} \erow
+\brow
+  \cell{a1} \cell{b1} \cell{c1}
+  \cell{d1} \cell{e1} \cell{f1} \erow
+\end{calstable}
+\let\erow=\olderow

Added: trunk/Master/texmf-dist/doc/latex/cals/examples/biditable4.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/examples/biditable4.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/cals/examples/biditable4.tex	2016-11-25 22:39:44 UTC (rev 42577)
@@ -0,0 +1,32 @@
+\begin{calstable}
+\colwidths{{1cm}{7cm}{1cm}}
+\brow \cell{x} \cell{x} \cell{x} \erow
+\brow \cell{x} \cell{
+\columnsep=0cm\relax
+% Force multicols to regard our \leftskip
+% by pretending that we are a list.
+\@totalleftmargin=\cals at paddingL\relax
+\begin{multicols}{2}
+
+\begin{calstable}
+\alignR
+\colwidths{{1.5cm}{1.5cm}}
+\thead{\brow \cell{$n$}\cell{$n^2$} \erow}
+\tfoot{\brow \cell{$n$}\cell{$n^2$} \erow}
+\brow \cell{2}  \cell{4}   \erow
+\brow \cell{3}  \cell{9}   \erow
+\brow \cell{4}  \cell{16}  \erow
+\brow \cell{5}  \cell{25}  \erow
+\brow \cell{6}  \cell{36}  \erow
+\tbreak{\break }
+\brow \cell{7}  \cell{49}  \erow
+\brow \cell{8}  \cell{64}  \erow
+\brow \cell{9}  \cell{81}  \erow
+\brow \cell{10} \cell{100} \erow
+\brow \cell{11} \cell{121} \erow
+\end{calstable}
+
+\end{multicols}
+} \cell{x} \erow
+\brow \cell{x} \cell{x} \cell{x} \erow
+\end{calstable}

Modified: trunk/Master/texmf-dist/doc/latex/cals/examples/demo.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/cals/examples/demo.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/examples/demo.tex	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/doc/latex/cals/examples/demo.tex	2016-11-25 22:39:44 UTC (rev 42577)
@@ -8,15 +8,7 @@
 \usepackage{fancyvrb}
 \usepackage{multicol}
 \usepackage{cals}
-\usepackage{pdfsync}
 
-% pdfsync setup. The command \pdfsyncstart is not defined yet,
-% therefore I use "def" instead of "let".
-\makeatletter
-\let\oldcalstable=\calstable
-\def\calstable{\oldcalstable\pdfsyncstop}
-\def\cals at AtBeginCell{\pdfsyncstart}
-
 \newcommand\newcolumn{\vfil\penalty-10000 }
 \newcommand\small{\fontsize{9pt}{11pt}\selectfont}
 \newcommand\Small{\fontsize{8pt}{9pt}\selectfont}

Added: trunk/Master/texmf-dist/doc/latex/cals/notes.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/cals/notes.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/notes.pdf	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/doc/latex/cals/notes.pdf	2016-11-25 22:39:44 UTC (rev 42577)

Property changes on: trunk/Master/texmf-dist/doc/latex/cals/notes.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/cals/tb101parashchenko.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/cals/tb101parashchenko.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/tb101parashchenko.pdf	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/doc/latex/cals/tb101parashchenko.pdf	2016-11-25 22:39:44 UTC (rev 42577)

Property changes on: trunk/Master/texmf-dist/doc/latex/cals/tb101parashchenko.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/latex/cals/test/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/test/README	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/doc/latex/cals/test/README	2016-11-25 22:39:44 UTC (rev 42577)
@@ -9,6 +9,7 @@
 Expect that the tests in the directory "visual_tables" fail.
 Depending on the OS and TeX distro version, the font drawing
 might look different.
+17 Nov 2014: the tests in "visual_tables" are disabled.
 
 Probably I need to package the unit testing code as a separate
 package and publish an article about it.

Modified: trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_060_alignment.chk
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_060_alignment.chk	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_060_alignment.chk	2016-11-25 22:39:44 UTC (rev 42577)
@@ -12,7 +12,6 @@
 ..\glue 50.0
 ..\vbox(100.0+0.0)x240.0 []
 ..\glue 0.0
-.\glue 0.0
 .\penalty 10000
 .\vbox(0.0+0.0)x290.0
 ..\hbox(50.0+0.0)x290.0 []
@@ -26,6 +25,7 @@
 ..\glue 50.0
 ..\hbox(50.0+0.0)x240.0 []
 ..\glue 0.0
+.\penalty 10000
 .\hbox(0.0+0.0)x290.0
 ..\glue 50.0
 ..\glue -0.2
@@ -48,7 +48,6 @@
 ..\glue 0.0 plus 1.0fil
 ..\vbox(100.0+0.0)x240.0 []
 ..\glue 0.0 plus 1.0fil
-.\glue 0.0
 .\penalty 10000
 .\vbox(0.0+0.0)x400.0
 ..\hbox(50.0+0.0)x400.0, glue set 80.0fil []
@@ -62,6 +61,7 @@
 ..\glue 0.0 plus 1.0fil
 ..\hbox(50.0+0.0)x240.0 []
 ..\glue 0.0 plus 1.0fil
+.\penalty 10000
 .\hbox(0.0+0.0)x400.0, glue set 80.0fil
 ..\glue 0.0 plus 1.0fil
 ..\glue -0.2
@@ -84,7 +84,6 @@
 ..\glue 0.0 plus 1.0fil
 ..\vbox(100.0+0.0)x240.0 []
 ..\glue 0.0
-.\glue 0.0
 .\penalty 10000
 .\vbox(0.0+0.0)x400.0
 ..\hbox(50.0+0.0)x400.0, glue set 160.0fil []
@@ -98,6 +97,7 @@
 ..\glue 0.0 plus 1.0fil
 ..\hbox(50.0+0.0)x240.0 []
 ..\glue 0.0
+.\penalty 10000
 .\hbox(0.0+0.0)x400.0, glue set 160.0fil
 ..\glue 0.0 plus 1.0fil
 ..\glue -0.2

Modified: trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_060_alignment.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_060_alignment.tex	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_060_alignment.tex	2016-11-25 22:39:44 UTC (rev 42577)
@@ -1,6 +1,6 @@
 \def\w{\ht\cals at current@row=50pt\relax}
 \def\mktable{%
-\begin{calstable}
+\begin{calstable}[n]
 \colwidths{{70pt}{80pt}{90pt}}
 \def\cals at framecs@width{\cals at cs@width}
 \def\cals at framers@width{\cals at rs@width}

Added: trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_070_clean_backup_row.chk
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_070_clean_backup_row.chk	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_070_clean_backup_row.chk	2016-11-25 22:39:44 UTC (rev 42577)
@@ -0,0 +1 @@
+> the letter Y.

Added: trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_070_clean_backup_row.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_070_clean_backup_row.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_070_clean_backup_row.tex	2016-11-25 22:39:44 UTC (rev 42577)
@@ -0,0 +1,18 @@
+%
+% Collision of two tables when a table is started in an unexpected moment
+% http://tex.stackexchange.com/questions/167400/fancyhdr-and-cals-vertical-merge-problem
+%
+
+\setbox\cals at backup@row=\hbox{nonsense}
+
+\begin{calstable}
+\colwidths{{90pt}}
+\brow
+\nullcell{ltr}
+\erow
+\brow
+\nullcell{lbr}\spancontent{spanned}
+\erow
+\end{calstable}
+
+\show Y

Added: trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_075_vstraddled_retain_rowsep.chk
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_075_vstraddled_retain_rowsep.chk	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_075_vstraddled_retain_rowsep.chk	2016-11-25 22:39:44 UTC (rev 42577)
@@ -0,0 +1,14 @@
+%
+% Between the 2&3 rows with a vertically straddled cell
+%
+> \cals at last@rs at below=macro:
+->{{100pt}{0pt}{0pt}{0pt}}{{100pt}{0pt}{0pt}{0pt}}.
+> \cals at current@rs at above=macro:
+->{{100pt}{0pt}{0pt}{0pt}}{{100pt}{0pt}{0pt}{0pt}}.
+%
+% Between the first row and the straddled 2&3
+%
+> \cals at last@rs at below=macro:
+->{{100pt}{0.4pt}{0.4pt}{0.4pt}}{{100pt}{0.4pt}{0.4pt}{0.4pt}}.
+> \cals at current@rs at above=macro:
+->{{100pt}{0pt}{0pt}{0pt}}{{100pt}{0pt}{0pt}{0pt}}.

Added: trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_075_vstraddled_retain_rowsep.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_075_vstraddled_retain_rowsep.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_075_vstraddled_retain_rowsep.tex	2016-11-25 22:39:44 UTC (rev 42577)
@@ -0,0 +1,38 @@
+% http://tex.stackexchange.com/questions/159814/miss-the-bottom-line-of-the-frame-header-of-the-cals-table-on-the-first-page
+
+% The first row should be inside a border, because the rules are
+% switched off after the row is made. However, the straddled rows
+% "forget" about the first row decoration. Fix it.
+
+% Mock
+\renewcommand\cals at rs@joinTwo[3]{\show#2\show#3}
+
+\begin{calstable}
+\colwidths{{100pt}{100pt}}
+\def\cals at borderT{0.4pt}
+\def\cals at borderB{0.4pt}
+\def\cals at borderL{0.4pt}
+\def\cals at borderR{0.4pt}
+
+\brow
+\cell{head1}
+\cell{head2}
+\erow
+
+\def\cals at borderT{0pt}
+\def\cals at borderB{0pt}
+\def\cals at borderL{0pt}
+\def\cals at borderR{0pt}
+
+\brow
+\nullcell{ltr}
+\cell{text 2}
+\erow
+
+\brow
+\nullcell{blr}
+\spancontent{2}
+\cell{text 2}
+\erow
+
+\end{calstable}

Added: trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_080_never_pagebreak_in_float.chk
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_080_never_pagebreak_in_float.chk	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_080_never_pagebreak_in_float.chk	2016-11-25 22:39:44 UTC (rev 42577)
@@ -0,0 +1,4 @@
+> \cals at last@context=the letter n.
+> \cals at last@context=the letter b.
+> \cals at last@context=the letter b.
+> \cals at last@context=the letter b.

Added: trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_080_never_pagebreak_in_float.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_080_never_pagebreak_in_float.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/cals/test/regression/test_080_never_pagebreak_in_float.tex	2016-11-25 22:39:44 UTC (rev 42577)
@@ -0,0 +1,46 @@
+% Don't break inside a float
+
+% Mock
+\let\issue at orig=\cals at issue@row
+\renewcommand\cals at issue@row{%
+\show\cals at last@context
+\issue at orig}
+
+% Start float at the end of page, so that the table breaking code
+% think it should split over page.
+Start of text\par
+\dimen0=\pagegoal\relax
+\advance\dimen0 by -5cm\relax
+\vskip\dimen0\relax
+here we are\par
+
+\newcommand\www{\ht\cals at current@row=2.5cm}
+
+\vbox{%
+\begin{calstable}
+\colwidths{{0.25in}{1.5in}{1.5in}{1.5in}}
+%
+\brow \cell{}\cell{C1}\cell{C2}\cell{C3} \www\erow
+%
+\brow
+\cell{R}
+\cell{r1c1}
+\cell{r1c2}
+\cell{r1c3}
+\www\erow
+%
+\brow \nullcell{lrt}
+\cell{r2c1}
+\cell{r2c2}
+\cell{r2c3}
+\www\erow
+%
+\brow
+\nullcell{lrb}\spancontent{S}
+\cell{r3c1}
+\cell{r3c2}
+\cell{r3c3}
+\www\erow
+\end{calstable}
+}% vbox
+\end{document}

Modified: trunk/Master/texmf-dist/doc/latex/cals/test/support/LatexTest.py
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/test/support/LatexTest.py	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/doc/latex/cals/test/support/LatexTest.py	2016-11-25 22:39:44 UTC (rev 42577)
@@ -154,7 +154,7 @@
       expected_png = os.path.join(module, png)
       got_png      = os.path.join(tmp_dir, png)
       diff_png     = os.path.join(tmp_dir, 'diff.png')
-      cmd = "compare -metric RMSE %s %s %s 2>%s" % (expected_png, got_png, diff_png, os.path.join(tmp_dir, 'compare-stdout'))
+      cmd = "compare compare -metric RMSE %s %s %s 2>%s" % (expected_png, got_png, diff_png, os.path.join(tmp_dir, 'compare-stdout'))
       os.system(cmd)
       h = open(os.path.join(tmp_dir, 'compare-stdout'))
       s = h.read()

Modified: trunk/Master/texmf-dist/doc/latex/cals/test/support/run_tests.py
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/test/support/run_tests.py	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/doc/latex/cals/test/support/run_tests.py	2016-11-25 22:39:44 UTC (rev 42577)
@@ -23,6 +23,7 @@
 if len(sys.argv) > 1:
   filter = sys.argv[1]
 test_files = glob.glob('*/test_*.tex')
+test_files = [x for x in test_files if 'visual_tables' not in x]
 modules_and_tests = {}
 for fname in test_files:
   (dir, basename) = os.path.split(fname)

Modified: trunk/Master/texmf-dist/doc/latex/cals/test/table/test_40_issuerow.chk
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/test/table/test_40_issuerow.chk	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/doc/latex/cals/test/table/test_40_issuerow.chk	2016-11-25 22:39:44 UTC (rev 42577)
@@ -25,3 +25,4 @@
 ....\rule(20.0+0.0)x200.0
 ....\glue 0.0 plus 1.0fil
 ..\glue 0.0
+.\penalty 10000

Modified: trunk/Master/texmf-dist/doc/latex/cals/test/table/test_50_row.chk
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/test/table/test_50_row.chk	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/doc/latex/cals/test/table/test_50_row.chk	2016-11-25 22:39:44 UTC (rev 42577)
@@ -47,11 +47,13 @@
 ....\rule(20.0+0.0)x200.0
 ....\glue 0.0 plus 1.0fil
 ..\glue 0.0
-%
-% Output procesure forcing
-%
-.\glue 0.0
 .\penalty 10000
+% %
+% % Output procesure forcing
+% % 18.11.2016: conditionally
+% %
+% .\glue 0.0
+% .\penalty 10000
 %
 % Row 2, colsep
 %
@@ -97,3 +99,4 @@
 ....\rule(40.0+0.0)x200.0
 ....\glue 0.0 plus 1.0fil
 ..\glue 0.0
+.\penalty 10000

Modified: trunk/Master/texmf-dist/doc/latex/cals/test/table/test_70_lrskip.chk
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/test/table/test_70_lrskip.chk	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/doc/latex/cals/test/table/test_70_lrskip.chk	2016-11-25 22:39:44 UTC (rev 42577)
@@ -22,8 +22,6 @@
 ....\glue 0.0 plus 1.0fil
 ....\glue 0.0
 ..\glue 150.0
-% thead+row1 break workaround
-.\glue 0.0
 .\penalty 10000
 % rowsep
 .\hbox(0.0+0.0)x300.0

Modified: trunk/Master/texmf-dist/doc/latex/cals/test/template.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/cals/test/template.txt	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/doc/latex/cals/test/template.txt	2016-11-25 22:39:44 UTC (rev 42577)
@@ -15,6 +15,7 @@
 \input{decor.dtx}
 \input{colsep.dtx}
 \input{rowsep.dtx}
+\input{rtl.dtx}
 \fi
 
 % Variables defined inside calstable environment

Modified: trunk/Master/texmf-dist/source/latex/cals/cals.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/cals/cals.dtx	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/source/latex/cals/cals.dtx	2016-11-25 22:39:44 UTC (rev 42577)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 2010 by Oleg Parashchenko <olpa at uucode.com>
+% Copyright (C) 2010-2017 by Oleg Parashchenko <olpa at uucode.com>
 % -------------------------------------------------------
 % 
 % This file may be distributed and/or modified under the
@@ -22,7 +22,7 @@
 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
 %<package>\ProvidesPackage{cals}
 %<*package>
-    [2013/05/24 CALS tables v.2.2]
+    [2016/11/23 CALS tables v.2.4.1]
 %</package>
 %
 %<*driver>
@@ -58,6 +58,8 @@
 %   Right brace   \}     Tilde         \~}
 %
 %
+% \changes{v2.4.1}{2016/11/23}{Bug fixes for row separation lines.}
+% \changes{v2.4}{2014/11/12}{Built-in RTL (right-to-left) support.}
 % \changes{v2.2}{2013/05/27}{Hooks for bidi support.}
 % \changes{v2.1}{2013/05/24}{Alignment of tables works.}
 % \changes{v2.0}{2010/10/08}{Complete rewrite with different approach}
@@ -80,7 +82,7 @@
 % with repeatable headers and footers, with cells spanned over
 % rows and columns. Decorations are supported: padding, background
 % color, width of separation rules. The code is compatible with
-% multicols, pdfsync and bidi.
+% multicols and bidi.
 %
 % The work is released to public (\LaTeX{} license)
 % by \url{bitplant.de}~GmbH, a company which provides technical
@@ -89,20 +91,22 @@
 % \section{Usage}
 %
 % The users' guide is a separate document, published in TUGboat 2011:2:
-% \url{http://tug.org/TUGboat/tb32-2/tb101parashchenko.pdf}
+% \url{http://tug.org/TUGboat/tb32-2/tb101parashchenko.pdf}. There are
+% examples on CTAN: \url{https://www.ctan.org/pkg/cals}.
 %
 % The most important feature: the table (its rows) must start in a
 % vertical mode, the cells content should switch to a horizontal mode.
+% For using the commands with the |@| symbol you might need to say
+% |\makeatletter| first.
 %
-% Please post questions and suggestions to TeX-SX
-% (\url{http://tex.stackexchange.com/}), the newsgroup
-% |comp.text.tex| and the |texhax| mailing list (see
-% \url{http://tug.org/mailman/listinfo/texhax}),
-% not directly to me.
+% Please post questions and suggestions to the |texhax| mailing list
+% (\url{http://tug.org/mailman/listinfo/texhax}) or on \TeX-\LaTeX{}
+% Stack Exchange site (\url{http://tex.stackexchange.com/}) with the
+% tag |cals|.
 %
 % Summary of the user interface:
 % \begin{verbatim}
-% \begin{calstable}
+% \begin{calstable} % [n|l|c|r]
 % \colwidths{{100pt}{200pt}}
 % \brow \cell{a} \cell{b} \erow
 % \end{calstable}
@@ -110,8 +114,11 @@
 %
 % Table elements: |\thead|, |\tfoot|, |\tbreak{\penalty-10000}|, |\lastrule|.
 %
-% Alignment: |\alignL|, |\alignC|, |\alignR|, |\vfill|.
+% Table alignment: |l|, |c|, |r| for left, center and right;
+% |n| for none, using the default |\leftskip| and |\rightskip|.
 %
+% In-cell alignment: |\alignL|, |\alignC|, |\alignR|, |\vfill|.
+%
 % Padding: lengths |\cals at paddingL| (|...T,R,B|), set by |\cals at setpadding{Ag}|,
 % baseline alignment |\cals at paddingD|, set by |\cals at setcellprevdepth{Al}|.
 %
@@ -158,6 +165,7 @@
 % elements. The second part starts with the common code,
 % then explains in-row decorations (column separation and cells
 % background) and between-row decorations (row separation).
+
 %
 % \input{cell.dtx}
 % \input{span.dtx}
@@ -166,6 +174,7 @@
 % \input{decor.dtx}
 % \input{colsep.dtx}
 % \input{rowsep.dtx}
+% \input{rtl.dtx}
 
 %
 % \Finale

Modified: trunk/Master/texmf-dist/source/latex/cals/cals.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/cals/cals.ins	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/source/latex/cals/cals.ins	2016-11-25 22:39:44 UTC (rev 42577)
@@ -42,6 +42,7 @@
     \from{decor.dtx}{package}
     \from{colsep.dtx}{package}
     \from{rowsep.dtx}{package}
+    \from{rtl.dtx}{package}
   }}
 
 \obeyspaces

Modified: trunk/Master/texmf-dist/source/latex/cals/cell.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/cals/cell.dtx	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/source/latex/cals/cell.dtx	2016-11-25 22:39:44 UTC (rev 42577)
@@ -219,21 +219,34 @@
 % by assigning skip to dimen.
 %    \begin{macrocode}
 \newcommand\alignL{%
-\dimen0=\cals at paddingL \cals at paddingL=\dimen0 \relax
-\dimen0=\cals at paddingR \cals at paddingR=\dimen0 \relax}
+\cals at vfillDrop\cals at paddingL
+\cals at vfillDrop\cals at paddingR}
 
 \newcommand\alignC{%
-\dimen0=\cals at paddingL \cals at paddingL=\dimen0 plus 1fill\relax
-\dimen0=\cals at paddingR \cals at paddingR=\dimen0 plus 1fill\relax}
+\cals at vfillAdd\cals at paddingL
+\cals at vfillAdd\cals at paddingR}
 
 \newcommand\alignR{%
-\dimen0=\cals at paddingL \cals at paddingL=\dimen0 plus 1fill\relax
-\dimen0=\cals at paddingR \cals at paddingR=\dimen0 \relax}
+\cals at vfillAdd\cals at paddingL
+\cals at vfillDrop\cals at paddingR}
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
 % \end{macro}
 
+% \begin{macro}{\cals at vfillAdd}
+% \begin{macro}{\cals at vfillDrop}
+% Add or remove the |vfill|-part of a skip. Retain the existing
+% value if possible.
+%    \begin{macrocode}
+\newcommand\cals at vfillAdd[1]{\ifnum\gluestretchorder#1>1\relax\else
+\dimen0=#1\relax #1=\dimen0 plus 1fill\relax \fi}
+\newcommand\cals at vfillDrop[1]{\ifnum\gluestretchorder#1>0\relax
+\dimen0=#1\relax #1=\dimen0\relax \fi}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+
 % \subsection{From cells to a row}
 
 % \begin{macro}{\cals at current@row}

Added: trunk/Master/texmf-dist/source/latex/cals/rtl.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/cals/rtl.dtx	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/cals/rtl.dtx	2016-11-25 22:39:44 UTC (rev 42577)
@@ -0,0 +1,42 @@
+% \subsection{RTL (right-to-left) hooks}
+
+% \begin{macro}{\if at RTL}
+% \begin{macro}{\if at RTLtab}
+% \begin{macro}{\@RTLtabtrue}
+% Provide RTL status commands even if the RTL packages are not loaded.
+%    \begin{macrocode}
+\def\next{%
+  \let\if at RTL=\iffalse
+  \let\if at RTLtab=\iffalse
+  \let\@RTLtabtrue=\relax
+}
+\ifdefined\if at RTL \relax \else \next \fi
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+
+% \begin{macro}{\cals at setup@alignment}
+% Swap alignment in the RTL mode.
+%    \begin{macrocode}
+\newcommand\cals at setup@alignment[1]{%
+\if c#1\relax \cals at vfillAdd \leftskip \cals at vfillAdd \rightskip \fi
+\if at RTL
+ \if l#1\relax \cals at vfillAdd \leftskip \cals at vfillDrop\rightskip \fi
+ \if r#1\relax \cals at vfillDrop\leftskip \cals at vfillDrop\rightskip \fi
+\else
+ \if l#1\relax \cals at vfillDrop\leftskip \cals at vfillDrop\rightskip \fi
+ \if r#1\relax \cals at vfillAdd \leftskip \cals at vfillDrop\rightskip \fi
+\fi
+}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\cals at hskip@lr}
+% Do |hskip| with the first argument, unless in the RTL mode.
+%    \begin{macrocode}
+\newcommand\cals at hskip@lr[2]{%
+\if at RTL \hskip#2\relax \else \hskip#1\relax \fi}
+%    \end{macrocode}
+% \end{macro}
+

Modified: trunk/Master/texmf-dist/source/latex/cals/table.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/cals/table.dtx	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/source/latex/cals/table.dtx	2016-11-25 22:39:44 UTC (rev 42577)
@@ -59,8 +59,12 @@
  \let\cals at current@context=\cals at backup@context
 \fi\fi\fi
 %    \end{macrocode}
-% Typeset the row.
+% Typeset the row. If the width of the row is more than hsize, then
+% the issue-code should not fit the row to hsize.
 %    \begin{macrocode}
+\ifdim\wd\cals at current@row>\hsize\relax
+\def\cals at tohsize{}%
+\fi
 \cals at issue@row
 %    \end{macrocode}
 % Consider a table such that thead+row1 do not fit to a page
@@ -76,8 +80,15 @@
 % the first row of a table chunk.
 %    \begin{macrocode}
 \ifx b\cals at last@context
- \ifx h\cals at last@context at bak \vskip0pt \penalty10000 \fi
- \ifx n\cals at last@context at bak \vskip0pt \penalty10000 \fi
+  {\dimen0=\pagetotal\relax
+  \advance\dimen0 by \cals at tfoot@height\relax
+  \advance\dimen0 by -\pagegoal
+  \ifdim\dimen0>0pt\relax
+    \vskip\dimen0
+    \penalty9999 % with 10000, the output page builder is not called
+    \vskip-\dimen0\relax
+  \fi
+  }%
 \fi
 }
 %    \end{macrocode}
@@ -100,6 +111,7 @@
  \setbox\cals at backup@row=\vbox{\box\cals at current@row}%
  \setbox\cals at backup@cs=\box\cals at current@cs
  \let\cals at backup@rs at above=\cals at current@rs at above
+ \let\cals at backup@last at rs@below=\cals at last@rs at below
  \let\cals at backup@context=\cals at last@context
  \cals at backup@leftskip=\leftskip\relax
  \cals at backup@rightskip=\rightskip\relax
@@ -120,6 +132,7 @@
  \setbox\cals at current@row=\box\cals at backup@row
  \setbox\cals at current@cs=\box\cals at backup@cs
  \let\cals at current@rs at above=\cals at backup@rs at above
+ \let\cals at last@rs at below=\cals at backup@last at rs@below
  \let\cals at last@context=\cals at backup@context
  \leftskip=\cals at backup@leftskip
  \rightskip=\cals at backup@rightskip
@@ -190,6 +203,7 @@
 % If the user sets |\cals at tbreak@tokens| (using |\tbreak|),
 % break is forced. Otherwise, no break is allowed:
 % \begin{itemize}
+% \item inside a box (= inside a float)
 % \item In the header
 % \item In the footer
 % \item Immediately after the header
@@ -206,22 +220,23 @@
 \let\cals at tmp=\cals at iffalse
 \let\cals at tmpII=\cals at iftrue
 \ifx\relax\cals at tbreak@tokens
- \ifx h\cals at current@context \else
-  \ifx f\cals at current@context \else
-   \ifx h\cals at last@context \else
-    \ifx n\cals at last@context \else
-      \dimen0=\pagetotal\relax
-      \advance\dimen0 by \ht\cals at current@row\relax
-      %\showthe\ht\cals at current@row\relax
-      \ifx \cals at tfoot@tokens\relax \else
-        %\show\cals at tfoot@height\relax
-        \advance\dimen0 by \cals at tfoot@height\relax
-      \fi
-      %\showthe\dimen0\relax
-      \ifdim \dimen0>\pagegoal\relax
-        \let\cals at tmp=\cals at tmpII
-      \fi
- \fi\fi\fi\fi
+ \ifinner\else
+  \ifx h\cals at current@context \else
+   \ifx f\cals at current@context \else
+    \ifx h\cals at last@context \else
+     \ifx n\cals at last@context \else
+       \dimen0=\pagetotal\relax
+       \advance\dimen0 by \ht\cals at current@row\relax
+       %\showthe\ht\cals at current@row\relax
+       \ifx \cals at tfoot@tokens\relax \else
+         %\show\cals at tfoot@height\relax
+         \advance\dimen0 by \cals at tfoot@height\relax
+       \fi
+       %\showthe\dimen0\relax
+       \ifdim \dimen0>\pagegoal\relax
+         \let\cals at tmp=\cals at tmpII
+       \fi
+ \fi\fi\fi\fi\fi
 \else \let\cals at tmp=\cals at tmpII % tbreak at tokens
 \fi
 \cals at tmp}
@@ -261,6 +276,9 @@
 % \begin{macro}{\cals at deactivate@rtl}
 % \begin{macro}{\cals at hbox}
 % For bidi support, use |\hboxR| instead of |\hbox|.
+% Actually, more is required for bidi support, and
+% these macros are retained only as "legacy".
+% Otherwise I'd move the code into the beginning of `calstable`.
 %    \begin{macrocode}
 \newcommand\cals at hbox{}
 \newcommand\cals at activate@rtl{\let\cals at hbox=\hboxR}
@@ -278,11 +296,11 @@
 %    \begin{macrocode}
 \newcommand\cals at issue@rowsep at alone{%
 \setbox0=\cals at hbox\cals at tohsize{%
- \hskip\leftskip
+ \cals at hskip@lr\leftskip\rightskip
  \cals at rs@sofar at reset
  \cals at rs@joinOne\cals at framers@width\cals at current@rs at above
  \cals at rs@sofar at end
- \hskip\rightskip}%
+ \cals at hskip@lr\rightskip\leftskip}%
 \ht0=0pt \dp0=0pt \box0 }
 %    \end{macrocode}
 % \end{macro}
@@ -304,11 +322,11 @@
    \let\cals at tmpIII=\cals at rs@width     \else
    \let\cals at tmpIII=\cals at bodyrs@width \fi
  \setbox0=\cals at hbox\cals at tohsize{%
-  \hskip\leftskip
+  \cals at hskip@lr\leftskip\rightskip
   \cals at rs@sofar at reset
   \cals at rs@joinTwo\cals at tmpIII\cals at last@rs at below\cals at current@rs at above
   \cals at rs@sofar at end
-  \hskip\rightskip}%
+  \cals at hskip@lr\rightskip\leftskip}%
  \ht0=0pt \dp0=0pt \box0 %
 \fi}
 %    \end{macrocode}
@@ -332,7 +350,8 @@
 % Decorations: first the column separation, then the row separation.
 %    \begin{macrocode}
 \nointerlineskip
-\setbox0=\vtop{\cals at hbox\cals at tohsize{\hskip\leftskip \box\cals at current@cs \hskip\rightskip}}%
+\setbox0=\vtop{\cals at hbox\cals at tohsize{\cals at hskip@lr\leftskip\rightskip
+\box\cals at current@cs \cals at hskip@lr\rightskip\leftskip}}%
 \ht0=0pt\relax\box0
 \nointerlineskip
 \cals at issue@rowsep
@@ -340,9 +359,11 @@
 %    \end{macrocode}
 % Output the row, update the last context.
 %    \begin{macrocode}
-\cals at hbox\cals at tohsize{\hskip\leftskip \box\cals at current@row \hskip\rightskip}%
+\cals at hbox\cals at tohsize{\cals at hskip@lr\leftskip\rightskip
+\box\cals at current@row \cals at hskip@lr\rightskip\leftskip}%
 \let\cals at last@rs at below=\cals at current@rs at below
-\let\cals at last@context=\cals at current@context}
+\let\cals at last@context=\cals at current@context
+\nobreak}
 %    \end{macrocode}
 % \end{macro}
 
@@ -351,7 +372,8 @@
 % \begin{environment}{\calstable}
 % Setup the parameters and let the row dispatcher to do all the work.
 %    \begin{macrocode}
-\newenvironment{calstable}{%
+\newenvironment{calstable}[1][\cals at table@alignment]{%
+\if at RTL\@RTLtabtrue\cals at activate@rtl\fi
 \let\cals at thead@tokens=\relax
 \let\cals at tfoot@tokens=\relax
 \let\cals at tbreak@tokens=\relax
@@ -358,7 +380,8 @@
 \cals at tfoot@height=0pt \relax
 \let\cals at last@context=n%
 \let\cals at current@context=b%
-\parindent=0pt %
+\parindent=0pt \relax%
+\cals at setup@alignment{#1}%
 \cals at setpadding{Ag}\cals at setcellprevdepth{Al}\cals at set@tohsize%
 %% Alignment inside is independent on center/flushright outside
 \parfillskip=0pt plus1fil\relax
@@ -366,6 +389,14 @@
 \let\cals at borderR=\relax
 \let\cals at borderT=\relax
 \let\cals at borderB=\relax
+%    \end{macrocode}
+% Bug fix for \url{http://tex.stackexchange.com/questions/167400/fancyhdr-and-cals-vertical-merge-problem}.
+% Table inside a table is ok, but when there are 1) page break inside
+% a table in the text flow, and 2) a table with a vertically straddled
+% cell is created in the output procedure, then this table inside table
+% needs additional cleaning.
+%    \begin{macrocode}
+\setbox\cals at backup@row=\box\voidb at x\relax
 \cals at AtBeginTable
 }{% End of the table
 \cals at tfoot@tokens\lastrule\cals at AtEndTable}
@@ -432,3 +463,19 @@
 \newcommand\tbreak[1]{\def\cals at tbreak@tokens{#1}}
 %    \end{macrocode}
 % \end{macro}
+
+% \begin{macro}{\cals at table@alignment}
+% The default alignment of tables in the text flow.
+% Doesn't affect the text alignment inside cells.
+% \begin{itemize}
+% \item |n|: no settings, the default |\leftskip| and |\rightskip| are used
+% \item |l|: align left
+% \item |c|: align center
+% \item |r|: align right
+% \end{itemize}
+% This setting is appeared in the version 2.3. Earlier versions
+% worked as it were |n|.
+%    \begin{macrocode}
+\newcommand\cals at table@alignment{l}
+%    \end{macrocode}
+% \end{macro}

Modified: trunk/Master/texmf-dist/tex/latex/cals/cals.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/cals/cals.sty	2016-11-25 22:39:28 UTC (rev 42576)
+++ trunk/Master/texmf-dist/tex/latex/cals/cals.sty	2016-11-25 22:39:44 UTC (rev 42577)
@@ -12,6 +12,7 @@
 %% decor.dtx  (with options: `package')
 %% colsep.dtx  (with options: `package')
 %% rowsep.dtx  (with options: `package')
+%% rtl.dtx  (with options: `package')
 %% 
 %% This is a generated file.
 %% 
@@ -29,9 +30,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
 \ProvidesPackage{cals}
-    [2013/05/24 CALS tables v.2.2]
+    [2016/11/23 CALS tables v.2.4.1]
 
 
+
 \newcommand\cals at cell[3]{}
 \def\cals at cell#1#2{%
 \vbox\bgroup%
@@ -106,18 +108,23 @@
 \cals at paddingD=\dimen0 }
 
 \newcommand\alignL{%
-\dimen0=\cals at paddingL \cals at paddingL=\dimen0 \relax
-\dimen0=\cals at paddingR \cals at paddingR=\dimen0 \relax}
+\cals at vfillDrop\cals at paddingL
+\cals at vfillDrop\cals at paddingR}
 
 \newcommand\alignC{%
-\dimen0=\cals at paddingL \cals at paddingL=\dimen0 plus 1fill\relax
-\dimen0=\cals at paddingR \cals at paddingR=\dimen0 plus 1fill\relax}
+\cals at vfillAdd\cals at paddingL
+\cals at vfillAdd\cals at paddingR}
 
 \newcommand\alignR{%
-\dimen0=\cals at paddingL \cals at paddingL=\dimen0 plus 1fill\relax
-\dimen0=\cals at paddingR \cals at paddingR=\dimen0 \relax}
+\cals at vfillAdd\cals at paddingL
+\cals at vfillDrop\cals at paddingR}
 
+\newcommand\cals at vfillAdd[1]{\ifnum\gluestretchorder#1>1\relax\else
+\dimen0=#1\relax #1=\dimen0 plus 1fill\relax \fi}
+\newcommand\cals at vfillDrop[1]{\ifnum\gluestretchorder#1>0\relax
+\dimen0=#1\relax #1=\dimen0\relax \fi}
 
+
 \newbox\cals at current@row
 
 \newcommand\colwidths[1]{}
@@ -260,10 +267,20 @@
  \let\cals at current@rs at below=\cals at backup@rs at below
  \let\cals at current@context=\cals at backup@context
 \fi\fi\fi
+\ifdim\wd\cals at current@row>\hsize\relax
+\def\cals at tohsize{}%
+\fi
 \cals at issue@row
 \ifx b\cals at last@context
- \ifx h\cals at last@context at bak \vskip0pt \penalty10000 \fi
- \ifx n\cals at last@context at bak \vskip0pt \penalty10000 \fi
+  {\dimen0=\pagetotal\relax
+  \advance\dimen0 by \cals at tfoot@height\relax
+  \advance\dimen0 by -\pagegoal
+  \ifdim\dimen0>0pt\relax
+    \vskip\dimen0
+    \penalty9999 % with 10000, the output page builder is not called
+    \vskip-\dimen0\relax
+  \fi
+  }%
 \fi
 }
 
@@ -272,6 +289,7 @@
  \setbox\cals at backup@row=\vbox{\box\cals at current@row}%
  \setbox\cals at backup@cs=\box\cals at current@cs
  \let\cals at backup@rs at above=\cals at current@rs at above
+ \let\cals at backup@last at rs@below=\cals at last@rs at below
  \let\cals at backup@context=\cals at last@context
  \cals at backup@leftskip=\leftskip\relax
  \cals at backup@rightskip=\rightskip\relax
@@ -287,6 +305,7 @@
  \setbox\cals at current@row=\box\cals at backup@row
  \setbox\cals at current@cs=\box\cals at backup@cs
  \let\cals at current@rs at above=\cals at backup@rs at above
+ \let\cals at last@rs at below=\cals at backup@last at rs@below
  \let\cals at last@context=\cals at backup@context
  \leftskip=\cals at backup@leftskip
  \rightskip=\cals at backup@rightskip
@@ -308,22 +327,23 @@
 \let\cals at tmp=\cals at iffalse
 \let\cals at tmpII=\cals at iftrue
 \ifx\relax\cals at tbreak@tokens
- \ifx h\cals at current@context \else
-  \ifx f\cals at current@context \else
-   \ifx h\cals at last@context \else
-    \ifx n\cals at last@context \else
-      \dimen0=\pagetotal\relax
-      \advance\dimen0 by \ht\cals at current@row\relax
-      %\showthe\ht\cals at current@row\relax
-      \ifx \cals at tfoot@tokens\relax \else
-        %\show\cals at tfoot@height\relax
-        \advance\dimen0 by \cals at tfoot@height\relax
-      \fi
-      %\showthe\dimen0\relax
-      \ifdim \dimen0>\pagegoal\relax
-        \let\cals at tmp=\cals at tmpII
-      \fi
- \fi\fi\fi\fi
+ \ifinner\else
+  \ifx h\cals at current@context \else
+   \ifx f\cals at current@context \else
+    \ifx h\cals at last@context \else
+     \ifx n\cals at last@context \else
+       \dimen0=\pagetotal\relax
+       \advance\dimen0 by \ht\cals at current@row\relax
+       %\showthe\ht\cals at current@row\relax
+       \ifx \cals at tfoot@tokens\relax \else
+         %\show\cals at tfoot@height\relax
+         \advance\dimen0 by \cals at tfoot@height\relax
+       \fi
+       %\showthe\dimen0\relax
+       \ifdim \dimen0>\pagegoal\relax
+         \let\cals at tmp=\cals at tmpII
+       \fi
+ \fi\fi\fi\fi\fi
 \else \let\cals at tmp=\cals at tmpII % tbreak at tokens
 \fi
 \cals at tmp}
@@ -346,11 +366,11 @@
 
 \newcommand\cals at issue@rowsep at alone{%
 \setbox0=\cals at hbox\cals at tohsize{%
- \hskip\leftskip
+ \cals at hskip@lr\leftskip\rightskip
  \cals at rs@sofar at reset
  \cals at rs@joinOne\cals at framers@width\cals at current@rs at above
  \cals at rs@sofar at end
- \hskip\rightskip}%
+ \cals at hskip@lr\rightskip\leftskip}%
 \ht0=0pt \dp0=0pt \box0 }
 
 \newcommand\cals at issue@rowsep{%
@@ -359,11 +379,11 @@
    \let\cals at tmpIII=\cals at rs@width     \else
    \let\cals at tmpIII=\cals at bodyrs@width \fi
  \setbox0=\cals at hbox\cals at tohsize{%
-  \hskip\leftskip
+  \cals at hskip@lr\leftskip\rightskip
   \cals at rs@sofar at reset
   \cals at rs@joinTwo\cals at tmpIII\cals at last@rs at below\cals at current@rs at above
   \cals at rs@sofar at end
-  \hskip\rightskip}%
+  \cals at hskip@lr\rightskip\leftskip}%
  \ht0=0pt \dp0=0pt \box0 %
 \fi}
 
@@ -371,17 +391,21 @@
 
 \newcommand\cals at issue@row{%
 \nointerlineskip
-\setbox0=\vtop{\cals at hbox\cals at tohsize{\hskip\leftskip \box\cals at current@cs \hskip\rightskip}}%
+\setbox0=\vtop{\cals at hbox\cals at tohsize{\cals at hskip@lr\leftskip\rightskip
+\box\cals at current@cs \cals at hskip@lr\rightskip\leftskip}}%
 \ht0=0pt\relax\box0
 \nointerlineskip
 \cals at issue@rowsep
 \nointerlineskip
-\cals at hbox\cals at tohsize{\hskip\leftskip \box\cals at current@row \hskip\rightskip}%
+\cals at hbox\cals at tohsize{\cals at hskip@lr\leftskip\rightskip
+\box\cals at current@row \cals at hskip@lr\rightskip\leftskip}%
 \let\cals at last@rs at below=\cals at current@rs at below
-\let\cals at last@context=\cals at current@context}
+\let\cals at last@context=\cals at current@context
+\nobreak}
 
 
-\newenvironment{calstable}{%
+\newenvironment{calstable}[1][\cals at table@alignment]{%
+\if at RTL\@RTLtabtrue\cals at activate@rtl\fi
 \let\cals at thead@tokens=\relax
 \let\cals at tfoot@tokens=\relax
 \let\cals at tbreak@tokens=\relax
@@ -388,7 +412,8 @@
 \cals at tfoot@height=0pt \relax
 \let\cals at last@context=n%
 \let\cals at current@context=b%
-\parindent=0pt %
+\parindent=0pt \relax%
+\cals at setup@alignment{#1}%
 \cals at setpadding{Ag}\cals at setcellprevdepth{Al}\cals at set@tohsize%
 %% Alignment inside is independent on center/flushright outside
 \parfillskip=0pt plus1fil\relax
@@ -396,6 +421,7 @@
 \let\cals at borderR=\relax
 \let\cals at borderT=\relax
 \let\cals at borderB=\relax
+\setbox\cals at backup@row=\box\voidb at x\relax
 \cals at AtBeginTable
 }{% End of the table
 \cals at tfoot@tokens\lastrule\cals at AtEndTable}
@@ -424,6 +450,8 @@
 
 \newcommand\tbreak[1]{\def\cals at tbreak@tokens{#1}}
 
+\newcommand\cals at table@alignment{l}
+
 \def\llt at cons#1#2{%
 \toks0=\expandafter{#1}%
 \toks2=\expandafter{#2}%
@@ -717,6 +745,28 @@
  \cals at rs@sofar at next\cals at tmpL\cals at tmpBl\cals at tmpBr\cals at width
 \fi\next}%
 \expandafter\next#2\eol}
+
+\def\next{%
+  \let\if at RTL=\iffalse
+  \let\if at RTLtab=\iffalse
+  \let\@RTLtabtrue=\relax
+}
+\ifdefined\if at RTL \relax \else \next \fi
+
+\newcommand\cals at setup@alignment[1]{%
+\if c#1\relax \cals at vfillAdd \leftskip \cals at vfillAdd \rightskip \fi
+\if at RTL
+ \if l#1\relax \cals at vfillAdd \leftskip \cals at vfillDrop\rightskip \fi
+ \if r#1\relax \cals at vfillDrop\leftskip \cals at vfillDrop\rightskip \fi
+\else
+ \if l#1\relax \cals at vfillDrop\leftskip \cals at vfillDrop\rightskip \fi
+ \if r#1\relax \cals at vfillAdd \leftskip \cals at vfillDrop\rightskip \fi
+\fi
+}
+
+\newcommand\cals at hskip@lr[2]{%
+\if at RTL \hskip#2\relax \else \hskip#1\relax \fi}
+
 \endinput
 %%
 %% End of file `cals.sty'.



More information about the tex-live-commits mailing list