diff --git a/tst/worksheets.tst b/tst/worksheets.tst
index deb2ac2e..a5c8f961 100644
--- a/tst/worksheets.tst
+++ b/tst/worksheets.tst
@@ -19,6 +19,62 @@ gap> AUTODOC_TestWorkSheet("autoplain");
#I Chapter 1...
#I extracted 3 examples
+#
+gap> AUTODOC_TestWorkSheet("paired-structure");
+#I Extracting manual examples for Paired Structure Test package ...
+#I 1 chapters detected
+#I Chapter 1...
+#I no examples
+
+#
+gap> AUTODOC_TestWorkSheet("paired-structure-autoplain");
+#I Extracting manual examples for Paired Structure Test package ...
+#I 1 chapters detected
+#I Chapter 1...
+#I no examples
+
+#
+gap> AUTODOC_TestWorkSheet("paired-blocks");
+#I Extracting manual examples for Paired Blocks Test package ...
+#I 1 chapters detected
+#I Chapter 1...
+#I no examples
+
+#
+gap> AUTODOC_TestWorkSheet("paired-blocks-autoplain");
+#I Extracting manual examples for Paired Blocks Test package ...
+#I 1 chapters detected
+#I Chapter 1...
+#I no examples
+
+#
+gap> AUTODOC_TestWorkSheet("paired-examples");
+#I Extracting manual examples for Paired Examples Test package ...
+#I 1 chapters detected
+#I Chapter 1...
+#I extracted 4 examples
+
+#
+gap> AUTODOC_TestWorkSheet("paired-examples-autoplain");
+#I Extracting manual examples for Paired Examples Test package ...
+#I 1 chapters detected
+#I Chapter 1...
+#I extracted 4 examples
+
+#
+gap> AUTODOC_TestWorkSheet("paired-titlepage");
+#I Extracting manual examples for Paired Titlepage Test package ...
+#I 1 chapters detected
+#I Chapter 1...
+#I no examples
+
+#
+gap> AUTODOC_TestWorkSheet("paired-titlepage-autoplain");
+#I Extracting manual examples for Paired Titlepage Test package ...
+#I 1 chapters detected
+#I Chapter 1...
+#I no examples
+
#
#
gap> STOP_TEST( "worksheets.tst" );
diff --git a/tst/worksheets/paired-blocks-autoplain.expected/Paired_Blocks_Test.xml b/tst/worksheets/paired-blocks-autoplain.expected/Paired_Blocks_Test.xml
new file mode 100644
index 00000000..431b15da
--- /dev/null
+++ b/tst/worksheets/paired-blocks-autoplain.expected/Paired_Blocks_Test.xml
@@ -0,0 +1,15 @@
+
+
+
+
+]
+>
+
+<#Include SYSTEM "title.xml">
+
+
+<#Include SYSTEM "_AutoDocMainFile.xml">
+
+
diff --git a/tst/worksheets/paired-blocks-autoplain.expected/_AutoDocMainFile.xml b/tst/worksheets/paired-blocks-autoplain.expected/_AutoDocMainFile.xml
new file mode 100644
index 00000000..7c93de9e
--- /dev/null
+++ b/tst/worksheets/paired-blocks-autoplain.expected/_AutoDocMainFile.xml
@@ -0,0 +1,4 @@
+
+
+
+<#Include SYSTEM "_Chapter_Blocks_Chapter.xml">
diff --git a/tst/worksheets/paired-blocks-autoplain.expected/_Chapter_Blocks_Chapter.xml b/tst/worksheets/paired-blocks-autoplain.expected/_Chapter_Blocks_Chapter.xml
new file mode 100644
index 00000000..0a1b71cb
--- /dev/null
+++ b/tst/worksheets/paired-blocks-autoplain.expected/_Chapter_Blocks_Chapter.xml
@@ -0,0 +1,60 @@
+
+
+
+
+Blocks Chapter
+
+
+Primary Blocks Section
+
+Intro text for the block-oriented worksheet.
+
+
+
+
+
+Injected Section
+
+This section exists so the paired structure stays aligned.
+
+
+
+
+
+Utility Blocks Section
+
+
+Text before inserting the stored chunk.
+<#Include Label="StoredChunk">
+
+
+Text before inserting the stored code.
+<#Include Label="StoredCode">
+
+
+
+
+
+
+
+
+
+Stop Here
+
+This text should appear before the parser stops.
+
+
+
+
+
+
+
+
diff --git a/tst/worksheets/paired-blocks-autoplain.expected/_Chunks.xml b/tst/worksheets/paired-blocks-autoplain.expected/_Chunks.xml
new file mode 100644
index 00000000..922bc551
--- /dev/null
+++ b/tst/worksheets/paired-blocks-autoplain.expected/_Chunks.xml
@@ -0,0 +1,16 @@
+<#GAPDoc Label="StoredChunk">
+Chunk line one.
+Chunk line two with inline code.
+
+<#/GAPDoc>
+<#GAPDoc Label="StoredCode">
+
10 then
+ Print("block code reached\n");
+fi;
+]]>
+
+
+<#/GAPDoc>
diff --git a/tst/worksheets/paired-blocks-autoplain.expected/_entities.xml b/tst/worksheets/paired-blocks-autoplain.expected/_entities.xml
new file mode 100644
index 00000000..3dcebb13
--- /dev/null
+++ b/tst/worksheets/paired-blocks-autoplain.expected/_entities.xml
@@ -0,0 +1 @@
+Paired_Blocks_Test'>
diff --git a/tst/worksheets/paired-blocks-autoplain.expected/title.xml b/tst/worksheets/paired-blocks-autoplain.expected/title.xml
new file mode 100644
index 00000000..8a0f179c
--- /dev/null
+++ b/tst/worksheets/paired-blocks-autoplain.expected/title.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+ Paired Blocks Test
+
+
+ 7 March 2026
+
+
\ No newline at end of file
diff --git a/tst/worksheets/paired-blocks-autoplain.sheet/plain.autodoc b/tst/worksheets/paired-blocks-autoplain.sheet/plain.autodoc
new file mode 100644
index 00000000..836ea295
--- /dev/null
+++ b/tst/worksheets/paired-blocks-autoplain.sheet/plain.autodoc
@@ -0,0 +1,44 @@
+@Title Paired Blocks Test
+@Date 2026-03-07
+@Chapter Blocks Chapter
+@Section Primary Blocks Section
+Intro text for the block-oriented worksheet.
+
+@Section Injected Section
+This section exists so the paired structure stays aligned.
+
+@Section Utility Blocks Section
+
+@BeginChunk StoredChunk
+Chunk line one.
+Chunk line two with `inline code`.
+@EndChunk
+
+Text before inserting the stored chunk.
+@InsertChunk StoredChunk
+
+@BeginCode StoredCode
+block_value := 11;
+
+if block_value > 10 then
+ Print("block code reached\n");
+fi;
+@EndCode
+
+Text before inserting the stored code.
+@InsertCode StoredCode
+
+@LatexOnly \textbf{Latex-only inline text.}
+@BeginLatexOnly
+\emph{Latex-only block text.}
+@EndLatexOnly
+
+@NotLatex HTML-and-text inline output.
+@BeginNotLatex
+HTML-and-text block output.
+@EndNotLatex
+
+@Subsection Stop Here
+This text should appear before the parser stops.
+@DoNotReadRestOfFile
+This trailing text should never reach the expected XML.
diff --git a/tst/worksheets/paired-blocks.expected/Paired_Blocks_Test.xml b/tst/worksheets/paired-blocks.expected/Paired_Blocks_Test.xml
new file mode 100644
index 00000000..431b15da
--- /dev/null
+++ b/tst/worksheets/paired-blocks.expected/Paired_Blocks_Test.xml
@@ -0,0 +1,15 @@
+
+
+
+
+]
+>
+
+<#Include SYSTEM "title.xml">
+
+
+<#Include SYSTEM "_AutoDocMainFile.xml">
+
+
diff --git a/tst/worksheets/paired-blocks.expected/_AutoDocMainFile.xml b/tst/worksheets/paired-blocks.expected/_AutoDocMainFile.xml
new file mode 100644
index 00000000..7c93de9e
--- /dev/null
+++ b/tst/worksheets/paired-blocks.expected/_AutoDocMainFile.xml
@@ -0,0 +1,4 @@
+
+
+
+<#Include SYSTEM "_Chapter_Blocks_Chapter.xml">
diff --git a/tst/worksheets/paired-blocks.expected/_Chapter_Blocks_Chapter.xml b/tst/worksheets/paired-blocks.expected/_Chapter_Blocks_Chapter.xml
new file mode 100644
index 00000000..027688d4
--- /dev/null
+++ b/tst/worksheets/paired-blocks.expected/_Chapter_Blocks_Chapter.xml
@@ -0,0 +1,78 @@
+
+
+
+
+Blocks Chapter
+
+
+Primary Blocks Section
+
+ Intro text for the block-oriented worksheet.
+
+Block Group Title
+
+
+
+ an object
+
+
+ First grouped operation description.
+ Second grouped declaration stays in the implicit group.
+ This property joins the earlier group explicitly.
+
+
+
+
+
+
+
+
+Injected Section
+
+ This section exists so @ChapterInfo has a concrete destination.
+
+
+ a record
+
+
+ This attribute is redirected into the injected section.
+
+
+
+
+
+
+
+
+Utility Blocks Section
+
+ Text before inserting the stored chunk.
+<#Include Label="StoredChunk">
+
+ Text before inserting the stored code.
+<#Include Label="StoredCode">
+
+
+
+
+
+
+Stop Here
+
+ This text should appear before the parser stops.
+
+
+
+
+
+
+
+
diff --git a/tst/worksheets/paired-blocks.expected/_Chunks.xml b/tst/worksheets/paired-blocks.expected/_Chunks.xml
new file mode 100644
index 00000000..6b9d9004
--- /dev/null
+++ b/tst/worksheets/paired-blocks.expected/_Chunks.xml
@@ -0,0 +1,16 @@
+<#GAPDoc Label="StoredChunk">
+ Chunk line one.
+ Chunk line two with inline code.
+
+<#/GAPDoc>
+<#GAPDoc Label="StoredCode">
+ 10 then
+ Print("block code reached\n");
+fi;
+]]>
+
+
+<#/GAPDoc>
diff --git a/tst/worksheets/paired-blocks.expected/_entities.xml b/tst/worksheets/paired-blocks.expected/_entities.xml
new file mode 100644
index 00000000..3dcebb13
--- /dev/null
+++ b/tst/worksheets/paired-blocks.expected/_entities.xml
@@ -0,0 +1 @@
+Paired_Blocks_Test'>
diff --git a/tst/worksheets/paired-blocks.expected/title.xml b/tst/worksheets/paired-blocks.expected/title.xml
new file mode 100644
index 00000000..8a0f179c
--- /dev/null
+++ b/tst/worksheets/paired-blocks.expected/title.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+ Paired Blocks Test
+
+
+ 7 March 2026
+
+
\ No newline at end of file
diff --git a/tst/worksheets/paired-blocks.sheet/worksheet.g b/tst/worksheets/paired-blocks.sheet/worksheet.g
new file mode 100644
index 00000000..92a60e99
--- /dev/null
+++ b/tst/worksheets/paired-blocks.sheet/worksheet.g
@@ -0,0 +1,73 @@
+#! @Title Paired Blocks Test
+#! @Date 2026-03-07
+#! @Chapter Blocks Chapter
+#! @Section Primary Blocks Section
+#! Intro text for the block-oriented worksheet.
+
+#! @BeginGroup block-group
+#! @GroupTitle Block Group Title
+
+#! @Description
+#! First grouped operation description.
+#! @Returns an object
+#! @Arguments obj[, flag]: eager := true
+#! @Label grouped-operation-label
+DeclareOperation( "GroupedBlockOperation", [ IsObject ] );
+
+#! @Description
+#! Second grouped declaration stays in the implicit group.
+DeclareAttribute( "GroupedBlockAttribute", IsObject );
+
+#! @EndGroup
+
+#! @Description
+#! This property joins the earlier group explicitly.
+#! @Returns true or false
+#! @Arguments obj
+#! @Group block-group
+DeclareProperty( "LateJoinedBlockProperty", IsObject );
+
+#! @Section Injected Section
+#! This section exists so @ChapterInfo has a concrete destination.
+
+#! @Section Utility Blocks Section
+#! @Description
+#! This attribute is redirected into the injected section.
+#! @Returns a record
+#! @Arguments source
+#! @ChapterInfo Blocks Chapter, Injected Section
+DeclareAttribute( "RedirectedBlockAttribute", IsObject );
+
+#! @BeginChunk StoredChunk
+#! Chunk line one.
+#! Chunk line two with `inline code`.
+#! @EndChunk
+
+#! Text before inserting the stored chunk.
+#! @InsertChunk StoredChunk
+
+#! @BeginCode StoredCode
+block_value := 11;
+
+if block_value > 10 then
+ Print("block code reached\n");
+fi;
+#! @EndCode
+
+#! Text before inserting the stored code.
+#! @InsertCode StoredCode
+
+#! @LatexOnly \textbf{Latex-only inline text.}
+#! @BeginLatexOnly
+#! \emph{Latex-only block text.}
+#! @EndLatexOnly
+
+#! @NotLatex HTML-and-text inline output.
+#! @BeginNotLatex
+#! HTML-and-text block output.
+#! @EndNotLatex
+
+#! @Subsection Stop Here
+#! This text should appear before the parser stops.
+#! @DoNotReadRestOfFile
+#! This trailing text should never reach the expected XML.
diff --git a/tst/worksheets/paired-examples-autoplain.expected/Paired_Examples_Test.xml b/tst/worksheets/paired-examples-autoplain.expected/Paired_Examples_Test.xml
new file mode 100644
index 00000000..1f75a499
--- /dev/null
+++ b/tst/worksheets/paired-examples-autoplain.expected/Paired_Examples_Test.xml
@@ -0,0 +1,15 @@
+
+
+
+
+]
+>
+
+<#Include SYSTEM "title.xml">
+
+
+<#Include SYSTEM "_AutoDocMainFile.xml">
+
+
diff --git a/tst/worksheets/paired-examples-autoplain.expected/_AutoDocMainFile.xml b/tst/worksheets/paired-examples-autoplain.expected/_AutoDocMainFile.xml
new file mode 100644
index 00000000..9de68e07
--- /dev/null
+++ b/tst/worksheets/paired-examples-autoplain.expected/_AutoDocMainFile.xml
@@ -0,0 +1,4 @@
+
+
+
+<#Include SYSTEM "_Chapter_Examples_Chapter.xml">
diff --git a/tst/worksheets/paired-examples-autoplain.expected/_Chapter_Examples_Chapter.xml b/tst/worksheets/paired-examples-autoplain.expected/_Chapter_Examples_Chapter.xml
new file mode 100644
index 00000000..12fc18c5
--- /dev/null
+++ b/tst/worksheets/paired-examples-autoplain.expected/_Chapter_Examples_Chapter.xml
@@ -0,0 +1,83 @@
+
+
+
+
+Examples Chapter
+
+
+Examples Section
+
+This worksheet exercises example and log commands in plain-text mode.
+
+
+Tested examples
+
+ plain_example_value := 2 + 3;
+5
+]]>
+
+
+
+ plain_alias_example := 3 + 4;
+7
+]]>
+
+
+
+ 10 - 3;
+7
+]]>
+
+
+
+ 6 * 7;
+42
+]]>
+
+
+
+
+
+
+
+Untested logs
+
+ plain_log_value := 9;
+9
+]]>
+
+
+
+ plain_alias_log := 11;
+11
+]]>
+
+
+
+ "plain log session";
+"plain log session"
+]]>
+
+
+
+ "plain alias log session";
+"plain alias log session"
+]]>
+
+
+
+
+
+
+
+
+
+
diff --git a/tst/worksheets/paired-examples-autoplain.expected/_Chunks.xml b/tst/worksheets/paired-examples-autoplain.expected/_Chunks.xml
new file mode 100644
index 00000000..e69de29b
diff --git a/tst/worksheets/paired-examples-autoplain.expected/_entities.xml b/tst/worksheets/paired-examples-autoplain.expected/_entities.xml
new file mode 100644
index 00000000..55e0e3b1
--- /dev/null
+++ b/tst/worksheets/paired-examples-autoplain.expected/_entities.xml
@@ -0,0 +1 @@
+Paired_Examples_Test'>
diff --git a/tst/worksheets/paired-examples-autoplain.expected/title.xml b/tst/worksheets/paired-examples-autoplain.expected/title.xml
new file mode 100644
index 00000000..6fa5fd9d
--- /dev/null
+++ b/tst/worksheets/paired-examples-autoplain.expected/title.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+ Paired Examples Test
+
+
+ 7 March 2026
+
+
\ No newline at end of file
diff --git a/tst/worksheets/paired-examples-autoplain.expected/tst/paired_examples_test01.tst b/tst/worksheets/paired-examples-autoplain.expected/tst/paired_examples_test01.tst
new file mode 100644
index 00000000..5c2533d1
--- /dev/null
+++ b/tst/worksheets/paired-examples-autoplain.expected/tst/paired_examples_test01.tst
@@ -0,0 +1,30 @@
+# Paired Examples Test, chapter 1
+#
+# DO NOT EDIT THIS FILE - EDIT EXAMPLES IN THE SOURCE INSTEAD!
+#
+# This file has been generated by AutoDoc. It contains examples extracted from
+# the package documentation. Each example is preceded by a comment which gives
+# the name of a GAPDoc XML file and a line range from which the example were
+# taken. Note that the XML file in turn may have been generated by AutoDoc
+# from some other input.
+#
+gap> START_TEST("paired_examples_test01.tst");
+
+# _Chapter_Examples_Chapter.xml:15-18
+gap> plain_example_value := 2 + 3;
+5
+
+# _Chapter_Examples_Chapter.xml:22-25
+gap> plain_alias_example := 3 + 4;
+7
+
+# _Chapter_Examples_Chapter.xml:29-32
+gap> 10 - 3;
+7
+
+# _Chapter_Examples_Chapter.xml:36-39
+gap> 6 * 7;
+42
+
+#
+gap> STOP_TEST("paired_examples_test01.tst", 1);
diff --git a/tst/worksheets/paired-examples-autoplain.sheet/plain.autodoc b/tst/worksheets/paired-examples-autoplain.sheet/plain.autodoc
new file mode 100644
index 00000000..f185cac1
--- /dev/null
+++ b/tst/worksheets/paired-examples-autoplain.sheet/plain.autodoc
@@ -0,0 +1,47 @@
+@Title Paired Examples Test
+@Date 2026-03-07
+@Chapter Examples Chapter
+@Section Examples Section
+This worksheet exercises example and log commands in plain-text mode.
+
+@Subsection Tested examples
+@BeginExample
+plain_example_value := 2 + 3;
+#! 5
+@EndExample
+
+@Example
+plain_alias_example := 3 + 4;
+#! 7
+@EndExample
+
+@BeginExampleSession
+gap> 10 - 3;
+7
+@EndExampleSession
+
+@ExampleSession
+gap> 6 * 7;
+42
+@EndExampleSession
+
+@Subsection Untested logs
+@BeginLog
+plain_log_value := 9;
+#! 9
+@EndLog
+
+@Log
+plain_alias_log := 11;
+#! 11
+@EndLog
+
+@BeginLogSession
+gap> "plain log session";
+"plain log session"
+@EndLogSession
+
+@LogSession
+gap> "plain alias log session";
+"plain alias log session"
+@EndLogSession
diff --git a/tst/worksheets/paired-examples.expected/Paired_Examples_Test.xml b/tst/worksheets/paired-examples.expected/Paired_Examples_Test.xml
new file mode 100644
index 00000000..1f75a499
--- /dev/null
+++ b/tst/worksheets/paired-examples.expected/Paired_Examples_Test.xml
@@ -0,0 +1,15 @@
+
+
+
+
+]
+>
+
+<#Include SYSTEM "title.xml">
+
+
+<#Include SYSTEM "_AutoDocMainFile.xml">
+
+
diff --git a/tst/worksheets/paired-examples.expected/_AutoDocMainFile.xml b/tst/worksheets/paired-examples.expected/_AutoDocMainFile.xml
new file mode 100644
index 00000000..9de68e07
--- /dev/null
+++ b/tst/worksheets/paired-examples.expected/_AutoDocMainFile.xml
@@ -0,0 +1,4 @@
+
+
+
+<#Include SYSTEM "_Chapter_Examples_Chapter.xml">
diff --git a/tst/worksheets/paired-examples.expected/_Chapter_Examples_Chapter.xml b/tst/worksheets/paired-examples.expected/_Chapter_Examples_Chapter.xml
new file mode 100644
index 00000000..de76f895
--- /dev/null
+++ b/tst/worksheets/paired-examples.expected/_Chapter_Examples_Chapter.xml
@@ -0,0 +1,75 @@
+
+
+
+
+Examples Chapter
+
+
+Examples Section
+
+ This worksheet exercises example and log commands in comment mode.
+
+Tested examples
+
+ comment_example_value := 2 + 3;
+5
+]]>
+
+
+ comment_alias_example := 3 + 4;
+7
+]]>
+
+
+ 10 - 3;
+7
+]]>
+
+
+ 6 * 7;
+42
+]]>
+
+
+
+
+
+
+Untested logs
+
+ comment_log_value := 9;
+9
+]]>
+
+
+ comment_alias_log := 11;
+11
+]]>
+
+
+ "comment log session";
+"comment log session"
+]]>
+
+
+ "comment alias log session";
+"comment alias log session"
+]]>
+
+
+
+
+
+
+
+
+
+
diff --git a/tst/worksheets/paired-examples.expected/_Chunks.xml b/tst/worksheets/paired-examples.expected/_Chunks.xml
new file mode 100644
index 00000000..e69de29b
diff --git a/tst/worksheets/paired-examples.expected/_entities.xml b/tst/worksheets/paired-examples.expected/_entities.xml
new file mode 100644
index 00000000..55e0e3b1
--- /dev/null
+++ b/tst/worksheets/paired-examples.expected/_entities.xml
@@ -0,0 +1 @@
+Paired_Examples_Test'>
diff --git a/tst/worksheets/paired-examples.expected/title.xml b/tst/worksheets/paired-examples.expected/title.xml
new file mode 100644
index 00000000..6fa5fd9d
--- /dev/null
+++ b/tst/worksheets/paired-examples.expected/title.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+ Paired Examples Test
+
+
+ 7 March 2026
+
+
\ No newline at end of file
diff --git a/tst/worksheets/paired-examples.expected/tst/paired_examples_test01.tst b/tst/worksheets/paired-examples.expected/tst/paired_examples_test01.tst
new file mode 100644
index 00000000..01dc9038
--- /dev/null
+++ b/tst/worksheets/paired-examples.expected/tst/paired_examples_test01.tst
@@ -0,0 +1,30 @@
+# Paired Examples Test, chapter 1
+#
+# DO NOT EDIT THIS FILE - EDIT EXAMPLES IN THE SOURCE INSTEAD!
+#
+# This file has been generated by AutoDoc. It contains examples extracted from
+# the package documentation. Each example is preceded by a comment which gives
+# the name of a GAPDoc XML file and a line range from which the example were
+# taken. Note that the XML file in turn may have been generated by AutoDoc
+# from some other input.
+#
+gap> START_TEST("paired_examples_test01.tst");
+
+# _Chapter_Examples_Chapter.xml:14-17
+gap> comment_example_value := 2 + 3;
+5
+
+# _Chapter_Examples_Chapter.xml:20-23
+gap> comment_alias_example := 3 + 4;
+7
+
+# _Chapter_Examples_Chapter.xml:26-29
+gap> 10 - 3;
+7
+
+# _Chapter_Examples_Chapter.xml:32-35
+gap> 6 * 7;
+42
+
+#
+gap> STOP_TEST("paired_examples_test01.tst", 1);
diff --git a/tst/worksheets/paired-examples.sheet/worksheet.g b/tst/worksheets/paired-examples.sheet/worksheet.g
new file mode 100644
index 00000000..f9487677
--- /dev/null
+++ b/tst/worksheets/paired-examples.sheet/worksheet.g
@@ -0,0 +1,47 @@
+#! @Title Paired Examples Test
+#! @Date 2026-03-07
+#! @Chapter Examples Chapter
+#! @Section Examples Section
+#! This worksheet exercises example and log commands in comment mode.
+
+#! @Subsection Tested examples
+#! @BeginExample
+comment_example_value := 2 + 3;
+#! 5
+#! @EndExample
+
+#! @Example
+comment_alias_example := 3 + 4;
+#! 7
+#! @EndExample
+
+#! @BeginExampleSession
+#! gap> 10 - 3;
+#! 7
+#! @EndExampleSession
+
+#! @ExampleSession
+#! gap> 6 * 7;
+#! 42
+#! @EndExampleSession
+
+#! @Subsection Untested logs
+#! @BeginLog
+comment_log_value := 9;
+#! 9
+#! @EndLog
+
+#! @Log
+comment_alias_log := 11;
+#! 11
+#! @EndLog
+
+#! @BeginLogSession
+#! gap> "comment log session";
+#! "comment log session"
+#! @EndLogSession
+
+#! @LogSession
+#! gap> "comment alias log session";
+#! "comment alias log session"
+#! @EndLogSession
diff --git a/tst/worksheets/paired-structure-autoplain.expected/Paired_Structure_Test.xml b/tst/worksheets/paired-structure-autoplain.expected/Paired_Structure_Test.xml
new file mode 100644
index 00000000..97298951
--- /dev/null
+++ b/tst/worksheets/paired-structure-autoplain.expected/Paired_Structure_Test.xml
@@ -0,0 +1,15 @@
+
+
+
+
+]
+>
+
+<#Include SYSTEM "title.xml">
+
+
+<#Include SYSTEM "_AutoDocMainFile.xml">
+
+
diff --git a/tst/worksheets/paired-structure-autoplain.expected/_AutoDocMainFile.xml b/tst/worksheets/paired-structure-autoplain.expected/_AutoDocMainFile.xml
new file mode 100644
index 00000000..ba6dd1c9
--- /dev/null
+++ b/tst/worksheets/paired-structure-autoplain.expected/_AutoDocMainFile.xml
@@ -0,0 +1,4 @@
+
+
+
+<#Include SYSTEM "_Chapter_structure-chapter.xml">
diff --git a/tst/worksheets/paired-structure-autoplain.expected/_Chapter_structure-chapter.xml b/tst/worksheets/paired-structure-autoplain.expected/_Chapter_structure-chapter.xml
new file mode 100644
index 00000000..44736fba
--- /dev/null
+++ b/tst/worksheets/paired-structure-autoplain.expected/_Chapter_structure-chapter.xml
@@ -0,0 +1,26 @@
+
+
+
+
+Structure Chapter Title
+
+This chapter text uses bold, emphasis, and inline code.
+Chapter index entry with true
+
+
+Structure Section Title
+
+Section text mentions * plain prose and keywords.
+
+
+Structure Subsection Title
+
+Subsection text keeps the paired worksheet content aligned.
+
+
+
+
+
+
+
+
diff --git a/tst/worksheets/paired-structure-autoplain.expected/_Chunks.xml b/tst/worksheets/paired-structure-autoplain.expected/_Chunks.xml
new file mode 100644
index 00000000..e69de29b
diff --git a/tst/worksheets/paired-structure-autoplain.expected/_entities.xml b/tst/worksheets/paired-structure-autoplain.expected/_entities.xml
new file mode 100644
index 00000000..63753223
--- /dev/null
+++ b/tst/worksheets/paired-structure-autoplain.expected/_entities.xml
@@ -0,0 +1 @@
+Paired_Structure_Test'>
diff --git a/tst/worksheets/paired-structure-autoplain.expected/title.xml b/tst/worksheets/paired-structure-autoplain.expected/title.xml
new file mode 100644
index 00000000..bf806f35
--- /dev/null
+++ b/tst/worksheets/paired-structure-autoplain.expected/title.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+ Paired Structure Test
+
+
+ Comment mode structure coverage
+
+
+ 1.2
+
+
+ 7 March 2026
+
+
\ No newline at end of file
diff --git a/tst/worksheets/paired-structure-autoplain.sheet/plain.autodoc b/tst/worksheets/paired-structure-autoplain.sheet/plain.autodoc
new file mode 100644
index 00000000..d8a89487
--- /dev/null
+++ b/tst/worksheets/paired-structure-autoplain.sheet/plain.autodoc
@@ -0,0 +1,20 @@
+@Title Paired Structure Test
+@Subtitle Comment mode structure coverage
+@Version 1.2
+@Date 2026-03-07
+
+@Chapter Structure Chapter
+@ChapterLabel structure-chapter
+@ChapterTitle Structure Chapter Title
+This chapter text uses **bold**, __emphasis__, and `inline code`.
+@Index "Paired structure chapter" Chapter index entry with `true`
+
+@Section Structure Section
+@SectionLabel structure-section
+@SectionTitle Structure Section Title
+Section text mentions * plain prose and `keywords`.
+
+@Subsection Structure Subsection
+@SubsectionLabel structure-subsection
+@SubsectionTitle Structure Subsection Title
+Subsection text keeps the paired worksheet content aligned.
diff --git a/tst/worksheets/paired-structure.expected/Paired_Structure_Test.xml b/tst/worksheets/paired-structure.expected/Paired_Structure_Test.xml
new file mode 100644
index 00000000..97298951
--- /dev/null
+++ b/tst/worksheets/paired-structure.expected/Paired_Structure_Test.xml
@@ -0,0 +1,15 @@
+
+
+
+
+]
+>
+
+<#Include SYSTEM "title.xml">
+
+
+<#Include SYSTEM "_AutoDocMainFile.xml">
+
+
diff --git a/tst/worksheets/paired-structure.expected/_AutoDocMainFile.xml b/tst/worksheets/paired-structure.expected/_AutoDocMainFile.xml
new file mode 100644
index 00000000..ba6dd1c9
--- /dev/null
+++ b/tst/worksheets/paired-structure.expected/_AutoDocMainFile.xml
@@ -0,0 +1,4 @@
+
+
+
+<#Include SYSTEM "_Chapter_structure-chapter.xml">
diff --git a/tst/worksheets/paired-structure.expected/_Chapter_structure-chapter.xml b/tst/worksheets/paired-structure.expected/_Chapter_structure-chapter.xml
new file mode 100644
index 00000000..bec0599f
--- /dev/null
+++ b/tst/worksheets/paired-structure.expected/_Chapter_structure-chapter.xml
@@ -0,0 +1,24 @@
+
+
+
+
+Structure Chapter Title
+
+ This chapter text uses bold, emphasis, and inline code.
+Chapter index entry with true
+
+Structure Section Title
+
+ Section text mentions * plain prose and keywords.
+
+Structure Subsection Title
+
+ Subsection text keeps the paired worksheet content aligned.
+
+
+
+
+
+
+
+
diff --git a/tst/worksheets/paired-structure.expected/_Chunks.xml b/tst/worksheets/paired-structure.expected/_Chunks.xml
new file mode 100644
index 00000000..e69de29b
diff --git a/tst/worksheets/paired-structure.expected/_entities.xml b/tst/worksheets/paired-structure.expected/_entities.xml
new file mode 100644
index 00000000..63753223
--- /dev/null
+++ b/tst/worksheets/paired-structure.expected/_entities.xml
@@ -0,0 +1 @@
+Paired_Structure_Test'>
diff --git a/tst/worksheets/paired-structure.expected/title.xml b/tst/worksheets/paired-structure.expected/title.xml
new file mode 100644
index 00000000..bf806f35
--- /dev/null
+++ b/tst/worksheets/paired-structure.expected/title.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+ Paired Structure Test
+
+
+ Comment mode structure coverage
+
+
+ 1.2
+
+
+ 7 March 2026
+
+
\ No newline at end of file
diff --git a/tst/worksheets/paired-structure.sheet/worksheet.g b/tst/worksheets/paired-structure.sheet/worksheet.g
new file mode 100644
index 00000000..86ea806a
--- /dev/null
+++ b/tst/worksheets/paired-structure.sheet/worksheet.g
@@ -0,0 +1,20 @@
+#! @Title Paired Structure Test
+#! @Subtitle Comment mode structure coverage
+#! @Version 1.2
+#! @Date 2026-03-07
+
+#! @Chapter Structure Chapter
+#! @ChapterLabel structure-chapter
+#! @ChapterTitle Structure Chapter Title
+#! This chapter text uses **bold**, __emphasis__, and `inline code`.
+#! @Index "Paired structure chapter" Chapter index entry with `true`
+
+#! @Section Structure Section
+#! @SectionLabel structure-section
+#! @SectionTitle Structure Section Title
+#! Section text mentions * plain prose and `keywords`.
+
+#! @Subsection Structure Subsection
+#! @SubsectionLabel structure-subsection
+#! @SubsectionTitle Structure Subsection Title
+#! Subsection text keeps the paired worksheet content aligned.
diff --git a/tst/worksheets/paired-titlepage-autoplain.expected/Paired_Titlepage_Test.xml b/tst/worksheets/paired-titlepage-autoplain.expected/Paired_Titlepage_Test.xml
new file mode 100644
index 00000000..6ade3c8f
--- /dev/null
+++ b/tst/worksheets/paired-titlepage-autoplain.expected/Paired_Titlepage_Test.xml
@@ -0,0 +1,15 @@
+
+
+
+
+]
+>
+
+<#Include SYSTEM "title.xml">
+
+
+<#Include SYSTEM "_AutoDocMainFile.xml">
+
+
diff --git a/tst/worksheets/paired-titlepage-autoplain.expected/_AutoDocMainFile.xml b/tst/worksheets/paired-titlepage-autoplain.expected/_AutoDocMainFile.xml
new file mode 100644
index 00000000..93e559f6
--- /dev/null
+++ b/tst/worksheets/paired-titlepage-autoplain.expected/_AutoDocMainFile.xml
@@ -0,0 +1,4 @@
+
+
+
+<#Include SYSTEM "_Chapter_Titlepage_Chapter.xml">
diff --git a/tst/worksheets/paired-titlepage-autoplain.expected/_Chapter_Titlepage_Chapter.xml b/tst/worksheets/paired-titlepage-autoplain.expected/_Chapter_Titlepage_Chapter.xml
new file mode 100644
index 00000000..5682f74a
--- /dev/null
+++ b/tst/worksheets/paired-titlepage-autoplain.expected/_Chapter_Titlepage_Chapter.xml
@@ -0,0 +1,15 @@
+
+
+
+
+Titlepage Chapter
+
+
+Titlepage Section
+
+This worksheet keeps title-page commands visible in a real worksheet.
+
+
+
+
+
diff --git a/tst/worksheets/paired-titlepage-autoplain.expected/_Chunks.xml b/tst/worksheets/paired-titlepage-autoplain.expected/_Chunks.xml
new file mode 100644
index 00000000..e69de29b
diff --git a/tst/worksheets/paired-titlepage-autoplain.expected/_entities.xml b/tst/worksheets/paired-titlepage-autoplain.expected/_entities.xml
new file mode 100644
index 00000000..b11fae31
--- /dev/null
+++ b/tst/worksheets/paired-titlepage-autoplain.expected/_entities.xml
@@ -0,0 +1 @@
+Paired_Titlepage_Test'>
diff --git a/tst/worksheets/paired-titlepage-autoplain.expected/title.xml b/tst/worksheets/paired-titlepage-autoplain.expected/title.xml
new file mode 100644
index 00000000..5e850c3c
--- /dev/null
+++ b/tst/worksheets/paired-titlepage-autoplain.expected/title.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+ Paired Titlepage Test
+
+
+ Comment mode title coverage
+
+
+ 2.0
+
+
+ Internal worksheet fixture
+
+
+ Ada Example
+
+
+ 7 March 2026
+
+
+ Example Street 7
+
+
+ This worksheet exercises title-page commands in plain-text mode.
+
+
+ 2026 Example Authors
+
+
+ Thanks to the worksheet harness.
+
+
+ Generated for AutoDoc regression coverage.
+
+
\ No newline at end of file
diff --git a/tst/worksheets/paired-titlepage-autoplain.sheet/plain.autodoc b/tst/worksheets/paired-titlepage-autoplain.sheet/plain.autodoc
new file mode 100644
index 00000000..50c1b7f7
--- /dev/null
+++ b/tst/worksheets/paired-titlepage-autoplain.sheet/plain.autodoc
@@ -0,0 +1,14 @@
+@Title Paired Titlepage Test
+@Subtitle Comment mode title coverage
+@Version 2.0
+@TitleComment Internal worksheet fixture
+@Author Ada Example
+@Date 2026-03-07
+@Address Example Street 7
+@Abstract This worksheet exercises title-page commands in plain-text mode.
+@Copyright 2026 Example Authors
+@Acknowledgements Thanks to the worksheet harness.
+@Colophon Generated for AutoDoc regression coverage.
+@Chapter Titlepage Chapter
+@Section Titlepage Section
+This worksheet keeps title-page commands visible in a real worksheet.
diff --git a/tst/worksheets/paired-titlepage.expected/Paired_Titlepage_Test.xml b/tst/worksheets/paired-titlepage.expected/Paired_Titlepage_Test.xml
new file mode 100644
index 00000000..6ade3c8f
--- /dev/null
+++ b/tst/worksheets/paired-titlepage.expected/Paired_Titlepage_Test.xml
@@ -0,0 +1,15 @@
+
+
+
+
+]
+>
+
+<#Include SYSTEM "title.xml">
+
+
+<#Include SYSTEM "_AutoDocMainFile.xml">
+
+
diff --git a/tst/worksheets/paired-titlepage.expected/_AutoDocMainFile.xml b/tst/worksheets/paired-titlepage.expected/_AutoDocMainFile.xml
new file mode 100644
index 00000000..93e559f6
--- /dev/null
+++ b/tst/worksheets/paired-titlepage.expected/_AutoDocMainFile.xml
@@ -0,0 +1,4 @@
+
+
+
+<#Include SYSTEM "_Chapter_Titlepage_Chapter.xml">
diff --git a/tst/worksheets/paired-titlepage.expected/_Chapter_Titlepage_Chapter.xml b/tst/worksheets/paired-titlepage.expected/_Chapter_Titlepage_Chapter.xml
new file mode 100644
index 00000000..2d622c3a
--- /dev/null
+++ b/tst/worksheets/paired-titlepage.expected/_Chapter_Titlepage_Chapter.xml
@@ -0,0 +1,15 @@
+
+
+
+
+Titlepage Chapter
+
+
+Titlepage Section
+
+ This worksheet keeps title-page commands visible in a real worksheet.
+
+
+
+
+
diff --git a/tst/worksheets/paired-titlepage.expected/_Chunks.xml b/tst/worksheets/paired-titlepage.expected/_Chunks.xml
new file mode 100644
index 00000000..e69de29b
diff --git a/tst/worksheets/paired-titlepage.expected/_entities.xml b/tst/worksheets/paired-titlepage.expected/_entities.xml
new file mode 100644
index 00000000..b11fae31
--- /dev/null
+++ b/tst/worksheets/paired-titlepage.expected/_entities.xml
@@ -0,0 +1 @@
+Paired_Titlepage_Test'>
diff --git a/tst/worksheets/paired-titlepage.expected/title.xml b/tst/worksheets/paired-titlepage.expected/title.xml
new file mode 100644
index 00000000..9616664b
--- /dev/null
+++ b/tst/worksheets/paired-titlepage.expected/title.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+ Paired Titlepage Test
+
+
+ Comment mode title coverage
+
+
+ 2.0
+
+
+ Internal worksheet fixture
+
+
+ Ada Example
+
+
+ 7 March 2026
+
+
+ Example Street 7
+
+
+ This worksheet exercises title-page commands in comment mode.
+
+
+ 2026 Example Authors
+
+
+ Thanks to the worksheet harness.
+
+
+ Generated for AutoDoc regression coverage.
+
+
\ No newline at end of file
diff --git a/tst/worksheets/paired-titlepage.sheet/worksheet.g b/tst/worksheets/paired-titlepage.sheet/worksheet.g
new file mode 100644
index 00000000..2875204f
--- /dev/null
+++ b/tst/worksheets/paired-titlepage.sheet/worksheet.g
@@ -0,0 +1,14 @@
+#! @Title Paired Titlepage Test
+#! @Subtitle Comment mode title coverage
+#! @Version 2.0
+#! @TitleComment Internal worksheet fixture
+#! @Author Ada Example
+#! @Date 2026-03-07
+#! @Address Example Street 7
+#! @Abstract This worksheet exercises title-page commands in comment mode.
+#! @Copyright 2026 Example Authors
+#! @Acknowledgements Thanks to the worksheet harness.
+#! @Colophon Generated for AutoDoc regression coverage.
+#! @Chapter Titlepage Chapter
+#! @Section Titlepage Section
+#! This worksheet keeps title-page commands visible in a real worksheet.