diff options
-rw-r--r-- | ekdosis.dtx | 59 |
1 files changed, 46 insertions, 13 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx index c81489d..aa47a63 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -482,10 +482,10 @@ idno={}, msName={}, origDate={}][3]{% | |||
482 | \if@parnotesroman% | 482 | \if@parnotesroman% |
483 | \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi% | 483 | \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi% |
484 | \parnoteclear\else\fi% | 484 | \parnoteclear\else\fi% |
485 | \footnotesize\apparatus\ekd@end@apparatus% | 485 | \footnotesize\apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi% |
486 | \if@pkg@parnotes\parnotes\parnotereset\else\fi% | 486 | \if@pkg@parnotes\parnotes\parnotereset\else\fi% |
487 | }% | 487 | }% |
488 | % \unconditional@appin{\rule{5cm}{0.5pt}\newline} | 488 | \unless\ifekd@mapps\unconditional@appin{\rule{5cm}{0.5pt}\newline}\fi |
489 | } | 489 | } |
490 | \def\add@apparatus{% | 490 | \def\add@apparatus{% |
491 | \test@apparatus% | 491 | \test@apparatus% |
@@ -564,6 +564,14 @@ idno={}, msName={}, origDate={}][3]{% | |||
564 | \luadirect{ekdosis.dolnlab(\luastringN{#2})}% | 564 | \luadirect{ekdosis.dolnlab(\luastringN{#2})}% |
565 | \bgroup% | 565 | \bgroup% |
566 | \setkeys[ekd]{lemrdg,lem}{#1}% | 566 | \setkeys[ekd]{lemrdg,lem}{#1}% |
567 | \ifekd@mapps% | ||
568 | \ifnum% | ||
569 | \luadirect{tex.sprint(ekdosis.get_bagunits(\luastringO{\ekdan@type}))} | ||
570 | = 1 | ||
571 | \subsq@unitfalse% | ||
572 | \fi% | ||
573 | \luadirect{ekdosis.increment_bagunits(\luastringO{\ekdan@type})}% | ||
574 | \fi% | ||
567 | \ifekdl@nolem\edef\lem@app{% | 575 | \ifekdl@nolem\edef\lem@app{% |
568 | \hskip .75em\ifsubsq@unit% | 576 | \hskip .75em\ifsubsq@unit% |
569 | \unexpanded\expandafter{\ekd@unit@delim}\else\fi% | 577 | \unexpanded\expandafter{\ekd@unit@delim}\else\fi% |
@@ -628,7 +636,7 @@ idno={}, msName={}, origDate={}][3]{% | |||
628 | }% | 636 | }% |
629 | \fi% | 637 | \fi% |
630 | \ifekd@mapps% | 638 | \ifekd@mapps% |
631 | \append@ln@app[\ekdan@type]{\lem@app}% | 639 | \append@ln@app[\ekdan@type]{\lem@app}% |
632 | \else% | 640 | \else% |
633 | \append@ln@app{\lem@app}% | 641 | \append@ln@app{\lem@app}% |
634 | \fi% | 642 | \fi% |
@@ -1434,7 +1442,8 @@ end | |||
1434 | -- handle multiple layers in apparatuses | 1442 | -- handle multiple layers in apparatuses |
1435 | -- | 1443 | -- |
1436 | local apparatuses = {} | 1444 | local apparatuses = {} |
1437 | local bagtype = {} | 1445 | local bagunits = {} |
1446 | |||
1438 | function ekdosis.newapparatus(teitype) | 1447 | function ekdosis.newapparatus(teitype) |
1439 | if isintable(apparatuses, teitype) | 1448 | if isintable(apparatuses, teitype) |
1440 | then | 1449 | then |
@@ -1444,10 +1453,25 @@ function ekdosis.newapparatus(teitype) | |||
1444 | else | 1453 | else |
1445 | table.insert(apparatuses, { a = teitype }) | 1454 | table.insert(apparatuses, { a = teitype }) |
1446 | end | 1455 | end |
1447 | bagtype[type] = 1 | 1456 | bagunits[teitype] = 1 |
1448 | return true | 1457 | return true |
1449 | end | 1458 | end |
1450 | 1459 | ||
1460 | function ekdosis.get_bagunits(teitype) | ||
1461 | return bagunits[teitype] | ||
1462 | end | ||
1463 | |||
1464 | function ekdosis.increment_bagunits(teitype) | ||
1465 | bagunits[teitype] = (bagunits[teitype] or 0) + 1 | ||
1466 | end | ||
1467 | |||
1468 | local function reset_bagunits() | ||
1469 | for i = 1,#apparatuses | ||
1470 | do | ||
1471 | bagunits[apparatuses[i].a] = 1 | ||
1472 | end | ||
1473 | end | ||
1474 | |||
1451 | function ekdosis.appin(str, teitype) | 1475 | function ekdosis.appin(str, teitype) |
1452 | local f = io.open(tex.jobname.."_tmp.ekd", "a+") | 1476 | local f = io.open(tex.jobname.."_tmp.ekd", "a+") |
1453 | if next(apparatuses) == nil | 1477 | if next(apparatuses) == nil |
@@ -1475,7 +1499,6 @@ function ekdosis.appout() | |||
1475 | local output = {} | 1499 | local output = {} |
1476 | if next(apparatuses) == nil then | 1500 | if next(apparatuses) == nil then |
1477 | -- table.insert(output, "BEGIN") | 1501 | -- table.insert(output, "BEGIN") |
1478 | table.insert(output, "\\par") | ||
1479 | for i in string.gmatch(t, | 1502 | for i in string.gmatch(t, |
1480 | "<"..cur_abs_pg.."%-0>.-</"..cur_abs_pg.."%-0>") | 1503 | "<"..cur_abs_pg.."%-0>.-</"..cur_abs_pg.."%-0>") |
1481 | do | 1504 | do |
@@ -1486,14 +1509,18 @@ function ekdosis.appout() | |||
1486 | local n = 1 | 1509 | local n = 1 |
1487 | while apparatuses[n] | 1510 | while apparatuses[n] |
1488 | do | 1511 | do |
1489 | -- table.insert(output, "BEGIN") | 1512 | if string.match(t, "<"..cur_abs_pg.."%-"..n..">.-</"..cur_abs_pg.."%-"..n..">") |
1490 | table.insert(output, "\\par") | 1513 | then |
1491 | for i in string.gmatch(t, | 1514 | -- table.insert(output, "BEGIN") |
1492 | "<"..cur_abs_pg.."%-"..n..">.-</"..cur_abs_pg.."%-"..n..">") | 1515 | table.insert(output, "\\par\\rule{5cm}{0.5pt}\\newline") |
1493 | do | 1516 | for i in string.gmatch(t, |
1494 | table.insert(output, i) | 1517 | "<"..cur_abs_pg.."%-"..n..">.-</"..cur_abs_pg.."%-"..n..">") |
1518 | do | ||
1519 | table.insert(output, i) | ||
1520 | end | ||
1521 | table.insert(output, "\\csname ekd@end@apparatus\\endcsname") | ||
1522 | -- table.insert(output, "END") | ||
1495 | end | 1523 | end |
1496 | -- table.insert(output, "END") | ||
1497 | n = n + 1 | 1524 | n = n + 1 |
1498 | end | 1525 | end |
1499 | end | 1526 | end |
@@ -1520,11 +1547,17 @@ function ekdosis.testapparatus() | |||
1520 | if tonumber(pg_ii) < tonumber(pg_i) | 1547 | if tonumber(pg_ii) < tonumber(pg_i) |
1521 | or tonumber(pg_ii) < tonumber(cur_abs_pg) then | 1548 | or tonumber(pg_ii) < tonumber(cur_abs_pg) then |
1522 | pg_i = cur_abs_pg | 1549 | pg_i = cur_abs_pg |
1550 | if next(apparatuses) ~= nil then | ||
1551 | reset_bagunits() | ||
1552 | end | ||
1523 | return "\\booltrue{do@app}" | 1553 | return "\\booltrue{do@app}" |
1524 | elseif tonumber(pg_ii) == tonumber(pg_i) then | 1554 | elseif tonumber(pg_ii) == tonumber(pg_i) then |
1525 | return "\\boolfalse{do@app}" | 1555 | return "\\boolfalse{do@app}" |
1526 | elseif tonumber(pg_ii) > tonumber(pg_i) then | 1556 | elseif tonumber(pg_ii) > tonumber(pg_i) then |
1527 | pg_i = cur_abs_pg | 1557 | pg_i = cur_abs_pg |
1558 | if next(apparatuses) ~= nil then | ||
1559 | reset_bagunits() | ||
1560 | end | ||
1528 | return "\\booltrue{do@app}" | 1561 | return "\\booltrue{do@app}" |
1529 | end | 1562 | end |
1530 | end | 1563 | end |