From ef2d4cbbeae7ccacb977dc42a4df7f44f61ee1a8 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 10 Jul 2022 19:59:27 +0000 Subject: sidenotesplus (10jul22) git-svn-id: svn://tug.org/texlive/trunk@63867 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/sidenotesplus/sidenotesplus.dtx | 55 ++++++++++++++-------- 1 file changed, 35 insertions(+), 20 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/latex/sidenotesplus/sidenotesplus.dtx b/Master/texmf-dist/source/latex/sidenotesplus/sidenotesplus.dtx index b6c51d20d25..7e76cd609db 100644 --- a/Master/texmf-dist/source/latex/sidenotesplus/sidenotesplus.dtx +++ b/Master/texmf-dist/source/latex/sidenotesplus/sidenotesplus.dtx @@ -36,7 +36,7 @@ %\NeedsTeXFormat{LaTeX2e}[2020/10/01] %\ProvidesPackage{sidenotesplus} %<*package> - [2022/05/31 v1.01 rich text marginal notes, tables and figures ] + [2022/07/09 1.02 rich text marginal notes, tables and figures ] % %\RequirePackage{marginnote} % provides an offset option for the marginals instead of a float %\RequirePackage{caption} % handles the captions (in the margin) @@ -94,8 +94,9 @@ % % \maketitle % -% \changes{v1.0}{2022/05/15}{Initial Release} -% \changes{v1.01}{2022/05/31}{Environment text* improved} +% \changes{1.0}{2022/05/15}{Initial Release} +% \changes{1.01}{2022/05/31}{Environment text* improved} +% \changes{1.02}{2022/07/09}{added Ragged option} % % \begin{abstract} % \noindent A package to manage the margin notes, figures, tables and captions. @@ -124,6 +125,7 @@ % |size=| & |footnote, normal, small, script| \\ % |shape=| & | up, it, sl|\\ % |ragged| & switches to ragged outer margins\\ +% |Ragged| & switches to ragged outer margins but uses ragged2e package\\ % |classic| & switches to a classic look\\ % |sepdiff=| & |1em|, or a valid length within reason \\ % |alerton| & switches on the rendering of the margin alerts \\ @@ -132,9 +134,13 @@ % ~ % % The normal page style is that margin notes are left-right justified with the -% last line ragged to the outer edge. The option |ragged| changes this +% last line ragged to the outer edge. The option |ragged| or |Ragged| changes this % style to ragged-outer, that is the left page's marginal notes are |\raggedleft| % and the right page's are |\raggedright|. +% If you opt to use |Ragged| the package |ragged2e| is loaded and |RaggedLeft/Right| +% is used instead of |raggedleft/right|. Load package |ragged2e| with required +% options before |sidenotesplus| is loaded, otherwise |sidenotesplus| loads +% |ragged2e| without any options. % % The marginal note's reference number or mark is placed in the margin separator, % that is on the left page the mark is on the right hand side of the note. @@ -325,6 +331,8 @@ % \item[ifoddpage] provides the command |\ifoddpage| % \item[etoolbox] provides the command |\patchcmd| % \item[calc] provides calculation such as adding lengths +% \item[ragged2e] if |Ragged| option is used, and provides hyphenation +% to prevent very short lines % % \end{description}% @@ -360,7 +368,7 @@ \snp@size\snp@shape\snp@font\leavevmode% \lineskip=0pt \lineskiplimit=0pt % \tolerance=2000 \hyphenpenalty=300 \exhyphenpenalty=300% - \doublehyphendemerits=100000% + \doublehyphendemerits=300% \finalhyphendemerits=\doublehyphendemerits } \NewDocumentCommand \snp@sideformat {} {} @@ -385,6 +393,7 @@ \bool_new:N \l@snp@alerton \bool_new:N \l@snp@alertmarkon \bool_new:N \l@snp@ragged +\bool_new:N \l@snp@Ragged \bool_new:N \l@snp@symmetric \bool_new:N \l@snp@page @@ -392,6 +401,7 @@ \bool_set_false:N \l@snp@alerton \bool_set_false:N \l@snp@alertmarkon \bool_set_false:N \l@snp@ragged +\bool_set_false:N \l@snp@Ragged \bool_set_true:N \l@snp@symmetric @@ -430,9 +440,19 @@ ragged .code:n = { \RenewDocumentCommand \snp@leftmarginstyle {}{\raggedleft} \RenewDocumentCommand \snp@rightmarginstyle {}{\raggedright} \bool_set_true:N \l@snp@ragged }, + Ragged .code:n = { \RenewDocumentCommand \snp@leftmarginstyle {}{\RaggedLeft} + \RenewDocumentCommand \snp@rightmarginstyle {}{\RaggedRight} + \bool_set_true:N \l@snp@Ragged + \bool_set_true:N \l@snp@ragged }, alerton .code:n = {\bool_set_true:N \l@snp@alerton}, } \ProcessKeysOptions { sidenoteplus } +\bool_if:NTF \l@snp@Ragged + { + \@ifpackageloaded{ragged2e} + {\relax}{\RequirePackage{ragged2e}} + } + {\relax} \bool_if:NTF \l@snp@ragged {\setlength{\snp@marginsepdiff}{0pt} \bool_set_false:N \l@snp@symmetric} {\relax} @@ -683,13 +703,13 @@ % -- % % \begin{macrocode} -\NewDocumentCommand \sidenotemark {s d() d!! m } +\NewDocumentCommand \sidenotemark {s d() d!! } { \IfBooleanTF{#1} { % starred \relax} {% unstarred - \IfNoValueOrEmptyT{#3} + \IfNoValueOrEmptyTF{#3} {\snp@sidenotemark (#2)} {\snp@sidenotemark !#3!( #2)} } @@ -1213,19 +1233,14 @@ % \begin{macrocode} \RenewDocumentEnvironment{table*}{O{htbp} } { - \begin{table}[#1] - \begin{@snp@autoadjustwidth}{}{\d@snp@extrawidth} - \if@twoside - \snp@isoddpage{\raggedright}{\raggedleft} - \snp@isoddpage - {\captionsetup{margin={0pt,0pt}} } - {\captionsetup{margin={-\d@snp@extrawidth,\d@snp@extrawidth}} } - \else - \raggedright \captionsetup{margin={0pt,0pt}} - \fi -} -{ % end part - \end{@snp@autoadjustwidth} + \begin{table}[#1] + \begin{@snp@autoadjustwidth}{}{\d@snp@extrawidth} + \begin{minipage}[c]{\linewidth} + \centering + \captionsetup{ margin={\d@snp@extrawidth/2,\d@snp@extrawidth/2}} +}{ % end part + \end{minipage} + \end{@snp@autoadjustwidth} \end{table} } % \end{macrocode} -- cgit v1.2.3