[latex3-commits] [latex3/latex2e] lab-review-02: redefine \part only if it defined (33098896)

github at latex-project.org github at latex-project.org
Wed Jun 21 20:56:59 CEST 2023


Repository : https://github.com/latex3/latex2e
On branch  : lab-review-02
Link       : https://github.com/latex3/latex2e/commit/33098896de8481674f043eeb579262b7c1a3b3cc

>---------------------------------------------------------------

commit 33098896de8481674f043eeb579262b7c1a3b3cc
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Wed Jun 21 20:56:59 2023 +0200

    redefine \part only if it defined


>---------------------------------------------------------------

33098896de8481674f043eeb579262b7c1a3b3cc
 required/latex-lab/changes.txt       |  3 +++
 required/latex-lab/latex-lab-sec.dtx | 45 +++++++++++++++++++-----------------
 2 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/required/latex-lab/changes.txt b/required/latex-lab/changes.txt
index 7e76d749..4baeffb0 100644
--- a/required/latex-lab/changes.txt
+++ b/required/latex-lab/changes.txt
@@ -1,3 +1,6 @@
+2023-06-21 Ulrike Fischer <Ulrike.Fischer at latex-project.org>
+    * latex-lab-sec.dtx: redefine \part only if it defined (letter.cls ...)
+
 2023-06-07 Ulrike Fischer <Ulrike.Fischer at latex-project.org>
     * latex-lab-block-tagging.dtx corrected tagging of caption
     * new latex-lab-firstaid.dtx with adaptions to external packages
diff --git a/required/latex-lab/latex-lab-sec.dtx b/required/latex-lab/latex-lab-sec.dtx
index 5df3803b..0a9496f2 100644
--- a/required/latex-lab/latex-lab-sec.dtx
+++ b/required/latex-lab/latex-lab-sec.dtx
@@ -31,7 +31,7 @@
 % \title{The \textsf{latex-lab-sec} package\\
 % Changes related to the tagging of sectioning commands}
 % \author{\LaTeX{} Project\thanks{Initial implementation done by Ulrike Fischer}}
-% \date{v0.83 2023-06-07}
+% \date{v0.84 2023-06-21}
 %
 % \maketitle
 %
@@ -437,45 +437,48 @@
 %    \end{macrocode}
 % This redefines \cs{part} in article class.
 %    \begin{macrocode}
-     \RenewDocumentCommand\part{ s O{#3} m }
+     \@ifundefined{part}{}
       {
-        \if at noskipsec \leavevmode \fi
-        \par
-        \addvspace{4ex}%
-        \@afterindentfalse
+        \RenewDocumentCommand\part{ s O{#3} m }
+         {
+           \if at noskipsec \leavevmode \fi
+           \par
+           \addvspace{4ex}%
+           \@afterindentfalse
 %    \end{macrocode}
 % This are the tagging commands needed at the begin. They open a Part structure
 % and the structure for the title of the heading.
 %    \begin{macrocode}
         % tagging start commands
-        \tag_tool:n {sec-start-part=#2}
+          \tag_tool:n {sec-start-part=#2}
         % end tagging start commands
 %    \end{macrocode}
 % This adds a  manual target if the part is unnumbered or starred.
 % It replaces the hyperref patches.
 %    \begin{macrocode}
-        \bool_lazy_any:nT  
-          {
-            { #1 } 
+           \bool_lazy_any:nT  
             {
-              \int_compare_p:nNn {\c at secnumdepth}<{-1} 
+              { #1 } 
+              { 
+                \int_compare_p:nNn {\c at secnumdepth}<{-1} 
+              } 
+            }  
+            {
+              \MakeLinkTarget[part]{}
             }
-          }  
-          {
-            \MakeLinkTarget[part]{}
-          }
 %    \end{macrocode}
 % The main call to the underlying commands. 
 %    \begin{macrocode}
-        \IfBooleanTF 
-          {#1}
-          { \@spart {#3} }
-          { \@part [#2]{#3} }
+          \IfBooleanTF 
+            {#1}
+            { \@spart {#3} }
+            { \@part [#2]{#3} }
 %    \end{macrocode}
 % and now the closing command for the tagging of the title.
 %    \begin{macrocode}
-       \tag_tool:n {sec-stop-part} 
-      }    
+         \tag_tool:n {sec-stop-part} 
+         }
+       }    
     }
 %    \end{macrocode}
 % Redefinitions for book and report





More information about the latex3-commits mailing list.