@@ -322,9 +322,8 @@ function createPdfFormat(
322322 format . render ?. [ kPdfStandard ] ?? format . metadata ?. [ kPdfStandard ] ,
323323 ) ;
324324 if ( pdfStandard . length > 0 ) {
325- const { version, standards } = normalizePdfStandardForLatex (
326- pdfStandard ,
327- ) ;
325+ const { version, standards, needsTagging } =
326+ normalizePdfStandardForLatex ( pdfStandard ) ;
328327 extras . pandoc . variables = extras . pandoc . variables || { } ;
329328 extras . pandoc . variables [ "pdf-standard" ] = true ; // Enable the partial
330329 if ( version ) {
@@ -334,8 +333,10 @@ function createPdfFormat(
334333 // Pass as array - Pandoc template will iterate with $for()$
335334 extras . pandoc . variables [ "pdf-standards" ] = standards ;
336335 }
337- // Always enable tagging for pdf-standard (stable in LaTeX 2025+)
338- extras . pandoc . variables [ "pdf-tagging" ] = true ;
336+ // Enable tagging only for standards that require it (ua-*, a-*a)
337+ if ( needsTagging ) {
338+ extras . pandoc . variables [ "pdf-tagging" ] = true ;
339+ }
339340 }
340341
341342 return extras ;
@@ -1262,8 +1263,10 @@ const kbeginLongTablesideCap = `{
12621263
12631264const kEndLongTableSideCap = "}" ;
12641265
1265- // LaTeX-supported PDF standards
1266+ // LaTeX-supported PDF standards (from latex3/latex2e DocumentMetadata)
1267+ // See: https://github.com/latex3/latex2e - documentmetadata-support.dtx
12661268const kLatexSupportedStandards = new Set ( [
1269+ // PDF/A standards (note: a-1a is NOT supported, only a-1b)
12671270 "a-1b" ,
12681271 "a-2a" ,
12691272 "a-2b" ,
@@ -1272,7 +1275,9 @@ const kLatexSupportedStandards = new Set([
12721275 "a-3b" ,
12731276 "a-3u" ,
12741277 "a-4" ,
1278+ "a-4e" ,
12751279 "a-4f" ,
1280+ // PDF/X standards
12761281 "x-4" ,
12771282 "x-4p" ,
12781283 "x-5g" ,
@@ -1281,6 +1286,18 @@ const kLatexSupportedStandards = new Set([
12811286 "x-6" ,
12821287 "x-6n" ,
12831288 "x-6p" ,
1289+ // PDF/UA standards
1290+ "ua-1" ,
1291+ "ua-2" ,
1292+ ] ) ;
1293+
1294+ // Standards that require PDF tagging (document structure)
1295+ // - PDF/A level "a" variants require tagged structure per PDF/A spec
1296+ // - PDF/UA standards require tagging for universal accessibility
1297+ // (LaTeX does NOT automatically enable tagging for UA standards)
1298+ const kTaggingRequiredStandards = new Set ( [
1299+ "a-2a" ,
1300+ "a-3a" ,
12841301 "ua-1" ,
12851302 "ua-2" ,
12861303] ) ;
@@ -1289,9 +1306,10 @@ const kVersionPattern = /^(1\.[4-7]|2\.0)$/;
12891306
12901307function normalizePdfStandardForLatex (
12911308 standards : unknown [ ] ,
1292- ) : { version ?: string ; standards : string [ ] } {
1309+ ) : { version ?: string ; standards : string [ ] ; needsTagging : boolean } {
12931310 let version : string | undefined ;
12941311 const result : string [ ] = [ ] ;
1312+ let needsTagging = false ;
12951313
12961314 for ( const s of standards ) {
12971315 if ( typeof s !== "string" ) continue ;
@@ -1303,12 +1321,16 @@ function normalizePdfStandardForLatex(
13031321 } else if ( kLatexSupportedStandards . has ( normalized ) ) {
13041322 // LaTeX is case-insensitive, pass through lowercase
13051323 result . push ( normalized ) ;
1324+ // Check if this standard requires tagging
1325+ if ( kTaggingRequiredStandards . has ( normalized ) ) {
1326+ needsTagging = true ;
1327+ }
13061328 } else {
13071329 warning (
13081330 `PDF standard '${ s } ' is not supported by LaTeX and will be ignored` ,
13091331 ) ;
13101332 }
13111333 }
13121334
1313- return { version, standards : result } ;
1335+ return { version, standards : result , needsTagging } ;
13141336}
0 commit comments