%% %% This is file `lipsum.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% lipsum.dtx (with options: `package') %% %% This file is part of the package lipsum for use with LaTeX2e. %% %% Function: Access to 150 paragraphs of dummy text. %% %% This program may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 %% of this license or (at your option) any later version. %% The latest version of this license is in %% http://www.latex-project.org/lppl.txt %% and version 1.3 or later is part of all distributions of LaTeX %% version 2005/12/01 or later. %% %% Please send error reports and suggestions for improvements to %% https://github.com/PhelypeOleinik/lipsum %% \def\lipsumversion{2.5} \def\lipsumdate{2021-08-01} \NeedsTeXFormat{LaTeX2e} \RequirePackage{l3keys2e} \@ifundefined{NewDocumentCommand} {\RequirePackage{xparse}}{} \ProvidesExplPackage {lipsum} {\lipsumdate} {\lipsumversion} {150 paragraphs of Lorem Ipsum dummy text} \int_new:N \g__lipsum_par_int \tl_new:N \g__lipsum_language_tl \tl_new:N \g_lipsum_default_range_tl \tl_new:N \l__lipsum_output_tl \str_new:N \g__lipsum_text_str \str_new:N \l__lipsum_sep_set_str \bool_new:N \l__lipsum_autolang_bool \quark_new:N \q__lipsum_mark \scan_new:N \s__lipsum \str_new:N \l__lipsum_tmpa_str \int_new:N \l__lipsum_a_int \int_new:N \l__lipsum_b_int \cs_new_eq:NN \__lipsum_tmp:w ? \clist_map_inline:nn { start, itemstart, itemseparator, itemend, end } { \clist_map_inline:nn { par, sentence } { \clist_map_inline:nn { { }, star, nostar } { \tl_new:c { l__lipsum_##1_#1_####1_tl } } } \tl_new:c { l__lipsum_par_#1_parsepar_tl } } \tl_set:Nn \l__lipsum_par_itemseparator_parsepar_tl { ~ } \cs_new_protected:Npn \__lipsum_parse_par_range:nNN #1 #2 #3 { \tl_if_blank:nTF {#1} { \exp_args:NV \__lipsum_parse_range_arg:nNNn \g_lipsum_default_range_tl } { \__lipsum_parse_range_arg:nNNn {#1} } #2 #3 { \g__lipsum_par_int } } \cs_new_protected:Npn \__lipsum_parse_sentence_range:nNN #1 #2 #3 { \__lipsum_parse_range_arg:nNNn {#1} #2 #3 { \c_max_int } } \cs_new_protected:Npn \__lipsum_parse_range_arg:nNNn #1 { \exp_last_unbraced:No \__lipsum_parse_range_arg:wnNNn \tl_to_str:n { #1 - - } \s__lipsum {#1} } \cs_new_protected:Npn \__lipsum_parse_range_arg:wnNNn #1 - #2 - #3 \s__lipsum #4 #5#6 #7 { \str_if_eq:nnTF {#3} { - } { \__lipsum_int_set:Nnn #5 {#1} { 1 } \__lipsum_int_set:Nnn #6 {#2} {#7} } { \tl_if_empty:nTF {#3} { \__lipsum_int_set:Nnn #5 {#1} { \ERROR } \int_set_eq:NN #6 #5 } { \msg_error:nnn { lipsum } { invalid-range } {#4} \__lipsum_parse_range_arg:nNNn { 2 - 1 } #5 #6 {#7} } } } \cs_new_protected:Npn \__lipsum_int_set:Nnn #1 #2 #3 { \int_set:Nn #1 { \tl_if_blank:nT {#2} {#3} #2 } } \cs_generate_variant:Nn \__lipsum_parse_par_range:nNN { e } \cs_generate_variant:Nn \__lipsum_parse_sentence_range:nNN { e } \cs_new:Npn \__lipsum_sep_item:nn #1 #2 { \exp_not:v { l__lipsum_#1_#2_ \l__lipsum_sep_set_str _tl } } \cs_new:Npn \lipsum_get_range:nn #1 #2 { \__lipsum_sep_item:nn { par } { start } \use:e { \exp_not:N \__lipsum_get_paragraph:ww \__lipsum_build_list:nn {#1} {#2} \exp_not:N \q__lipsum_mark ; \exp_not:N \q__lipsum_mark ; \s__lipsum } \__lipsum_sep_item:nn { par } { end } } \cs_new:Npn \__lipsum_build_list:nn #1 #2 { \int_step_function:nnN { \int_max:nn {#1} { 1 } } { \int_min:nn {#2} { \g__lipsum_par_int } } \__lipsum_build_list_aux:n } \cs_new:Npn \__lipsum_build_list_aux:n #1 { #1 ; } \cs_new:Npn \__lipsum_get_paragraph:ww #1 ; #2 ; { \if_meaning:w \q__lipsum_mark #2 \if_meaning:w \q__lipsum_mark #1 \__lipsum_get_paragraph_end:w \else: \lipsum_get_paragraph:n {#1} \fi: \else: \lipsum_get_paragraph:n {#1} \__lipsum_sep_item:nn { par } { itemseparator } \fi: \__lipsum_get_paragraph:ww #2 ; } \cs_new:Npn \__lipsum_get_paragraph_end:w #1 \s__lipsum { \fi: \fi: } \cs_new:Npn \lipsum_get_paragraph:n #1 { \__lipsum_sep_item:nn { par } { itemstart } \__lipsum_unexpanded_par:n {#1} \__lipsum_sep_item:nn { par } { itemend } } \cs_new:Npn \__lipsum_unexpanded_par:n #1 { \bool_lazy_and:nnT { \int_compare_p:nNn { 0 } < {#1} } { \int_compare_p:nNn {#1} < { \g__lipsum_par_int + 1 } } { \exp_not:v { g__lipsum_par_#1_tl } } } \cs_new:Npn \lipsum_get_sentences:nnn #1 #2 #3 { \__lipsum_sep_item:nn { sentence } { start } \exp_args:Ne \use_ii_i:nn { { \int_max:nn {#1} { 1 } } } { \__lipsum_get_sentences:nnnw { 1 } } {#2} #3 ~ \q__lipsum_mark .~ \s__lipsum \__lipsum_sep_item:nn { sentence } { end } } \cs_new:Npn \__lipsum_get_sentences:nnnw #1 #2 #3 #4 .~ { \int_compare:nNnT {#1} > {#3} { \__lipsum_get_sentences_end:w } \use:nn { \if_meaning:w \q__lipsum_mark } #4 \exp_after:wN \__lipsum_get_sentences_end:w \else: \int_compare:nNnF {#1} < {#2} { \int_compare:nNnF {#1} = {#2} { \__lipsum_sep_item:nn { sentence } { itemseparator } } \__lipsum_sep_item:nn { sentence } { itemstart } \exp_not:n { #4 . } \__lipsum_sep_item:nn { sentence } { itemend } } \fi: \exp_args:Nf \__lipsum_get_sentences:nnnw { \int_eval:n { #1 + 1 } } {#2} {#3} } \cs_new:Npn \__lipsum_get_sentences_end:w #1 \s__lipsum { } \cs_generate_variant:Nn \lipsum_get_sentences:nnn { nnV } \NewDocumentCommand \LipsumPar { m } { \__lipsum_deprecated:n { LipsumPar } \__lipsum_unexpanded_par:n {#1} \par } \cs_new_protected:Npn \__lipsum_element_set:nnn #1 #2 #3 { \tl_set:cn { l__lipsum_ #1 _ \IfBooleanF {#2} { no } star _tl } {#3} } \cs_new_protected:Npn \__lipsum_deprecated:n #1 { \msg_warning:nnn { lipsum } { cmd-deprecated } {#1} \cs_gset_eq:NN \__lipsum_deprecated:n \use_none:n } \cs_set_protected:Npn \__lipsum_tmp:w #1 #2 #3 #4 { \str_set:Nx \l__lipsum_tmpa_str { #2 \tl_if_empty:nTF {#4} {#3} { start } } \use:e { \NewDocumentCommand \exp_not:c { SetLipsum #1 List #2 #3 } { s +m \tl_if_empty:nF {#4} { +m } } { \__lipsum_deprecated:n { SetLipsum #1 List #2 #3 } \__lipsum_element_set:nnn { \exp_args:Ne \str_lowercase:n { #1_\l__lipsum_tmpa_str } } {##1} {##2} \tl_if_empty:nT {#4} { \use_none:nnnn } \__lipsum_element_set:nnn { \str_lowercase:n { #1_#2 #4 } } {##1} {##3} } } } \clist_map_inline:nn { Par, Sentence } { \clist_map_inline:nn { { Start } { }, { End } { }, { Surrounders } { end } } { \__lipsum_tmp:w {#1} { Item } ##1 \__lipsum_tmp:w {#1} { } ##1 } \__lipsum_tmp:w {#1} { Item } { Separator } { } } \NewDocumentCommand \SetLipsumDefault { m } { \__lipsum_parse_par_range:eNN {#1} \l__lipsum_a_int \l__lipsum_b_int \tl_gset:Nx \g_lipsum_default_range_tl { \int_use:N \l__lipsum_a_int - \int_use:N \l__lipsum_b_int } } \NewDocumentCommand \lipsum { s O { \g_lipsum_default_range_tl } o } { \__lipsum_do:nnnn {#1} {#2} {#3} { \__lipsum_set_hyphens: \tl_use:N ##1 \__lipsum_restore_hyphens: } } \NewDocumentCommand \unpacklipsum { s O { \g_lipsum_default_range_tl } o } { \__lipsum_do:nnnn {#1} {#2} {#3} { \tl_gset_eq:NN \lipsumexp ##1 } } \cs_new_eq:NN \lipsumexp \prg_do_nothing: \cs_new_protected:Npn \__lipsum_do:nnnn #1 #2 #3 #4 { \cs_set_protected:Npn \__lipsum_do:N ##1 {#4} \__lipsum_parse_par_range:eNN {#2} \l__lipsum_a_int \l__lipsum_b_int \str_set_eq:NN \l__lipsum_tmpa_str \l__lipsum_sep_set_str \str_set:Nx \l__lipsum_sep_set_str { \IfBooleanF {#1} { no } star } \bool_lazy_or:nnTF { \tl_if_novalue_p:n {#3} } { \tl_if_blank_p:n {#3} } { \tl_set:Nx \l__lipsum_output_tl { \lipsum_get_range:nn { \l__lipsum_a_int } { \l__lipsum_b_int } } } { \str_set:Nn \l__lipsum_sep_set_str { parsepar } \tl_set:Nx \l__lipsum_output_tl { \lipsum_get_range:nn { \l__lipsum_a_int } { \l__lipsum_b_int } } \str_set:Nx \l__lipsum_sep_set_str { \IfBooleanF {#1} { no } star } \__lipsum_parse_sentence_range:eNN {#3} \l__lipsum_a_int \l__lipsum_b_int \tl_set:Nx \l__lipsum_output_tl { \lipsum_get_sentences:nnV { \l__lipsum_a_int } { \l__lipsum_b_int } \l__lipsum_output_tl } } \str_set_eq:NN \l__lipsum_sep_set_str \l__lipsum_tmpa_str \__lipsum_do:N \l__lipsum_output_tl } \cs_new_eq:NN \__lipsum_do:N ? \cs_new_protected:Npn \__lipsum_set_hyphens: { \bool_if:NTF \l__lipsum_autolang_bool { \use:n } { \use_none:n } { \cs_if_exist:NTF \hyphenrules { \cs_if_exist:cTF { l@ \g__lipsum_language_tl } { \exp_args:NV \hyphenrules \g__lipsum_language_tl \cs_set_protected:Npx \__lipsum_restore_hyphens: { \exp_not:N \hyphenrules { \languagename } } } { \__lipsum_missing_language_warning: } } { \__lipsum_set_hyphens_babel_missing: } } } \cs_new_protected:Npn \__lipsum_restore_hyphens: { \prg_do_nothing: } \cs_new_protected:Npn \__lipsum_set_hyphens_babel_missing: { \msg_warning:nnn { lipsum } { missing-babel } { preamble } \cs_gset_eq:NN \__lipsum_set_hyphens_babel_missing: \prg_do_nothing: } \AtBeginDocument { \cs_gset_protected:Npx \__lipsum_set_hyphens_babel_missing: { \@ifpackageloaded { babel } { \msg_error:nnn { lipsum } { missing-babel } { impossible } } { \msg_warning:nnn { lipsum } { missing-babel } { document } } \setlipsum { auto-lang = false } } } \cs_if_exist:NT \DeclareHookRule { \DeclareHookRule { begindocument } { lipsum } { after } { babel } } \cs_new_protected:Npn \__lipsum_missing_language_warning: { \msg_warning:nn { lipsum } { missing-language } \tl_gset_eq:NN \g__lipsum_language_tl \languagename } \cs_new_protected:Npn \NewLipsumPar #1 { \int_gincr:N \g__lipsum_par_int \tl_gclear_new:c { g__lipsum_par_ \int_use:N \g__lipsum_par_int _tl } \tl_gset:cn { g__lipsum_par_ \int_use:N \g__lipsum_par_int _tl } {#1} } \NewDocumentCommand \SetLipsumText { m } { \str_if_eq:VnF \g__lipsum_text_str {#1} { \tl_gset:Nn \g__lipsum_language_tl { english } \int_gzero:N \g__lipsum_par_int \file_input:n { #1.ltd } \str_gset:Nn \g__lipsum_text_str {#1} } } \NewDocumentCommand \SetLipsumLanguage { m } { \tl_gset:Nn \g__lipsum_language_tl {#1} } \cs_new_protected:Npn \__lipsum_delim_restore:nnn #1 #2 #3 { \keys_set:nn { lipsum } { #1-before = , #1-begin = , #1-end = , #1-after = , #1-before* = , #1-begin* = , #1-end* = , #1-after* = , #1-sep = {#2}, #1-sep* = {#3} } } \cs_new_protected:Nn \__lipsum_restore_sentence_list: { \__lipsum_delim_restore:nnn { sentence } { ~ } { ~ } } \cs_new_eq:NN \__lipsum_restore_par_list: ? \cs_new_protected:Npn \LipsumRestoreParList { \__lipsum_deprecated:n { LipsumRestoreParList } \__lipsum_restore_par_list: } \cs_new_protected:Npn \LipsumRestoreSentenceList { \__lipsum_deprecated:n { LipsumRestoreSentenceList } \__lipsum_restore_sentence_list: } \cs_new_protected:Npn \LipsumRestoreAll { \__lipsum_deprecated:n { LipsumRestoreAll } \__lipsum_restore_par_list: \__lipsum_restore_sentence_list: } \NewDocumentCommand \setlipsum { +m } { \keys_set:nn { lipsum } {#1} } \keys_define:nn { lipsum } { nopar .choice: , nopar / true .code:n = { \cs_gset_protected:Npn \__lipsum_restore_par_list: { \__lipsum_delim_restore:nnn { par } { ~ } { \par } } } , nopar / false .code:n = { \cs_gset_protected:Nn \__lipsum_restore_par_list: { \__lipsum_delim_restore:nnn { par } { \par } { ~ } } } , nopar .initial:n = false , nopar .default:n = true , auto-lang .bool_set:N = \l__lipsum_autolang_bool , auto-lang .initial:n = true , auto-lang .default:n = true , text .code:n = \SetLipsumText{#1} , text .value_required:n = true , language .tl_gset:N = \g__lipsum_language_tl , language .value_required:n = true , default-range .code:n = \SetLipsumDefault{#1} , default-range .initial:n = 1-7 , default-range .default:n = 1-7 , } \cs_set_protected:Npn \__lipsum_tmp:w #1 #2 #3 { \keys_define:nn { lipsum } { #1-before #2 .tl_set:c = l__lipsum_#1_start _#3star_tl , #1-begin #2 .tl_set:c = l__lipsum_#1_itemstart _#3star_tl , #1-sep #2 .tl_set:c = l__lipsum_#1_itemseparator _#3star_tl , #1-end #2 .tl_set:c = l__lipsum_#1_itemend _#3star_tl , #1-after #2 .tl_set:c = l__lipsum_#1_end _#3star_tl , } } \__lipsum_tmp:w { par } { } { no } \__lipsum_tmp:w { sentence } { } { no } \__lipsum_tmp:w { par } * { } \__lipsum_tmp:w { sentence } * { } \ExplSyntaxOff \setlipsum{text=lipsum} \ProcessKeysOptions{lipsum} \ExplSyntaxOn \__lipsum_restore_par_list: \__lipsum_restore_sentence_list: \msg_new:nnn { lipsum } { invalid-range } { Invalid~number~or~range~'#1'. } \msg_new:nnn { lipsum } { cmd-deprecated } { Command~'\iow_char:N\\#1'~deprecated. \\ See~the~lipsum~documentation~for~help. } \msg_new:nnn { lipsum } { missing-babel } { Hyphenation~patterns~for~'\g__lipsum_language_tl'~ cannot~be~used~because~babel~is~not~loaded.~ \str_case:nn {#1} { { preamble } { Loading~lipsum~after~babel~should~fix~the~issue. } { document } { The~default~document~language~will~be~used~ for~hyphenation~instead. } { impossible } { Something~wrong~happened~and~the~command~ \iow_char:N\\hyphenrules~is~not~available. \\ \\ Please~report! } } \\ \\ This~message~won't~be~shown~again. } \msg_new:nnn { lipsum } { missing-language } { Unknown~language~'\g__lipsum_language_tl'.~ Hyphenation~patterns~for~'\languagename'~will~be~used~instead. } %% %% %% End of file `lipsum.sty'.