%%
%% This is file `ltpara.ltx',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ltpara.dtx  (with options: `2ekernel')
%% 
%% This is a generated file.
%% 
%% The source is maintained by the LaTeX Project team and bug
%% reports for it can be opened at https://latex-project.org/bugs.html
%% (but please observe conditions on bug reports sent to that address!)
%% 
%% 
%% Copyright (C) 1993-2021
%% The LaTeX Project and any individual authors listed elsewhere
%% in this file.
%% 
%% This file was generated from file(s) of the LaTeX base system.
%% --------------------------------------------------------------
%% 
%% It 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.
%% The latest version of this license is in
%%    https://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008 or later.
%% 
%% This file has the LPPL maintenance status "maintained".
%% 
%% This file may only be distributed together with a copy of the LaTeX
%% base system. You may however distribute the LaTeX base system without
%% such generated files.
%% 
%% The list of all files belonging to the LaTeX base distribution is
%% given in the file `manifest.txt'. See also `legal.txt' for additional
%% information.
%% 
%% The list of derived (unpacked) files belonging to the distribution
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%% File: ltpara.dtx (C) Copyright 2020-2021
%%% From File: lthooks.dtx
\def\ltparaversion{v1.0d}
\def\ltparadate{2021/02/18}


\ExplSyntaxOn

\hook_new_pair:nn{para/before}{para/after}
\hook_new_pair:nn{para/begin}{para/end}
\let \@kernel@before@para@before \@empty
\let \@kernel@before@para@begin  \@empty
\let \@kernel@after@para@end     \@empty
\let \@kernel@after@para@after   \@empty
\tl_new:N \g__para_standard_everypar_tl
\tl_gset:Nn \g__para_standard_everypar_tl {
  \box_gset_to_last:N \g_para_indentation_box
  \group_begin:
    \tex_par:D
  \group_end:
  \tex_everypar:D { \__kernel_msg_error:nnnn {para}{mode}{before}{vertical} }
  \@kernel@before@para@before
  \hook_use:n {para/before}
  \group_begin:
    \tex_everypar:D {}
    \skip_zero:N \tex_parskip:D
    \tex_noindent:D
  \group_end:
  \tex_everypar:D{\g__para_standard_everypar_tl}
  \cs_set_eq:NN \__para_handle_indent: \__para_add_indentation_box:
  \@kernel@before@para@begin
  \hook_use:n {para/begin}
  \if_mode_horizontal: \else:
    \__kernel_msg_error:nnnn {para}{mode}{begin}{vertical} \fi:
  \__para_handle_indent:
}
\tex_everypar:D{\g__para_standard_everypar_tl}
\newtoks \everypar

\tl_gput_right:Nx \g__para_standard_everypar_tl {
    \exp_not:N \the
    \exp_not:N \toks
    \the \allocationnumber
    \c_space_tl
}
\box_new:N \g_para_indentation_box

\cs_new:Npn \__para_add_indentation_box: {
  \box_use_drop:N \g_para_indentation_box
}
\cs_new_eq:NN \__para_handle_indent: \__para_add_indentation_box:
\cs_new:Npn \para_suppress_indentation: {
  \cs_set_eq:NN \__para_handle_indent: \prg_do_nothing:
}
\cs_set_eq:NN \IndentationBox \g_para_indentation_box
\cs_set_eq:NN \SuppressIndentationBox \para_suppress_indentation:
\cs_new_protected:Npn \para_end: {
  \mode_if_horizontal:TF {
    \mode_if_inner:F {
         \tex_unskip:D
         \hook_use:n{para/end}
         \@kernel@after@para@end
         \mode_if_horizontal:TF {
           \if_int_compare:w 0 < \tex_lastnodetype:D
             \tex_kern:D \c_zero_dim
           \fi:
           \tex_par:D
           \hook_use:n{para/after}
           \@kernel@after@para@after
         }
         { \__kernel_msg_error:nnnn {para}{mode}{end}{horizontal} }
    }
  }
  \tex_par:D
}
\cs_set_eq:NN \par     \para_end:
\cs_set_eq:NN \@@par   \para_end:
\cs_set_eq:NN \endgraf \para_end:
\everypar{\@nodocument} %% To get an error if text appears before the
\__kernel_msg_new:nnnn {para} {mode}
  {
    Illegal~mode~ change~ in~ hook~ 'para/#1'.\\
    Hook~ code~ did~ not~ remain~ in~ #2~ mode.
  }
  {
    Paragraph~ hooks~ cannot~ change~ the~ TeX~ mode~ without~ causing~
    endless~ recursion.~ The~ hook~ code~ in~ 'para/#1'~ needs~ to~ stay~
    in~ #2~ mode,~ but~ it~ didn't.~ Examine~ the~ hook~
    code~ with~ \ShowHook~ to~ find~ the~ issue.
  }
\ExplSyntaxOff
\IfFormatAtLeastTF{2021/05/01}{}
{
\long\def \@savemarbox #1#2{%
  \global\setbox #1%
    \color@vbox
      \vtop{%
        \hsize\marginparwidth
        \@parboxrestore
        \@marginparreset
        #2\par                    % <-- needed
        \@minipagefalse
        \outer@nobreak
        }%
    \color@endbox
}
\newcounter{paracnt}
\def\@kernel@before@para@begin{%
  \stepcounter{paracnt}%
  \typeout{PARA: \arabic{paracnt} start
    (\@currenvir\space level\on@line)}%
}
\def\@kernel@after@para@end  {%
  \typeout{PARA: \arabic{paracnt} end \space\space
    (\@currenvir\space level\on@line)}%
  \addtocounter{paracnt}{-1}%
}
\let\color@begingroup\begingroup
\def\color@endgroup{\endgraf\endgroup}
\def\color@setgroup{\color@begingroup}  % \def\color@setgroup{\color@begingroup\set@color}
\def\color@hbox{\hbox\bgroup\color@begingroup}
\def\color@vbox{\vbox\bgroup\color@begingroup}
\def\color@endbox{\color@endgroup\egroup}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\endinput
%%
%% End of file `ltpara.ltx'.
