\ExplSyntaxOn %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Environment for comments. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Standard for every comment \DeclareTColorBox {__rpg_comment} {o} { before~upper = { \bool_if:NT \l__rpg_layout_bool { \bool_if:NF \l__rpg_justified_bool { \RaggedRight } } }, code = {\linespread{.9}}, frame~hidden, boxrule = 0pt, breakable, enhanced, before~skip = 13pt plus 4pt minus 4pt, toptitle = 2pt, boxsep = 3pt, left = 6pt, right = 6pt, top = 0pt, bottom = 2pt, sharp~corners, fonttitle = \RpgFontCommentTitle, fontupper = \RpgFontCommentBody, fontlower = \RpgFontCommentBody, parbox = false, coltitle = black, after~skip = 13pt plus 4pt minus 4pt, #1, } % Extra key for controlling the color of the title and the background \keys_define:nn { rpg / comment } { color .tl_set:N = \l__rpg_comment_color_tl, color .initial:n = commentcolor, color .value_required:n = true, } % This function, through its variant, forces the expansion of the tcb keys % passed to the environment by the user before it invokes the tcolorbox \cs_new_protected:Nn \__rpg_start_comment:nn { \begin {__rpg_comment} [ #1, #2 ] } \cs_generate_variant:Nn \__rpg_start_comment:nn { nV } % The RpgComment environment % #1 - keys. We handle the custom color key before passing other keys on % #2 - title. \NewDocumentEnvironment {RpgComment} { o m } { \group_begin: \keys_set_known:nnN { rpg / comment } {#1} \l_tmpa_tl \str_if_eq:VnT \l_tmpa_tl { -NoValue- } { \tl_set_eq:NN \l_tmpa_tl \c_empty_tl } \__rpg_start_comment:nV { colback = \l__rpg_comment_color_tl, colbacktitle = \l__rpg_comment_color_tl, title = {#2}, } { \l_tmpa_tl } } { \end {__rpg_comment} \group_end: }