diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx | 629 |
1 files changed, 317 insertions, 312 deletions
diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx index bb07281e01b..77b6456d15e 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx @@ -37,7 +37,7 @@ % %<*driver|package> \RequirePackage{xparse} -\GetIdInfo$Id: l3galley.dtx 3325 2012-02-06 22:07:00Z joseph $ +\GetIdInfo$Id: l3galley.dtx 3918 2012-07-05 00:32:37Z bruno $ {L3 Experimental galley code} %</driver|package> %<*driver> @@ -172,6 +172,12 @@ % \end{function} % % \subsection{Between paragraphs} +% +% \begin{variable}{\g_galley_previous_par_lines_int} +% The number of lines in the preceding conceptual paragraph. This may not +% correspond to the \TeX{} \tn{prevgraf} primitive value as one conceptual +% paragraph may contain several \TeX{} \tn{par} primitive tokens. +% \end{variable} % % \begin{variable}{\g_galley_restore_running_tl} % When galley settings need to be reset at the end of a paragraph, the @@ -298,7 +304,7 @@ % % \begin{variable}{\l_galley_par_indent_dim} % Fixed space added to the start of each paragraph except for those where -% \cs{l_galley_omit_next_indent_bool} is \texttt{true}. +% \cs{g_galley_omit_next_indent_bool} is \texttt{true}. % \end{variable} % % \begin{variable}{\l_galley_last_line_fit_int} @@ -351,6 +357,12 @@ % the interaction of a display block with the paragraphs before and after it % can be adjusted independent of the design of text. % \end{function} +% +% \subsection{Hyphenation} +% +% \begin{variable}{\l_galley_hyphen_left_int} +% THIS IS A HACK: SEE CODE! +% \end{variable} % % \subsection{Line breaking} % @@ -552,9 +564,9 @@ % % \section{Additional effects} % -% \begin{function}{\galley_end_par:n} +% \begin{function}{\@@_end_par:n} % \begin{syntax} -% \cs{galley_end_par:n} \Arg{tokens} +% \cs{@@_end_par:n} \Arg{tokens} % \end{syntax} % Adds the \meta{tokens} to the material collected for the last paragraph % before finalising the last paragraph in the usual way. This function should @@ -655,12 +667,15 @@ % \begin{macrocode} %<*initex|package> % \end{macrocode} +% +% \begin{macrocode} +%<@@=galley> +% \end{macrocode} % % \begin{macrocode} %<*package> \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: %</package> % \end{macrocode} % @@ -669,14 +684,6 @@ % Functions or settings which are needed by the galley but perhaps also % elsewhere. % -% \begin{macro}{\galley_leave_vmode:} -% The standard mode to leave vertical mode, starting a paragraph. -% \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_leave_vmode: - { \hbox_unpack:N \c_empty_box } -% \end{macrocode} -% \end{macro} -% % The default hyphenation character should be set and hyphenation should be % enabled. % \begin{macrocode} @@ -692,24 +699,24 @@ % % \begin{variable} % { -% \l_galley_parshape_left_indent_clist, -% \l_galley_parshape_right_indent_clist +% \l_@@_parshape_left_indent_clist, +% \l_@@_parshape_right_indent_clist % } % \begin{variable} % { -% \l_galley_parshape_multipar_bool, -% \l_galley_parshape_resume_std_bool, -% \l_galley_parshape_fixed_lines_bool +% \l_@@_parshape_multipar_bool, +% \l_@@_parshape_resume_std_bool, +% \l_@@_parshape_fixed_lines_bool % } % Setting up paragraph shape interacts with setting up the measure. The only % way to keep things flexible is to have a rather \enquote{rich} set of data % available. % \begin{macrocode} -\clist_new:N \l_galley_parshape_left_indent_clist -\clist_new:N \l_galley_parshape_right_indent_clist -\bool_new:N \l_galley_parshape_multipar_bool -\bool_new:N \l_galley_parshape_resume_std_bool -\bool_new:N \l_galley_parshape_fixed_lines_bool +\clist_new:N \l_@@_parshape_left_indent_clist +\clist_new:N \l_@@_parshape_right_indent_clist +\bool_new:N \l_@@_parshape_multipar_bool +\bool_new:N \l_@@_parshape_resume_std_bool +\bool_new:N \l_@@_parshape_fixed_lines_bool \int_new:N \l_galley_parshape_std_lines_int % \end{macrocode} % \end{variable} @@ -745,7 +752,7 @@ % \end{variable} % % \begin{variable} -% {\l_galley_interpar_penalty_skip, \l_galley_interpar_vspace_skip} +% {\l_galley_interpar_penalty_int, \l_galley_interpar_vspace_skip} % Items between paragraphs at the design level. % \begin{macrocode} \int_new:N \l_galley_interpar_penalty_int @@ -770,18 +777,18 @@ % globally. To allow different galley levels to exist, a local variant is % defined for each one to save the value when starting a new level. % -% \begin{variable}{\g_galley_begin_level_bool, \l_galley_begin_level_bool} +% \begin{variable}{\g_@@_begin_level_bool, \l_@@_begin_level_bool} % Indicates that the galley is at the very beginning of the level, and that % no material has yet been set. As a result, the global version is set % \texttt{true} to begin with. % \begin{macrocode} -\bool_new:N \g_galley_begin_level_bool -\bool_new:N \l_galley_begin_level_bool +\bool_new:N \g_@@_begin_level_bool +\bool_new:N \l_@@_begin_level_bool % \end{macrocode} % \end{variable} % % \begin{variable} -% {\g_galley_omit_next_indent_bool, \l_galley_omit_next_indent_bool} +% {\g_galley_omit_next_indent_bool, \l_@@_omit_next_indent_bool} % A global flag is needed for suppressing indentation of the next % paragraph. This does not need a \enquote{running} version since that % should be handled using the \texttt{justification} object: the two @@ -790,65 +797,65 @@ % following a heading. % \begin{macrocode} \bool_new:N \g_galley_omit_next_indent_bool -\bool_new:N \l_galley_omit_next_indent_bool +\bool_new:N \l_@@_omit_next_indent_bool % \end{macrocode} % \end{variable} % -% \begin{variable}{\g_galley_parshape_set_bool, \l_galley_parshape_set_bool} +% \begin{variable}{\g_@@_parshape_set_bool, \l_@@_parshape_set_bool} % This is not a setting for paragraph shape, but rather a tracker for the % galley system. % \begin{macrocode} -\bool_new:N \g_galley_parshape_set_bool -\bool_new:N \l_galley_parshape_set_bool +\bool_new:N \g_@@_parshape_set_bool +\bool_new:N \l_@@_parshape_set_bool % \end{macrocode} % \end{variable} % -% \begin{variable}{\g_galley_nobreak_next_bool, \l_galley_nobreak_next_bool} +% \begin{variable}{\g_galley_no_break_next_bool, \l_@@_no_break_next_bool} % Dealing with the no-break flag is pretty much the same as the case % for the indent: this applies on a single paragraph basis. % \begin{macrocode} -\bool_new:N \g_galley_nobreak_next_bool -\bool_new:N \l_galley_nobreak_next_bool +\bool_new:N \g_galley_no_break_next_bool +\bool_new:N \l_@@_no_break_next_bool % \end{macrocode} % \end{variable} % % \begin{variable} % { -% \g_galley_par_begin_hook_tl, \l_galley_par_begin_hook_tl, -% \g_galley_par_end_hook_tl, \l_galley_par_end_hook_tl, +% \g_galley_par_begin_hook_tl, \l_@@_galley_par_begin_hook_tl, +% \g_galley_par_end_hook_tl, \l_@@_galley_par_end_hook_tl, % } % Hooks for user-level code: these are not used by the galley itself. % \begin{macrocode} \tl_new:N \g_galley_par_begin_hook_tl -\tl_new:N \l_galley_par_begin_hook_tl +\tl_new:N \l_@@_galley_par_begin_hook_tl \tl_new:N \g_galley_par_end_hook_tl -\tl_new:N \l_galley_par_end_hook_tl +\tl_new:N \l_@@_galley_par_end_hook_tl % \end{macrocode} % \end{variable} % % \begin{variable} -% {\g_galley_par_after_hook_tl, \l_galley_par_after_hook_tl} +% {\g_galley_par_after_hook_tl, \l_@@_par_after_hook_tl} % This one is used by the galley: it happens \enquote{after} the current % paragraph, and is used for reset purposes. % \begin{macrocode} \tl_new:N \g_galley_par_after_hook_tl -\tl_new:N \l_galley_par_after_hook_tl +\tl_new:N \l_@@_par_after_hook_tl % \end{macrocode} % \end{variable} % % \begin{variable} -% {\g_galley_previous_par_lines_int, \l_galley_previous_par_lines_int} +% {\g_galley_previous_par_lines_int, \l_@@_previous_par_lines_int} % The number of lines in the previous typeset paragraph. This is reset at % the start of the paragraph and \emph{added to} when each \cs{tex_par:D} % primitive is used: \LaTeX{} uses the primitive in places that do not end % a (conceptual) paragraph. % \begin{macrocode} \int_new:N \g_galley_previous_par_lines_int -\int_new:N \l_galley_previous_par_lines_int +\int_new:N \l_@@_previous_par_lines_int % \end{macrocode} % \end{variable} % -% \begin{variable}{\g_galley_restore_running_tl, \l_galley_restore_running_tl} +% \begin{variable}{\g_galley_restore_running_tl, \l_@@_restore_running_tl} % When a parameter is altered from the \enquote{running} value to a % different \enquote{current} one, there needs to be a method to restore % the \enquote{running} value. This is done by adding the necessary @@ -857,14 +864,14 @@ % structure, and so there has to be a local save version. % \begin{macrocode} \tl_new:N \g_galley_restore_running_tl -\tl_new:N \l_galley_restore_running_tl +\tl_new:N \l_@@_restore_running_tl % \end{macrocode} % \end{variable} % % \begin{variable} % { -% \g_galley_whatsit_next_tl, \l_galley_whatsit_next_tl, -% \g_galley_whatsit_previous_tl, \l_galley_whatsit_previous_tl +% \g_galley_whatsit_next_tl, \l_@@_whatsit_next_tl, +% \g_galley_whatsit_previous_tl, \l_@@_whatsit_previous_tl % } % Whatsits only apply on a per-paragraph basis and so there is no need % to differentiate between current and running values. However, there @@ -873,30 +880,30 @@ % paragraph. % \begin{macrocode} \tl_new:N \g_galley_whatsit_next_tl -\tl_new:N \l_galley_whatsit_next_tl +\tl_new:N \l_@@_whatsit_next_tl \tl_new:N \g_galley_whatsit_previous_tl -\tl_new:N \l_galley_whatsit_previous_tl +\tl_new:N \l_@@_whatsit_previous_tl % \end{macrocode} % \end{variable} % % \begin{variable} -% {\g_galley_interpar_penalty_user_tl, \l_galley_interpar_penalty_user_tl} +% {\g_@@_interpar_penalty_user_tl, \l_@@_interpar_penalty_user_tl} % The user may want to over-ride the penalty for a break between % paragraphs, for example to prevent a break when the overall design % allows one. This is handled using an additional penalty. % \begin{macrocode} -\tl_new:N \g_galley_interpar_penalty_user_tl -\tl_new:N \l_galley_interpar_penalty_user_tl +\tl_new:N \g_@@_interpar_penalty_user_tl +\tl_new:N \l_@@_interpar_penalty_user_tl % \end{macrocode} % \end{variable} % % \begin{variable} -% {\g_galley_interpar_vspace_user_tl, \l_galley_interpar_vspace_user_tl} +% {\g_@@_interpar_vspace_user_tl, \l_@@_interpar_vspace_user_tl} % Arbitrary vertical space can be inserted by the user on a one-off % basis. This is used in place of any running space between paragraphs. % \begin{macrocode} -\tl_new:N \g_galley_interpar_vspace_user_tl -\tl_new:N \l_galley_interpar_vspace_user_tl +\tl_new:N \g_@@_interpar_vspace_user_tl +\tl_new:N \l_@@_interpar_vspace_user_tl % \end{macrocode} % \end{variable} % @@ -908,38 +915,38 @@ % achieved by storing the data structures in \emph{local} variables. The % later are only used to save and restore the global value, and so \TeX{} % grouping will manage the values correctly. This implies that each -% galley level must form a group: galley levels are tided to vertical +% galley level must form a group: galley levels are tied to vertical % boxes and so this is a reasonable requirements. % -% \begin{macro}{\galley_initialise_variables:} +% \begin{macro}{\@@_initialise_variables:} % At the start of a galley level, both the global and local variables % will need to be reset to standard values. For example, the measure % is set to the galley width and any paragraph shape is cleared. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_initialise_variables: +\cs_new_protected_nopar:Npn \@@_initialise_variables: { - \bool_gset_true:N \g_galley_begin_level_bool - \tl_gclear:N \g_galley_interpar_penalty_user_tl - \tl_gclear:N \g_galley_interpar_vspace_user_tl + \bool_gset_true:N \g_@@_begin_level_bool + \tl_gclear:N \g_@@_interpar_penalty_user_tl + \tl_gclear:N \g_@@_interpar_vspace_user_tl \bool_gset_true:N \g_galley_omit_next_indent_bool - \bool_gset_false:N \g_galley_nobreak_next_bool + \bool_gset_false:N \g_galley_no_break_next_bool \tl_gclear:N \g_galley_par_begin_hook_tl \tl_gclear:N \g_galley_par_end_hook_tl \tl_gclear:N \g_galley_par_after_hook_tl - \bool_gset_false:N \g_galley_parshape_set_bool + \bool_gset_false:N \g_@@_parshape_set_bool \int_gzero:N \g_galley_previous_par_lines_int \tl_gclear:N \g_galley_restore_running_tl \tl_gclear:N \g_galley_whatsit_previous_tl \tl_gclear:N \g_galley_whatsit_next_tl } -\galley_initialise_variables: +\@@_initialise_variables: % \end{macrocode} % \end{macro} % -% \begin{macro}{\galley_initialise_settings:} +% \begin{macro}{\@@_initialise_settings:} % This sets the local values of the various galley settings. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_initialise_settings: +\cs_new_protected_nopar:Npn \@@_initialise_settings: { \dim_set_eq:NN \l_galley_text_width_dim \l_galley_width_dim \dim_zero:N \l_galley_total_left_margin_dim @@ -948,84 +955,84 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\galley_save_parameters:, \galley_restore_parameters:} +% \begin{macro}{\@@_save_parameters:, \@@_restore_parameters:} % Saving and restoring parameters is carried out by a series of copy % functions. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_save_parameters: +\cs_new_protected_nopar:Npn \@@_save_parameters: { - \bool_set_eq:NN \l_galley_begin_level_bool - \g_galley_begin_level_bool - \tl_set_eq:NN \l_galley_interpar_penalty_user_tl - \g_galley_interpar_penalty_user_tl - \tl_set_eq:NN \l_galley_interpar_vspace_user_tl - \g_galley_interpar_vspace_user_tl - \bool_set_eq:NN \l_galley_omit_next_indent_bool + \bool_set_eq:NN \l_@@_begin_level_bool + \g_@@_begin_level_bool + \tl_set_eq:NN \l_@@_interpar_penalty_user_tl + \g_@@_interpar_penalty_user_tl + \tl_set_eq:NN \l_@@_interpar_vspace_user_tl + \g_@@_interpar_vspace_user_tl + \bool_set_eq:NN \l_@@_omit_next_indent_bool \g_galley_omit_next_indent_bool - \bool_set_eq:NN \l_galley_nobreak_next_bool - \g_galley_nobreak_next_bool - \tl_set_eq:NN \l_galley_par_begin_hook_tl + \bool_set_eq:NN \l_@@_no_break_next_bool + \g_galley_no_break_next_bool + \tl_set_eq:NN \l_@@_galley_par_begin_hook_tl \g_galley_par_begin_hook_tl - \tl_set_eq:NN \l_galley_par_end_hook_tl + \tl_set_eq:NN \l_@@_galley_par_end_hook_tl \g_galley_par_end_hook_tl - \tl_set_eq:NN \l_galley_par_after_hook_tl + \tl_set_eq:NN \l_@@_par_after_hook_tl \g_galley_par_after_hook_tl - \bool_set_eq:NN \l_galley_parshape_set_bool - \g_galley_parshape_set_bool - \int_set_eq:NN \l_galley_previous_par_lines_int + \bool_set_eq:NN \l_@@_parshape_set_bool + \g_@@_parshape_set_bool + \int_set_eq:NN \l_@@_previous_par_lines_int \g_galley_previous_par_lines_int - \tl_set_eq:NN \l_galley_restore_running_tl + \tl_set_eq:NN \l_@@_restore_running_tl \g_galley_restore_running_tl - \tl_set_eq:NN \l_galley_whatsit_previous_tl + \tl_set_eq:NN \l_@@_whatsit_previous_tl \g_galley_whatsit_previous_tl - \tl_set_eq:NN \l_galley_whatsit_next_tl + \tl_set_eq:NN \l_@@_whatsit_next_tl \g_galley_whatsit_next_tl } -\cs_new_protected_nopar:Npn \galley_restore_parameters: +\cs_new_protected_nopar:Npn \@@_restore_parameters: { - \bool_gset_eq:NN \g_galley_begin_level_bool - \l_galley_begin_level_bool - \tl_gset_eq:NN \g_galley_interpar_penalty_user_tl - \l_galley_interpar_penalty_user_tl - \tl_gset_eq:NN \g_galley_interpar_vspace_user_tl - \l_galley_interpar_vspace_user_tl + \bool_gset_eq:NN \g_@@_begin_level_bool + \l_@@_begin_level_bool + \tl_gset_eq:NN \g_@@_interpar_penalty_user_tl + \l_@@_interpar_penalty_user_tl + \tl_gset_eq:NN \g_@@_interpar_vspace_user_tl + \l_@@_interpar_vspace_user_tl \bool_gset_eq:NN \g_galley_omit_next_indent_bool - \l_galley_omit_next_indent_bool - \bool_gset_eq:NN \g_galley_nobreak_next_bool - \l_galley_nobreak_next_bool + \l_@@_omit_next_indent_bool + \bool_gset_eq:NN \g_galley_no_break_next_bool + \l_@@_no_break_next_bool \tl_gset_eq:NN \g_galley_par_begin_hook_tl - \l_galley_par_begin_hook_tl + \l_@@_galley_par_begin_hook_tl \tl_gset_eq:NN \g_galley_par_end_hook_tl - \l_galley_par_end_hook_tl + \l_@@_galley_par_end_hook_tl \tl_gset_eq:NN \g_galley_par_after_hook_tl - \l_galley_par_after_hook_tl - \bool_gset_eq:NN \g_galley_parshape_set_bool - \l_galley_parshape_set_bool + \l_@@_par_after_hook_tl + \bool_gset_eq:NN \g_@@_parshape_set_bool + \l_@@_parshape_set_bool \int_gset_eq:NN \g_galley_previous_par_lines_int - \l_galley_previous_par_lines_int + \l_@@_previous_par_lines_int \tl_gset_eq:NN \g_galley_restore_running_tl - \l_galley_restore_running_tl + \l_@@_restore_running_tl \tl_gset_eq:NN \g_galley_whatsit_previous_tl - \l_galley_whatsit_previous_tl + \l_@@_whatsit_previous_tl \tl_gset_eq:NN \g_galley_whatsit_next_tl - \l_galley_whatsit_next_tl + \l_@@_whatsit_next_tl } % \end{macrocode} % \end{macro} % % \begin{macro}{\galley_level:} -% \begin{macro}[aux]{\galley_level_end:} +% \begin{macro}[aux]{\@@_level_end:} % Galley levels are created by saving all of the current global % settings, starting a group then initialising both the local and global % variables. % \begin{macrocode} \cs_new_protected_nopar:Npn \galley_level: { - \galley_save_parameters: + \@@_save_parameters: \group_begin: - \galley_initialise_variables: - \galley_initialise_settings: - \group_insert_after:N \galley_level_end: + \@@_initialise_variables: + \@@_initialise_settings: + \group_insert_after:N \@@_level_end: } % \end{macrocode} % At the end of the level, the global values are restored using the @@ -1035,10 +1042,10 @@ % must come in a fixed location. All of this relies on the the % \enquote{colour safe} group used inside a box. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_level_end: +\cs_new_protected_nopar:Npn \@@_level_end: { \par - \galley_restore_parameters: + \@@_restore_parameters: \group_end: } % \end{macrocode} @@ -1047,44 +1054,44 @@ % % \subsection{The \cs{par} token} % -% \begin{variable}{\s_par_omit} +% \begin{variable}{\s__par_omit} % Used to indicate that a paragraph should be omitted. % \begin{macrocode} -\scan_new:N \s_par_omit +\__scan_new:N \s__par_omit % \end{macrocode} % \end{variable} % -% \begin{macro}{\galley_std_par:} -% \begin{macro}[aux]{\galley_std_par_aux_i:, \galley_std_par_aux_ii:} -% \begin{macro}[aux]{\galley_std_par_aux:N} +% \begin{macro}{\@@_std_par:} +% \begin{macro}[aux]{\@@_std_par_aux_i:, \@@_std_par_aux_ii:} +% \begin{macro}[aux]{\@@_std_par_aux:N} % The idea here is to expand the next token in exactly the same way as \TeX{} % would do anyway. The \texttt{f}-type expansion will ignore any protection, % but will stop at a scan marker. Thus the code can test for an % \enquote{omit paragraph} marker. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_std_par: +\cs_new_protected_nopar:Npn \@@_std_par: { - \s_par_omit - \exp_after:wN \galley_std_par_aux_i: \tex_romannumeral:D - `0 + \s__par_omit + \exp_after:wN \@@_std_par_aux_i: \tex_romannumeral:D - `0 } -\cs_new_protected:Npn \galley_std_par_aux_i: +\cs_new_protected:Npn \@@_std_par_aux_i: { - \peek_meaning:NTF \s_par_omit - { \galley_std_par_aux:N } - { \galley_std_par_aux_ii: } + \peek_meaning:NTF \s__par_omit + { \@@_std_par_aux:N } + { \@@_std_par_aux_ii: } } -\cs_new_protected:Npn \galley_std_par_aux:N #1 +\cs_new_protected:Npn \@@_std_par_aux:N #1 { - \str_if_eq:xxF {#1} { \s_par_omit } + \str_if_eq_x:nnF {#1} { \s__par_omit } { - \galley_std_par_aux_ii: + \@@_std_par_aux_ii: #1 } } % \end{macrocode} % No marker, so really insert a paragraph. In vertical mode, % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_std_par_aux_ii: +\cs_new_protected_nopar:Npn \@@_std_par_aux_ii: { \mode_if_vertical:TF { \tex_par:D } @@ -1100,7 +1107,7 @@ % \begin{macrocode} { \g_galley_par_end_hook_tl - \galley_set_measure_and_parshape: + \@@_set_measure_and_parshape: \group_begin: \tex_par:D \group_end: @@ -1121,17 +1128,17 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\galley_end_par:n} +% \begin{macro}{\@@_end_par:n} % Inserts tokens such that they are appended to the end of the last % paragraph, using the paragraph-omitting system. % \begin{macrocode} -\cs_new_protected:Npn \galley_end_par:n #1 +\cs_new_protected:Npn \@@_end_par:n #1 { - \s_par_omit - \bool_if:nF \g_galley_begin_level_bool + \s__par_omit + \bool_if:nF \g_@@_begin_level_bool { #1 - \galley_std_par: + \@@_std_par: } } % \end{macrocode} @@ -1141,7 +1148,7 @@ % The meaning of the token \cs{par} itself starts off as a standard % paragraph. % \begin{macrocode} -\cs_set_protected_nopar:Npn \par { \galley_std_par: } +\cs_set_protected_nopar:Npn \par { \@@_std_par: } % \end{macrocode} % \end{macro} % @@ -1151,7 +1158,7 @@ % so this will only be needed in package mode. % \begin{macrocode} %<*package> -\tl_set:Nn \@par { \galley_std_par: } +\tl_set:Nn \@par { \@@_std_par: } %</package> % \end{macrocode} % \end{macro} @@ -1159,8 +1166,8 @@ % \subsection{Display levels} % % \begin{macro}{\galley_display_begin:, \galley_display_end:} -% \begin{macro}[aux]{\galley_display_penalty:N, \galley_display_vspace:N} -% \begin{macro}[aux]{\galley_display_par_setup:, \galley_display_par:} +% \begin{macro}[aux]{\@@_display_penalty:N, \@@_display_vspace:N} +% \begin{macro}[aux]{\@@_display_par_setup:, \@@_display_par:} % Display items within the galley are a bit like galley levels: they % may have different paragraph settings to the main part of the galley. % On the other hand, unlike independent galleys they should inherit the @@ -1170,15 +1177,15 @@ \cs_new_protected_nopar:Npn \galley_display_begin: { \group_begin: - \galley_save_parameters: + \@@_save_parameters: \mode_if_vertical:TF { - \galley_display_penalty:N \l_galley_display_begin_par_penalty_tl - \galley_display_vspace:N \l_galley_display_begin_par_vspace_tl + \@@_display_penalty:N \l_galley_display_begin_par_penalty_tl + \@@_display_vspace:N \l_galley_display_begin_par_vspace_tl } { - \galley_display_penalty:N \l_galley_display_begin_penalty_tl - \galley_display_vspace:N \l_galley_display_begin_vspace_tl + \@@_display_penalty:N \l_galley_display_begin_penalty_tl + \@@_display_vspace:N \l_galley_display_begin_vspace_tl } \par } @@ -1188,7 +1195,7 @@ % token list, before setting up the value to the special value needed % in this one case. % \begin{macrocode} -\cs_new_protected:Npn \galley_display_penalty:N #1 +\cs_new_protected:Npn \@@_display_penalty:N #1 { \tl_if_empty:NF #1 { @@ -1200,7 +1207,7 @@ \int_gset:Nn \g_galley_penalty_int {#1} } } -\cs_new_protected:Npn \galley_display_vspace:N #1 +\cs_new_protected:Npn \@@_display_vspace:N #1 { \tl_if_empty:NF #1 { @@ -1223,12 +1230,12 @@ \cs_new_protected_nopar:Npn \galley_display_end: { \par - \galley_restore_parameters: + \@@_restore_parameters: \group_end: %<*package> \group_insert_after:N \group_insert_after:N %</package> - \group_insert_after:N \galley_display_par_setup: + \group_insert_after:N \@@_display_par_setup: } % \end{macrocode} % The method used here is to assume that the next piece of horizontal @@ -1237,10 +1244,10 @@ % \cs{par} token is then altered so that a check can be made to see if % this assumption was correct. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_display_par_setup: +\cs_new_protected_nopar:Npn \@@_display_par_setup: { \bool_gset_false:N \g_galley_omit_next_indent_bool - \cs_set_eq:NN \par \galley_display_par: + \cs_set_eq:NN \par \@@_display_par: } % \end{macrocode} % The \enquote{special} meaning of the paragraph token starts by putting @@ -1253,24 +1260,24 @@ % case where \TeX{} is in horizontal mode then a \cs{tex_par:D} primitive % is required in the same way as in \cs{galley_standard_par:}. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_display_par: +\cs_new_protected_nopar:Npn \@@_display_par: { - \cs_set_eq:NN \par \galley_std_par: + \cs_set_eq:NN \par \@@_std_par: \mode_if_vertical:TF { \par \bool_gset_false:N \g_galley_omit_next_indent_bool - \galley_display_penalty:N \l_galley_display_end_par_penalty_tl - \galley_display_vspace:N \l_galley_display_end_par_vspace_tl + \@@_display_penalty:N \l_galley_display_end_par_penalty_tl + \@@_display_vspace:N \l_galley_display_end_par_vspace_tl } { - \galley_set_measure_and_parshape: + \@@_set_measure_and_parshape: \group_begin: \tex_par:D \group_end: \int_gadd:Nn \g_galley_previous_par_lines_int \tex_prevgraf:D - \galley_display_penalty:N \l_galley_display_end_penalty_tl - \galley_display_vspace:N \l_galley_display_end_vspace_tl + \@@_display_penalty:N \l_galley_display_end_penalty_tl + \@@_display_vspace:N \l_galley_display_end_vspace_tl } } % \end{macrocode} @@ -1298,9 +1305,9 @@ %<*initex> \tex_everypar:D % TEMP { - \bool_if:NTF \g_galley_begin_level_bool - { \galley_start_paragraph_first: } - { \galley_start_paragraph_std: } + \bool_if:NTF \g_@@_begin_level_bool + { \@@_start_paragraph_first: } + { \@@_start_paragraph_std: } } %</initex> %<*package> @@ -1310,9 +1317,9 @@ { \tex_everypar:D { - \bool_if:NTF \g_galley_begin_level_bool - { \galley_start_paragraph_first: } - { \galley_start_paragraph_std: } + \bool_if:NTF \g_@@_begin_level_bool + { \@@_start_paragraph_first: } + { \@@_start_paragraph_std: } \tex_the:D \everypar } } @@ -1322,13 +1329,13 @@ % % \subsection{The galley mechanism} % -% \begin{variable}{\g_galley_last_box} +% \begin{variable}{\g_@@_last_box} % A temporary box to hold the box inserted by \TeX{} when a paragraph % is inserted with an indent. The galley actually inserts the space % (\emph{i.e.}~\cs{tex_parindent:D} is globally zero), but there is % still an empty box to test for. % \begin{macrocode} -\box_new:N \g_galley_last_box +\box_new:N \g_@@_last_box % \end{macrocode} % \end{variable} % @@ -1341,7 +1348,7 @@ % \end{verbatim} % and so anything applied here must be done globally. % -% \begin{macro}[int]{\galley_start_paragraph_std:} +% \begin{macro}[int]{\@@_start_paragraph_std:} % The routine at the start of a paragraph starts by removing any % (empty) indent box from the vertical list. As there may be vertical % mode items still to insert, a \cs{tex_par:D} primitive is used to @@ -1352,48 +1359,48 @@ % tidied up before sorting out any items which have been set on a % single-paragraph basis. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_start_paragraph_std: +\cs_new_protected_nopar:Npn \@@_start_paragraph_std: { \group_begin: - \box_gset_to_last:N \g_galley_last_box + \box_gset_to_last:N \g_@@_last_box \tex_par:D - \galley_insert_vertical_items: + \@@_insert_vertical_items: \tex_everypar:D { } \tex_noindent:D \group_end: \int_gzero:N \g_galley_previous_par_lines_int - \galley_insert_horizontal_items: - \galley_restore_running_parameters: + \@@_insert_horizontal_items: + \@@_restore_running_parameters: } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\galley_start_paragraph_first:} +% \begin{macro}[int]{\@@_start_paragraph_first:} % For the very first paragraph in a galley, the code needs to avoid % adding any unnecessary vertical items at the top as it will interfere with % vertical positioning in \cs{tex_vtop:D}. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_start_paragraph_first: +\cs_new_protected_nopar:Npn \@@_start_paragraph_first: { - \bool_gset_false:N \g_galley_begin_level_bool + \bool_gset_false:N \g_@@_begin_level_bool \mode_if_horizontal:TF { \group_begin: - \box_gset_to_last:N \g_galley_last_box + \box_gset_to_last:N \g_@@_last_box \tex_par:D - \galley_insert_vspace: + \@@_insert_vspace: \tex_everypar:D { } \tex_noindent:D \group_end: } - { \galley_insert_vspace: } - \galley_insert_horizontal_items: - \galley_restore_running_parameters: + { \@@_insert_vspace: } + \@@_insert_horizontal_items: + \@@_restore_running_parameters: } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\galley_insert_vertical_items, \galley_insert_vspace:} +% \begin{macro}[int]{\@@_insert_vertical_items, \@@_insert_vspace:} % The aim here is to insert the vertical items such that they attach to % the correct place. This function is used as part of the \cs{tex_everypar:D} % mechanism, meaning that the immediately-preceding item on the vertical @@ -1404,52 +1411,52 @@ % or the running penalty unless the no-break flag is set. Finally, % the inter-paragraph space is applied. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_insert_vertical_items: +\cs_new_protected_nopar:Npn \@@_insert_vertical_items: { \g_galley_whatsit_previous_tl \tl_gclear:N \g_galley_whatsit_previous_tl - \tl_if_empty:NTF \g_galley_interpar_penalty_user_tl + \tl_if_empty:NTF \g_@@_interpar_penalty_user_tl { - \bool_if:NTF \g_galley_nobreak_next_bool + \bool_if:NTF \g_galley_no_break_next_bool { \tex_penalty:D \c_ten_thousand } { \tex_penalty:D \l_galley_interpar_penalty_int } } { \tex_penalty:D - \int_eval:w \g_galley_interpar_penalty_user_tl \int_eval_end: - \tl_gclear:N \g_galley_interpar_penalty_user_tl + \__int_eval:w \g_@@_interpar_penalty_user_tl \__int_eval_end: + \tl_gclear:N \g_@@_interpar_penalty_user_tl } - \bool_gset_false:N \g_galley_nobreak_next_bool - \galley_insert_vspace: + \bool_gset_false:N \g_galley_no_break_next_bool + \@@_insert_vspace: } % \end{macrocode} % Inserting vertical space is set up as a separate function as it comes % up in a few places. The idea here is that any user-set space will % override the design value, and only one space is ever inserted. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_insert_vspace: +\cs_new_protected_nopar:Npn \@@_insert_vspace: { - \tl_if_empty:NTF \g_galley_interpar_vspace_user_tl + \tl_if_empty:NTF \g_@@_interpar_vspace_user_tl { \skip_vertical:N \l_galley_interpar_vspace_skip } { - \skip_vertical:n { \g_galley_interpar_vspace_user_tl } - \tl_gclear:N \g_galley_interpar_vspace_user_tl + \skip_vertical:n { \g_@@_interpar_vspace_user_tl } + \tl_gclear:N \g_@@_interpar_vspace_user_tl } } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\galley_insert_horizontal_items:} +% \begin{macro}[int]{\@@_insert_horizontal_items:} % Horizontal mode objects start with the whatsits for the next paragraph. An % indent is then included if the removed box was not void. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_insert_horizontal_items: +\cs_new_protected_nopar:Npn \@@_insert_horizontal_items: { \g_galley_whatsit_next_tl \tl_gclear:N \g_galley_whatsit_next_tl \bool_if:NF \g_galley_omit_next_indent_bool { - \box_if_empty:NF \g_galley_last_box + \box_if_empty:NF \g_@@_last_box { \hbox_to_wd:nn \l_galley_par_indent_dim { } } } \skip_horizontal:N \l_galley_par_begin_skip @@ -1459,12 +1466,12 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\galley_restore_running_parameters:} +% \begin{macro}[int]{\@@_restore_running_parameters:} % Restoring the ongoing parameters just means using the token list % variable in which the appropriate assignments are stored. The % list can then be cleared. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_restore_running_parameters: +\cs_new_protected_nopar:Npn \@@_restore_running_parameters: { \g_galley_restore_running_tl \tl_gclear:N \g_galley_restore_running_tl @@ -1521,32 +1528,32 @@ % \begin{macrocode} \cs_new_protected:Npn \galley_parshape_fixed_lines:nnn #1#2#3 { - \bool_gset_true:N \g_galley_parshape_set_bool - \bool_set_true:N \l_galley_parshape_fixed_lines_bool + \bool_gset_true:N \g_@@_parshape_set_bool + \bool_set_true:N \l_@@_parshape_fixed_lines_bool \int_set:Nn \l_galley_parshape_std_lines_int {#1} - \clist_set:Nn \l_galley_parshape_left_indent_clist {#2} - \clist_set:Nn \l_galley_parshape_right_indent_clist {#3} - \bool_set_true:N \l_galley_parshape_resume_std_bool + \clist_set:Nn \l_@@_parshape_left_indent_clist {#2} + \clist_set:Nn \l_@@_parshape_right_indent_clist {#3} + \bool_set_true:N \l_@@_parshape_resume_std_bool } \cs_new_protected:Npn \galley_parshape_multi_par:nnnN #1#2#3#4 { - \bool_gset_true:N \g_galley_parshape_set_bool - \bool_set_true:N \l_galley_parshape_multipar_bool - \bool_set_false:N \l_galley_parshape_fixed_lines_bool + \bool_gset_true:N \g_@@_parshape_set_bool + \bool_set_true:N \l_@@_parshape_multipar_bool + \bool_set_false:N \l_@@_parshape_fixed_lines_bool \int_set:Nn \l_galley_parshape_std_lines_int {#1} - \clist_set:Nn \l_galley_parshape_left_indent_clist {#2} - \clist_set:Nn \l_galley_parshape_right_indent_clist {#3} - \bool_set_eq:NN \l_galley_parshape_resume_std_bool #4 + \clist_set:Nn \l_@@_parshape_left_indent_clist {#2} + \clist_set:Nn \l_@@_parshape_right_indent_clist {#3} + \bool_set_eq:NN \l_@@_parshape_resume_std_bool #4 } \cs_new_protected:Npn \galley_parshape_single_par:nnnN #1#2#3#4 { - \bool_gset_true:N \g_galley_parshape_set_bool - \bool_set_false:N \l_galley_parshape_multipar_bool - \bool_set_false:N \l_galley_parshape_fixed_lines_bool + \bool_gset_true:N \g_@@_parshape_set_bool + \bool_set_false:N \l_@@_parshape_multipar_bool + \bool_set_false:N \l_@@_parshape_fixed_lines_bool \int_set:Nn \l_galley_parshape_std_lines_int {#1} - \clist_set:Nn \l_galley_parshape_left_indent_clist {#2} - \clist_set:Nn \l_galley_parshape_right_indent_clist {#3} - \bool_set_eq:NN \l_galley_parshape_resume_std_bool #4 + \clist_set:Nn \l_@@_parshape_left_indent_clist {#2} + \clist_set:Nn \l_@@_parshape_right_indent_clist {#3} + \bool_set_eq:NN \l_@@_parshape_resume_std_bool #4 } \cs_generate_variant:Nn \galley_parshape_fixed_lines:nnn { nVV } \cs_generate_variant:Nn \galley_parshape_multi_par:nnnN { nVV } @@ -1554,25 +1561,25 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\galley_set_measure_and_parshape:} +% \begin{macro}[int]{\@@_set_measure_and_parshape:} % To set the paragraph shape for the current paragraph, there is a check to % see if the measure alone should be used. If not, then the shape may be % built by paragraph or based on the number of lines required. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_set_measure_and_parshape: +\cs_new_protected_nopar:Npn \@@_set_measure_and_parshape: { - \bool_if:NTF \g_galley_parshape_set_bool + \bool_if:NTF \g_@@_parshape_set_bool { - \bool_if:NTF \l_galley_parshape_fixed_lines_bool + \bool_if:NTF \l_@@_parshape_fixed_lines_bool { \int_compare:nNnTF \g_galley_previous_par_lines_int > \c_zero - { \galley_generate_parshape_lines: } - { \galley_generate_parshape: } + { \@@_generate_parshape_lines: } + { \@@_generate_parshape: } } { - \bool_gset_eq:NN \g_galley_parshape_set_bool - \l_galley_parshape_multipar_bool - \galley_generate_parshape: + \bool_gset_eq:NN \g_@@_parshape_set_bool + \l_@@_parshape_multipar_bool + \@@_generate_parshape: } } { @@ -1586,23 +1593,23 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\galley_generate_parshape:} -% \begin{macro}[aux]{\galley_set_parshape_map:nn, \galley_set_parshape_map:oo} -% \begin{macro}[aux]{\galley_set_parshape_map_aux:nw} +% \begin{macro}[int]{\@@_generate_parshape:} +% \begin{macro}[aux]{\@@_set_parshape_map:nn, \@@_set_parshape_map:oo} +% \begin{macro}[aux]{\@@_set_parshape_map_aux:nw} % For a shape to apply on a paragraph basis, the two user-supplied comma % lists are taken and converted into left-side offsets and line lengths. % This is all dependent on the current measure. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_generate_parshape: +\cs_new_protected_nopar:Npn \@@_generate_parshape: { \tex_global:D \tex_parshape:D - \int_eval:w + \__int_eval:w \l_galley_parshape_std_lines_int + \int_min:nn - { \clist_length:N \l_galley_parshape_left_indent_clist } - { \clist_length:N \l_galley_parshape_right_indent_clist } - \bool_if:NT \l_galley_parshape_resume_std_bool { + 1 } - \int_eval_end: + { \clist_count:N \l_@@_parshape_left_indent_clist } + { \clist_count:N \l_@@_parshape_right_indent_clist } + \bool_if:NT \l_@@_parshape_resume_std_bool { + 1 } + \__int_eval_end: \prg_replicate:nn \l_galley_parshape_std_lines_int { \dim_use:N \l_galley_total_left_margin_dim @@ -1610,10 +1617,10 @@ \dim_use:N \l_galley_text_width_dim \c_space_tl } - \galley_set_parshape_map:oo - \l_galley_parshape_left_indent_clist - \l_galley_parshape_right_indent_clist - \bool_if:NT \l_galley_parshape_resume_std_bool + \@@_set_parshape_map:oo + \l_@@_parshape_left_indent_clist + \l_@@_parshape_right_indent_clist + \bool_if:NT \l_@@_parshape_resume_std_bool { \c_space_tl \dim_use:N \l_galley_total_left_margin_dim @@ -1621,10 +1628,10 @@ \dim_use:N \l_galley_text_width_dim } } -\cs_new:Npn \galley_set_parshape_map:nn #1#2 - { \galley_set_parshape_map_aux:nw { } #1 , \q_mark #2 , \q_stop } -\cs_generate_variant:Nn \galley_set_parshape_map:nn { oo } -\cs_new:Npn \galley_set_parshape_map_aux:nw #1#2 , #3 \q_mark #4 , #5 \q_stop +\cs_new:Npn \@@_set_parshape_map:nn #1#2 + { \@@_set_parshape_map_aux:nw { } #1 , \q_mark #2 , \q_stop } +\cs_generate_variant:Nn \@@_set_parshape_map:nn { oo } +\cs_new:Npn \@@_set_parshape_map_aux:nw #1#2 , #3 \q_mark #4 , #5 \q_stop { \bool_if:nTF { \tl_if_empty_p:n {#3} || \tl_if_empty_p:n {#5} } { @@ -1634,7 +1641,7 @@ \dim_eval:n { \l_galley_text_width_dim - ( ( #2 ) + ( #4 ) ) } } { - \galley_set_parshape_map_aux:nw + \@@_set_parshape_map_aux:nw { #1 \dim_eval:n { \l_galley_total_left_margin_dim + ( #2 ) } @@ -1650,27 +1657,27 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int]{\galley_generate_parshape_lines:} -% \begin{macro}[aux]{\galley_generate_parshape_lines_aux:n} +% \begin{macro}[int]{\@@_generate_parshape_lines:} +% \begin{macro}[aux]{\@@_generate_parshape_lines:n} % The idea here is to construct a paragraph shape based on the remaining % lines from the shape in the previous paragraph. If the previous paragraph % was sufficiently long, then life is \enquote{back to normal} and the % standard shape is set. If a special shape is needed, this is recovered % from the paragraph shape using the \eTeX{} primitives. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_generate_parshape_lines: +\cs_new_protected_nopar:Npn \@@_generate_parshape_lines: { \int_compare:nNnTF \tex_parshape:D > \g_galley_previous_par_lines_int { \tex_global:D \tex_parshape:D - \int_eval:w \tex_parshape:D - \g_galley_previous_par_lines_int - \int_eval_end: - \prg_stepwise_function:nnnN + \__int_eval:w \tex_parshape:D - \g_galley_previous_par_lines_int + \__int_eval_end: + \int_step_function:nnnN { \g_galley_previous_par_lines_int + \c_one } - \c_one \tex_parshape:D \galley_generate_parshape_lines_aux:n + \c_one \tex_parshape:D \@@_generate_parshape_lines:n } { - \bool_gset_false:N \g_galley_parshape_set_bool + \bool_gset_false:N \g_@@_parshape_set_bool \tex_global:D \tex_parshape:D \c_one \dim_use:N \l_galley_total_left_margin_dim @@ -1678,7 +1685,7 @@ \dim_use:N \l_galley_text_width_dim } } -\cs_new:Npn \galley_generate_parshape_lines_aux:n #1 +\cs_new:Npn \@@_generate_parshape_lines:n #1 { \etex_parshapeindent:D #1 ~ @@ -1697,9 +1704,9 @@ % deals with this nicely. % \begin{macrocode} \cs_new_protected:Npn \galley_set_user_penalty:n #1 - { \tl_gset:Nx \g_galley_interpar_penalty_user_tl { \int_eval:n {#1} } } + { \tl_gset:Nx \g_@@_interpar_penalty_user_tl { \int_eval:n {#1} } } \cs_new_protected:Npn \galley_set_user_vspace:n #1 - { \tl_gset:Nx \g_galley_interpar_vspace_user_tl { \skip_eval:n {#1} } } + { \tl_gset:Nx \g_@@_interpar_vspace_user_tl { \skip_eval:n {#1} } } % \end{macrocode} % \end{macro} % @@ -1837,7 +1844,7 @@ \cs_new_protected:Npn \galley_break_line:Nn #1#2 { \mode_if_vertical:TF - { \msg_kernel_error:nn { galley } { no-line-to-end } } + { \__msg_kernel_error:nn { galley } { no-line-to-end } } { \tex_unskip:D \bool_if:NF #1 @@ -1905,7 +1912,7 @@ \cs_new_protected:Npn \galley_set_display_widow_penalties:n #1 { \etex_displaywidowpenalties:D - \int_eval:w \clist_length:n {#1} + \c_one \int_eval_end: + \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end: \clist_map_function:nN {#1} \galley_set_aux:n \c_zero } @@ -1913,7 +1920,7 @@ \cs_new_protected:Npn \galley_set_widow_penalties:n #1 { \etex_widowpenalties:D - \int_eval:w \clist_length:n {#1} + \c_one \int_eval_end: + \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end: \clist_map_function:nN {#1} \galley_set_aux:n \c_zero } @@ -1940,13 +1947,13 @@ \cs_new_protected:Npn \galley_set_club_penalties:n #1 { \clist_set:Nn \l_galley_club_penalties_clist {#1} - \galley_calc_interline_penalties: + \@@_calc_interline_penalties: } \cs_generate_variant:Nn \galley_set_club_penalties:n { V , v } \cs_new_protected:Npn \galley_set_interline_penalties:n #1 { \clist_set:Nn \l_galley_line_penalties_clist {#1} - \galley_calc_interline_penalties: + \@@_calc_interline_penalties: } \cs_generate_variant:Nn \galley_set_interline_penalties:n { V , v } % \end{macrocode} @@ -1964,21 +1971,21 @@ \cs_new_protected:Npn \galley_set_display_club_penalties:n #1 { \etex_clubpenalties:D - \int_eval:w \clist_length:n {#1} + \c_one \int_eval_end: + \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end: \clist_map_function:nN {#1} \galley_set_aux:n \c_zero - \galley_calc_interline_penalties: + \@@_calc_interline_penalties: } \cs_generate_variant:Nn \galley_set_display_club_penalties:n { V , v } % \end{macrocode} % \end{macro} % % \begin{macro}{\galley_set_interline_penalty:n} -% \begin{macro}[aux]{\galley_set_interline_penalty_aux:nn} +% \begin{macro}[aux]{\@@_set_interline_penalty:nn} % \begin{macro}[aux] % { -% \galley_set_interline_penalty_aux_i:n, -% \galley_set_interline_penalty_aux_ii:n +% \@@_set_interline_penalty_i:n, +% \@@_set_interline_penalty_ii:n % } % Dealing with the general interline penalty is handled in one shot. % The idea is that for lines with no special penalty, the old general @@ -1991,47 +1998,47 @@ { \int_compare:nNnTF { \etex_interlinepenalties:D \c_zero } = \c_zero { - \etex_interlinepenalties:D \c_one \int_eval:w #1 \int_eval_end: - \galley_calc_interline_penalties: + \etex_interlinepenalties:D \c_one \__int_eval:w #1 \__int_eval_end: + \@@_calc_interline_penalties: } { - \cs_set:Npn \galley_set_interline_penalty_aux_ii:n ##1 + \cs_set:Npn \@@_set_interline_penalty_ii:n ##1 { - \int_eval:w + \__int_eval:w \etex_interlinepenalties:D ##1 - \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero + #1 - \int_eval_end: + \__int_eval_end: } - \exp_args:Nf \galley_set_interline_penalty_aux:nn - { \clist_length:N \l_galley_line_penalties_clist } {#1} + \exp_args:Nf \@@_set_interline_penalty:nn + { \clist_count:N \l_galley_line_penalties_clist } {#1} } } -\cs_new_protected:Npn \galley_set_interline_penalty_aux:nn #1#2 +\cs_new_protected:Npn \@@_set_interline_penalty:nn #1#2 { \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero - \prg_stepwise_function:nnnN \c_one \c_one {#1} - \galley_set_interline_penalty_aux_i:n - \prg_stepwise_function:nnnN { #1 + \c_one } \c_one + \int_step_function:nnnN \c_one \c_one {#1} + \@@_set_interline_penalty_i:n + \int_step_function:nnnN { #1 + \c_one } \c_one { \etex_interlinepenalties:D \c_zero - \c_one } - \galley_set_interline_penalty_aux_ii:n - \int_eval:w #2 \int_eval_end: + \@@_set_interline_penalty_ii:n + \__int_eval:w #2 \__int_eval_end: } -\cs_new:Npn \galley_set_interline_penalty_aux_i:n #1 - { \etex_interlinepenalties:D \int_eval:w #1 \int_eval_end: } -\cs_new:Npn \galley_set_interline_penalty_aux_ii:n #1 { } +\cs_new:Npn \@@_set_interline_penalty_i:n #1 + { \etex_interlinepenalties:D \__int_eval:w #1 \__int_eval_end: } +\cs_new:Npn \@@_set_interline_penalty_ii:n #1 { } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}[int]{\galley_calc_interline_penalties:} -% \begin{macro}[aux]{\galley_calc_interline_penalties_aux:nn} +% \begin{macro}[int]{\@@_calc_interline_penalties:} +% \begin{macro}[aux]{\@@_calc_interline_penalties:nn} % \begin{macro}[aux] % { -% \galley_calc_interline_penalties_aux_i:n, -% \galley_calc_interline_penalties_aux_ii:n +% \@@_calc_interline_penalties_i:n, +% \@@_calc_interline_penalties_ii:n % } % The underlying interline penalty array has to deal with club penalties, % display club penalties and any special line penalties, and include @@ -2040,28 +2047,28 @@ % so an \texttt{f}-type expansion is used to make life a little less % complex. % \begin{macrocode} -\cs_new_protected_nopar:Npn \galley_calc_interline_penalties: +\cs_new_protected_nopar:Npn \@@_calc_interline_penalties: { - \exp_args:Nff \galley_calc_interline_penalties_aux:nn + \exp_args:Nff \@@_calc_interline_penalties:nn { \int_eval:n { \int_max:nn { - \clist_length:N \l_galley_club_penalties_clist + \clist_count:N \l_galley_club_penalties_clist + \c_one } { \int_max:nn { - \clist_length:N \l_galley_line_penalties_clist + \clist_count:N \l_galley_line_penalties_clist + \c_one } { \etex_clubpenalties:D \c_zero } } } } - { \clist_length:N \l_galley_line_penalties_clist } + { \clist_count:N \l_galley_line_penalties_clist } } % \end{macrocode} % The idea is now to calculate the correct penalties. Two auxiliary functions @@ -2069,32 +2076,30 @@ % normal lines. At the end of the process, the standard interline % penalty is always included. % \begin{macrocode} -\cs_new_protected:Npn \galley_calc_interline_penalties_aux:nn #1#2 +\cs_new_protected:Npn \@@_calc_interline_penalties:nn #1#2 { \etex_interlinepenalties:D #1 ~ - \prg_stepwise_function:nnnN \c_one \c_one {#2} - \galley_calc_interline_penalties_aux_i:n - \prg_stepwise_function:nnnN { #2 + \c_one } \c_one { #1 - \c_one } - \galley_calc_interline_penalties_aux_ii:n + \int_step_function:nnnN \c_one \c_one {#2} + \@@_calc_interline_penalties_i:n + \int_step_function:nnnN { #2 + \c_one } \c_one { #1 - \c_one } + \@@_calc_interline_penalties_ii:n \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero } -\cs_new:Npn \galley_calc_interline_penalties_aux_i:n #1 +\cs_new:Npn \@@_calc_interline_penalties_i:n #1 { - \int_eval:w - \clist_item:Nn \l_galley_line_penalties_clist { #1 - \c_one } - + 0 \clist_item:Nn \l_galley_club_penalties_clist - { #1 - \c_one } + \__int_eval:w + \clist_item:Nn \l_galley_line_penalties_clist {#1} + + 0 \clist_item:Nn \l_galley_club_penalties_clist {#1} - \etex_clubpenalties:D #1 ~ - \int_eval_end: + \__int_eval_end: } -\cs_new:Npn \galley_calc_interline_penalties_aux_ii:n #1 +\cs_new:Npn \@@_calc_interline_penalties_ii:n #1 { - \int_eval:w + \__int_eval:w \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero - + 0 \clist_item:Nn \l_galley_club_penalties_clist - { #1 - \c_one } + + 0 \clist_item:Nn \l_galley_club_penalties_clist {#1} - \etex_clubpenalties:D #1 ~ - \int_eval_end: + \__int_eval_end: } % \end{macrocode} % \end{macro} @@ -2111,9 +2116,9 @@ % } % \begin{macro}[aux] % { -% \galley_save_display_club_penalties_aux:n, -% \galley_save_display_widow_penalties_aux:n, -% \galley_save_widow_penalties_aux:n +% \@@_save_display_club_penalties:n, +% \@@_save_display_widow_penalties:n, +% \@@_save_widow_penalties:n % } % \begin{macro}{\galley_interline_penalty:} % Saving the array penalties varies in complexity depending on how they are @@ -2131,35 +2136,35 @@ { \clist_set:Nx #1 { - \prg_stepwise_function:nnnN \c_one \c_one + \int_step_function:nnnN \c_one \c_one { \etex_clubpenalties:D \c_zero - \c_one } \galley_save_display_club_penalties:_aux:n } } \cs_new:Npn \galley_save_display_club_penalties:_aux:n #1 - { \int_use:N \etex_clubpenaltes:D \int_eval:w #1 \int_eval_end: , } + { \int_use:N \etex_clubpenaltes:D \__int_eval:w #1 \__int_eval_end: , } \cs_new_protected:Npn \galley_save_display_widow_penalties:N #1 { \clist_set:Nx #1 { - \prg_stepwise_function:nnnN \c_one \c_one + \int_step_function:nnnN \c_one \c_one { \etex_displaywidowpenalties:D \c_zero - \c_one } \galley_save_display_widow_penalties:_aux:n } } \cs_new:Npn \galley_save_display_widow_penalties:_aux:n #1 - { \int_use:N \etex_displaywidowpenalties:D \int_eval:w #1 \int_eval_end: , } + { \int_use:N \etex_displaywidowpenalties:D \__int_eval:w #1 \__int_eval_end: , } \cs_new_protected:Npn \galley_save_widow_penalties:N #1 { \clist_set:Nx #1 { - \prg_stepwise_function:nnnN \c_one \c_one + \int_step_function:nnnN \c_one \c_one { \etex_widowpenalties:D \c_zero - \c_one } \galley_save_widow_penalties:_aux:n } } \cs_new:Npn \galley_save_widow_penalties:_aux:n #1 - { \int_use:N \etex_widowpenalties:D \int_eval:w #1 \int_eval_end: , } + { \int_use:N \etex_widowpenalties:D \__int_eval:w #1 \__int_eval_end: , } % \end{macrocode} % This one is not an array, but is stored in a primitive, so there is % a simple conversion. The general interline penalty is always the @@ -2175,7 +2180,7 @@ % \subsection{Messages} % % \begin{macrocode} -\msg_kernel_new:nnn { galley } { no-line-to-end } +\__msg_kernel_new:nnn { galley } { no-line-to-end } { There's~no~line~here~to~end. } % \end{macrocode} % @@ -2262,7 +2267,7 @@ % \begin{macro}{\@@par} % The primitive is moved as otherwise the clever skipping code will fail. % \begin{macrocode} -\cs_set_eq:NN \@@par \galley_std_par: +\cs_set_eq:NN \@@par \@@_std_par: % \end{macrocode} % \end{macro} % |