-
Notifications
You must be signed in to change notification settings - Fork 1
/
statement.lua
5843 lines (5204 loc) · 172 KB
/
statement.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--[[-- # Statement - a Lua filter for statements in Pandoc's markdown
This Lua filter provides support for statements (principles,
arguments, vignettes, theorems, exercises etc.) in Pandoc's markdown.
@author Julien Dutant <[email protected]>
@author Thomas Hodgson <[email protected]>
@copyright 2021-2022 Julien Dutant, Thomas Hodgson
@license MIT - see LICENSE file for details.
@release 0.5.1
]]
-- # Global helper functions
---Helpers class: helper functions
--This class collects helper functions that do not depend
--on the filter's data structure.
Helpers = {}
-- # Global functions
stringify = pandoc.utils.stringify
--- type: pandoc-friendly type function
-- pandoc.utils.type is only defined in Pandoc >= 2.17
-- if it isn't, we extend Lua's type function to give the same values
-- as pandoc.utils.type on Meta objects: Inlines, Inline, Blocks, Block,
-- string and boolean
-- Caution: not to be used on non-Meta Pandoc elements, the
-- results will differ (only 'Block', 'Blocks', 'Inline', 'Inlines' in
-- >=2.17, the .t string in <2.17).
Helpers.type = pandoc.utils.type or function (obj)
local tag = type(obj) == 'table' and obj.t and obj.t:gsub('^Meta', '')
-- convert to Block, Blocks, Inline, Inlines
return tag and tag ~= 'Map' and tag or type(obj)
end
type = Helpers.type
--- ensure_list: turns an element into a list if needed
-- If elem is nil returns an empty list
-- @param elem a Pandoc element
-- @return a Pandoc List
ensure_list = function (elem)
return type(elem) == 'List' and elem or pandoc.List:new({elem})
end
---message: send message to std_error
-- @param type string INFO, WARNING, ERROR
-- @param text string message text
message = function (type, text)
local level = {INFO = 0, WARNING = 1, ERROR = 2}
if level[type] == nil then type = 'ERROR' end
if level[PANDOC_STATE.verbosity] <= level[type] then
io.stderr:write('[' .. type .. '] Collection lua filter: '
.. text .. '\n')
end
end
-- ## Functions stored in Helpers fields
--- Helpers.font_format: parse font features into the desired format
-- @param len Inlines or string to be interpreted
-- @param format (optional) desired format if other than FORMAT
-- @return string, font commands in the desired format or ''
Helpers.font_format = function (str, format)
local format = format or FORMAT
-- FEATURES and their conversion
local FEATURES = {
upright = {
latex = '\\upshape',
css = 'font-style: normal;',
},
italics = {
latex = '\\itshape',
css = 'font-style: italic;',
},
smallcaps = {
latex = '\\scshape',
css = 'font-variant: small-caps;',
},
bold = {
latex = '\\bfseries',
css = 'font-weight: bold;',
},
normal = {
latex = '\\normalfont',
css = 'font-style: normal; font-weight: normal; font-variant:normal;'
}
}
-- provide some aliases
local ALIASES = {
italics = {'italic'},
normal = {'normalfont'},
smallcaps = {'small%-caps'}, -- used as a pattern, so `-` must be escaped
}
-- within this function, format is 'css' when css features are needed
if format:match('html') then
format = 'css'
end
-- ensure str is defined and a string
str = type(str) == 'string' and str ~= '' and str
or type(str) == 'Inlines' and #str > 0 and stringify(str)
or nil
if str then
local result = ''
for feature,definition in pairs(FEATURES) do
if str:match(feature) and definition[format] then
result = result..definition[format]
-- avoid multiple copies by only looking for aliases
-- if main feature key not found and breaking if we find any alias
elseif ALIASES[feature] then
for _,alias in ipairs(ALIASES[feature]) do
if str:match(alias) and definition[format] then
result = result..definition[format]
break -- ensures no multiple copies
end
end
end
end
return result
end
return ''
end
--- Helpers.font_format_native: parse font features into
-- native pandoc elements: Emph, Strong, smallcaps Span.
-- Note that the function won't work if you pass it a List
-- that is not of type Blocks or Inlines.
--@TODO requires >=2.17 to recognize Blocks and Inlines types
--@TODO provide Spans with classes for older Pandoc versions?
--@TODO type(elem) in Pandoc <2.17 doesn't return 'Inline' but 'Para' etc.
-- @param len Inlines or string to be interpreted
-- @return function, Inline(s) -> Inline(s) or Block(s) -> Block(s)
Helpers.font_format_native = function (str)
-- FEATURES and their conversion
local FEATURES = {
italics = function(inlines)
return pandoc.Emph(inlines)
end,
smallcaps = function(inlines)
return pandoc.SmallCaps(inlines)
end,
bold = function(inlines)
return pandoc.Strong(inlines)
end,
underline = function(inlines)
return pandoc.Underline(inlines)
end,
strikeout = function(inlines)
return pandoc.Strikeout(inlines)
end,
subscript = function(inlines)
return pandoc.Subscript(inlines)
end,
superscript = function(inlines)
return pandoc.Superscript(inlines)
end,
code = function(inlines)
return pandoc.Code(stringify(inlines))
end,
}
-- provide some aliases
local ALIASES = {
italics = {'italic'},
normal = {'normalfont'},
smallcaps = {'small%-caps'}, -- used as a pattern, so `-` must be escaped
}
-- ensure str is defined and a string
str = type(str) == 'string' and str ~= '' and str
or type(str) == 'Inlines' and #str > 0 and stringify(str)
or nil
if str then
-- build a list of functions to be applied
local formatters = pandoc.List:new()
for feature,definition in pairs(FEATURES) do
if str:match(feature) then
formatters:insert( definition )
-- avoid multiple copies by only looking for aliases
-- if main feature key not found and breaking if we find any alias
elseif ALIASES[feature] then
for _,alias in ipairs(ALIASES[feature]) do
if str:match(alias) then
formatters:insert( definition )
break -- ensures no multiple copies
end
end
end
end
if #formatters > 0 then
-- Common Inlines formatting function
local inlines_format = function(inlines)
for _,formatter in ipairs(formatters) do
inlines = formatter(inlines)
end
return inlines
end
-- return a function that handles all types
-- - Inlines, Inline: wrap with inlines_format
-- - Blocks, Block: wrap the content of leaf blocks (those
-- whose content is inlines only)
return function (obj)
-- determine type
obj_type = (type(obj) == 'Inlines' or type(obj) == 'Inline'
or type(obj) == 'Blocks' or type(obj) == 'Block')
and type(obj)
or nil
if not obj_type and type(obj) == 'List' and obj[1] then
if type(obj[1]) == 'Inline' then
obj = pandoc.Inlines(obj)
obj_type = 'Inlines'
elseif type(obj[1] == 'Block') then
obj = pandoc.Blocks(obj)
obj_type = 'Blocks'
end
end
-- process object according to type and return it
if obj_type == 'Inlines' or obj_type == 'Inline' then
return inlines_format(obj)
elseif obj_type == 'Block' and type(obj.content) == 'Inlines' then
obj.content = inlines_format(obj.content)
return obj
elseif obj_type == 'Blocks' then
return obj:walk( {
Block = function(elem)
if elem.content and type(elem.content) == 'Inlines' then
elem.content = inlines_format(elem.content)
return elem
end
end
})
else
return obj
end
end
end
end
return function(obj) return obj end
end
--- Helpers.length_format: parse a length in the desired format
-- @param len Inlines or string to be interpreted
-- @param format (optional) desired format if other than FORMAT
-- @return string specifying the length in the desired format or nil
Helpers.length_format = function (str, format)
local format = format or FORMAT
-- UNITS and their conversions
local UNITS = {
pc = {}, -- pica, 12pt
pt = {}, -- point, 1/72.27 inch, 28.45 mm
cm = {}, -- cm
mm = {}, -- mm
bp = { -- big point, 1/72 inch, 1.00375 pt
css = {1.00375, 'pt'},
},
dd = { -- dido point, 1.07 pt
css = {1.07, 'pt'},
},
cc = { -- cicero, 12dd, 12.84 pt
css = {12.84, 'pt'},
},
sp = { -- scaled pt, 1/65536 pt
css = {28.45/65536, 'mm'},
},
px = { -- pixel, using default conversion 16px = 12pt
latex = {3/4, 'pt'},
},
em = {}, -- em, width of 'm'
ex = {}, -- ex, height of 'x'
mu = { -- mu, 1/18 of em
css = {1/18, 'em'},
},
ch = { -- width of '0', roughly .5 em
latex = {0.5, 'em'},
},
rem = { -- root element font size
-- proper latex conversion needs doc's fontsize
latex = {1, 'em'},
},
vw = { -- 1% of the viewport's width
latex = {0.01, '\\textwidth'},
},
vh = { -- 1% of the viewport's height
latex = {0.01, '\\textheight'},
},
vmin = { -- 1% of the viewport's minimal dimension
latex = {0.01, '\\textwidth'},
},
vmax = { -- 1% of the viewport's maximal dimension
latex = {0.01, '\\textheight'},
},
}
-- '%' and 'in' keys can't be used in the constructor, add now
UNITS['in'] = {} -- inch, 72.27 pt
UNITS['%'] = { -- %, percentage of the parent element's width
latex = {0.01, '\\linewidth'}
}
-- LATEX_LENGTHS and their conversions
local LATEX_LENGTHS = {
baselineskip = { -- height between lines, roughly 2.7 ex
css = {2.7, 'ex'},
},
linewidth = { -- line width, use length of the parent element
css = {100, '%'},
},
textwidth = { -- width of text, use length of the parent element
css = {100, '%'},
},
paperwidth = { -- paper width, use viewport width
css = {100, 'vw'}
},
paperheight = { -- paper width, use viewport height
css = {100, 'vh'}
},
evensidemargin = { -- even side margin, 40pt or 6.5% paperwidth
css = {6.5, 'vw'},
},
oddsidemargin = { -- odd side margin, 40pt or 6.5% paperwidth
css = {6.5, 'vw'},
},
topmargin = { -- top margin, about half of side margins
css = {3, 'vw'}
},
parindent = { -- parindent; @TODO better read meta.indent
css = {1, 'em'}
},
tabcolsep = { -- separation of table columns, typically .5em
css = {.5, 'em'}
},
columnsep = { -- separation of text columns, roughly 0.8 em
css = {0.8, 'em'},
},
}
-- add `\` to LATEX_LENGTHS keys (can't be done directly)
local new_latex_lengths = {} -- needs to make a copy
for key,value in pairs(LATEX_LENGTHS) do
new_latex_lengths['\\'..key] = value
end
LATEX_LENGTHS = new_latex_lengths
-- HTML_ENTITIES and their translations in 'main plus minus' format
local HTML_ENTITIES = {}
HTML_ENTITIES[' '] = '0.333em plus 0.666em minus 0.111em'
HTML_ENTITIES[' '] = '0.333em plus 0.666em minus 0.111em' -- space
--- parse_length: parse a '<number><unit>' string.
-- checks the unit against UNITS and LATEX_LENGTHS
--@param str string to be parsed or nil
--@return number amount parsed
--@return table with `amount` and `unit` fields or nil
local function parse_length(str)
if not str then
return nil
end
local amount, unit
-- match number and unit, possibly separated by spaces
-- nb, %g for printable characters except spaces
amount, unit = str:match('%s*(%-?%s*%d*%.?%d*)%s*(%g+)%s*')
-- allow amount + unit, or no amount ('') + LaTeX unit
if amount then
-- need to remove spaces before attempting `tonumber`
amount = amount:gsub('%s','')
-- either we have a number + unit:
if tonumber(amount) and (UNITS[unit] or LATEX_LENGTHS[unit]) then
-- ensure amount is a number
amount = tonumber(amount)
-- conversion if available
if UNITS[unit] and UNITS[unit][format] then
amount = amount * UNITS[unit][format][1]
unit = UNITS[unit][format][2]
elseif LATEX_LENGTHS[unit] and LATEX_LENGTHS[unit][format] then
amount = amount * LATEX_LENGTHS[unit][format][1]
unit = LATEX_LENGTHS[unit][format][2]
end -- end of conversions
-- return result as table
return {
amount = amount,
unit = unit,
}
-- or we have a latex length on its own
elseif amount=='' and LATEX_LENGTHS[unit] then
amount = 1
-- convert if possible
if LATEX_LENGTHS[unit] and LATEX_LENGTHS[unit][format] then
amount = LATEX_LENGTHS[unit][format][1]
unit = LATEX_LENGTHS[unit][format][2]
end -- end of conversions
-- return result as table
return {
amount = amount,
unit = unit,
}
end -- no legit amount / unit combination
end -- no string match
end -- end of parse_length
--- parse_plus_minus: parse a '<length>plus<length>minus<length>'
-- string.
--@param str string to be parse
--@return table with `main`, `plus`, `minus` fields, each a
-- table with `amount` and `unit` fields or nil
local function parse_plus_minus(str)
local main, plus, minus
-- special cases: length is just '0' or space or HTML entity
if tonumber(str) and tonumber(str) == 0 then
return {
main = {amount = 0, unit = 'em'}
}
elseif str == ' ' then
main,plus,minus = '0.333em', '0.666em', '0.111em'
elseif HTML_ENTITIES[str] then
str = HTML_ENTITIES[str]
end
-- otherwise try matching plus and minus
if not main then
main,plus,minus = str:match('(.*)plus(.*)minus(.*)')
end
if not main then
-- illegal in LaTeX but we'll allow it
main,minus,plus = str:match('(.*)minus(.*)plus(.*)')
end
if not main then
main,plus = str:match('(.*)plus(.*)')
end
if not main then
main,minus = str:match('(.*)minus(.*)')
end
if not main then
main = str
end
-- parse each into amount and unit (or nil if unintelligible)
return {
main = parse_length(main),
plus = parse_length(plus),
minus = parse_length(minus),
}
end
-- MAIN BODY of the function
-- within this function, format is 'css' when css features are needed
if format:match('html') then
format = 'css'
end
-- ensure str is defined and a string
str = type(str) == 'string' and str ~= '' and str
or type(str) == 'Inlines' and #str > 0 and stringify(str)
if str then
-- parse `str` into a length table
-- length = {
-- main = { amount = number, unit = string} or nil
-- plus = { amount = number, unit = string} or nil
-- minus = { amount = number, unit = string} or nil
-- }
local length = parse_plus_minus(str)
if length then
local result
-- prepare a string appropriate to the output format
-- note: string.format uses C's sprintf patterns
-- '%.5g' for four digits after the dot.
-- warning: '%.5g' may output exponent notation,
-- '%.5f' would force floating point but leaves trailing 0s.
-- LaTeX: <number><unit> plus <number><unit> minus <number><unit>
-- css: <number><unit>
if format == 'latex' then
result = string.format('%.5g', length.main.amount)
.. length.main.unit
for _,key in ipairs({'plus','minus'}) do
if length[key] then
result = result..' '..key..' '
.. string.format('%.5g', length[key].amount)
.. length[key].unit
end
end
elseif format == 'css' then
result = string.format('%.5g', length.main.amount)
.. length.main.unit
end -- nothing in other formats
return result
end
end
end
-- # Filter components
--- Setup class: statement filter setup.
-- manages filter options, statement kinds, statement styles.
Setup = {}
--- Setup.options: global filter options
Setup.options = {
amsthm = true, -- use the amsthm package in LaTeX
aliases = true, -- use aliases (prefixes, labels) for statement classes
acronyms = true, -- use acronyms in custom labels
swap_numbers = false, -- numbers before label
define_in_header = true, -- defs in header, not local
supply_header = true, -- modify header-includes
only_statement = false, -- only process Divs of 'statement' class
definition_lists = true, -- process DefinitionLists
citations = true, -- allow citation syntax for crossreferences
count_within = nil, -- default count-within
pandoc_amsthm = true, -- process pandoc-amsthm style meta and theorems
language = 'en', -- LOCALE setting
fontsize = nil, -- document fontsize
LaTeX_section_level = 1, -- heading level for to LaTeX's 'section'
LaTeX_in_list_afterskip = '.5em', -- space after statement first item in list
LaTeX_in_list_rightskip = '2em', -- right margin for statement first item in list
acronym_delimiters = {'(',')'}, -- in output, in case we want to open this to the user
info_delimiters = {'(',')'}, -- in output, in case we want to open this to the user
aggregate_crossreferences = true, -- aggregate sequences of crossrefs of the same type
counter_delimiter = '.', -- separates section number and statement number
-- when writing a statement label or crossreference
}
--- Setup.meta, pointer to the doc's meta
-- needed by the JATS writer
Setup.meta = nil
--- Setup.kinds: kinds of statement, e.g. 'theorem', 'proof'
Setup.kinds = {
-- kindname = {
-- prefix = string, crossreference prefix
-- label = Inlines, statement's label e.g. "Theorem"
-- style = string, style (key of `styles`)
-- counter = string, 'none', 'self',
-- <kindname> string, kind for shared counter,
-- <level> number, heading level to count within
-- count = nil or number, this kind's counter value
-- is_written = nil or boolean, whether the kind def has been written
}
--- Setup.styles: styles of statement, e.g. 'plain', 'remark'
Setup.styles = {
-- stylename = {
-- do_not_define_in_latex = bool, whether to define in LaTeX amsthm
-- is_written = nil or bool, whether the definition has been written
-- based_on = 'plain' -- based on another style
-- margin_top = '\\baselineskip', -- space before
-- margin_bottom = '\\baselineskip', -- space after
-- margin_left = nil, -- left skip
-- margin_right = nil, -- right skip
-- body_font = 'italics', -- body font
-- indent = nil, -- indent amount
-- head_font = 'bold', -- head font
-- punctuation = '.', -- punctuation after statement heading
-- space_after_head = '1em', -- horizontal space after heading
-- linebreak_after_head = bool, -- linebreak after heading
-- heading_pattern = nil, -- heading pattern (not used yet)
-- crossref_font = 'smallcaps' -- font for crossref labels
-- custom_label_changes = { -- changes when using a custom label
-- ... (style map fields)
-- }
-- }
}
--- Setup.aliases: aliases for statement kind names ('thm' for 'theorem')
Setup.aliases = {
-- aliasname = kindname string, key of the Setup:kinds table
}
--- Setup.counters: list of level counters
Setup.counters = {
-- 1 = { count = number, count of level 1 headings
-- reset = {kind_keys}, list of kind_keys to reset when this counter is
-- incremented
-- format = string, e.g. '%1.%2.' for level_1.level_2.
-- or '%p.%s' for <parent string>.<self value>
-- }
}
--- Setup.crossref: Crossref object, contains crossref.identifiers table
-- and methods to handle it.
Setup.crossref = nil
-- Setup.includes: code to be included in header or before first statement
Setup.includes = {
header = nil,
before_first = nil,
}
-- Setup.LATEX_NAMES: often-used LaTeX names list
Setup.LATEX_NAMES = pandoc.List:new(
{'book', 'part', 'section', 'subsection',
'subsubsection', 'paragraph', 'subparagraph'}
)
--- Setup.DEFAULTS: default sets of kinds and styles
-- See amsthm documentation <https://www.ctan.org/pkg/amsthm>
-- the 'none' definitions are always included but they can be
-- overridden by others default sets or the user.
Setup.DEFAULTS = {}
Setup.DEFAULTS.KINDS = {
none = {
statement = {prefix = 'sta', style = 'empty', counter='none'},
},
basic = {
theorem = { prefix = 'thm', style = 'plain', counter = 'self' },
lemma = { prefix = 'lem', style = 'plain', counter = 'theorem' },
corollary = { prefix = 'cor', style = 'plain', counter = 'theorem' },
proposition = {prefix = 'prop', style = 'plain', counter = 'theorem' },
conjecture = {prefix = 'conj', style = 'plain', counter = 'theorem' },
fact = { style = 'plain', counter = 'theorem'},
definition = {prefix = 'defn', style = 'definition', counter = 'theorem'},
problem = {prefix = 'prob', style = 'definition', counter = 'theorem'},
example = {prefix = 'exa', style = 'definition', counter = 'theorem'},
exercise = {prefix = 'xca', style = 'definition', counter = 'theorem'},
axiom = {prefix = 'ax', style = 'definition', counter = 'theorem'},
solution = {prefix = 'sol', style = 'definition', counter = 'theorem'},
remark = {prefix = 'rem', style = 'remark', counter = 'theorem'},
claim = {prefix = 'claim', style = 'remark', counter = 'theorem'},
proof = {prefix = 'proof', style = 'proof', counter = 'none'},
criterion = {prefix = 'crit', style = 'plain', counter = 'theorem'},
assumption = {prefix = 'ass', style = 'plain', counter = 'theorem'},
algorithm = {prefix = 'alg', style = 'definition', counter = 'theorem'},
condition = {prefix = 'cond', style = 'definition', counter = 'theorem'},
question = {prefix = 'qu', style = 'definition', counter = 'theorem'},
note = {prefix = 'note', style = 'remark', counter = 'theorem'},
summary = {prefix = 'sum', style = 'remark', counter = 'theorem'},
conclusion = {prefix = 'conc', style = 'remark', counter = 'theorem'},
}
}
Setup.DEFAULTS.STYLES = {
none = {
empty = {
margin_top = '1em',
margin_bottom = '1em',
margin_left = '2em',
margin_right = '2em',
body_font = '',
indent = '0pt', -- applies to the label / first line only
head_font = 'smallcaps',
punctuation = '',
space_after_head = '0pt', -- use '\n' or '\\n' or '\newline' for linebreak
heading_pattern = nil,
custom_label_changes = {
punctuation = '.',
crossref_font = 'smallcaps',
space_after_head = ' ',
},
},
},
basic = {
plain = { do_not_define_in_latex = true,
margin_top = '1em',
margin_bottom = '1em',
margin_left = nil,
margin_right = nil,
body_font = 'italics',
indent = '0pt',
head_font = 'bold',
punctuation = '.',
space_after_head = '1em',
heading_pattern = nil,
},
definition = { do_not_define_in_latex = true,
based_on = 'plain',
body_font = '', -- '' used to reset the basis's field to nil
},
remark = { do_not_define_in_latex = true,
based_on = 'plain',
body_font = '',
head_font = 'italics',
},
proof = { do_not_define_in_latex = false,
based_on = 'plain',
body_font = 'normal',
head_font = 'italics',
}, -- Statement.write_style will take care of it
},
}
--- Setup.LOCALE: localize statement labels
Setup.LOCALE = {
ar = {
algorithm = "الخوارزم",
assumption = "فرضية",
axiom = "مُسلّمة",
claim = "متطلب",
conclusion = "استنتاج",
condition = "شرط",
conjecture = "حدس",
corollary = "لازمة",
criterion = "معيار",
definition = "تعريف",
example = "مثال",
exercise = "تمرين",
fact = "حقيقة",
lemma = "قضية مساعدة",
notation = "تدوين",
note = "ملاحظة",
problem = "مشكلة",
proof = "برهان",
proposition = "اقتراح",
question = "سؤال",
remark = "تنبيه",
solution = "حل",
summary = "موجز",
theorem = "نظرية",
},
bg = {
algorithm = "Aлгоритъм",
assumption = "Assumption",
axiom = "Axiom",
claim = "Claim",
conclusion = "Заключение",
condition = "Условие",
conjecture = "Conjecture",
corollary = "Corollary",
criterion = "Criterion",
definition = "Дефиниция",
example = "Пример",
exercise = "Упражнение",
fact = "Факт",
lemma = "Лема",
notation = "Notation",
note = "Бележка",
problem = "Проблем",
proof = "Доказателство",
proposition = "Допускане",
question = "Въпрос",
remark = "Remark",
solution = "Решение",
summary = "Обобщение",
theorem = "Теорема",
},
ca = {
algorithm = "Algorisme",
assumption = "Assumpció",
axiom = "Axioma",
claim = "Afirmació",
conclusion = "Conclusió",
condition = "Condició",
conjecture = "Conjectura",
corollary = "Corol·lari",
criterion = "Criteri",
definition = "Definició",
example = "Exemple",
exercise = "Exercici",
fact = "Fet",
lemma = "Lema",
notation = "Notació",
note = "Nota",
problem = "Problema",
proof = "Demostració",
proposition = "Proposició",
question = "Qüestió",
remark = "Comentari",
solution = "Solució",
summary = "Resum",
theorem = "Teorema",
},
cs = {
algorithm = "Algoritmus",
assumption = "Předpoklad",
axiom = "Axiom",
claim = "Tvrzení",
conclusion = "Závěr",
condition = "Podmínka",
conjecture = "Hypotéza",
corollary = "Důsledek",
criterion = "Kritérium",
definition = "Definice",
example = "Příklad",
exercise = "Cvičení",
fact = "Fakt",
lemma = "Lemma",
notation = "Značení",
note = "Poznámka",
problem = "Úloha",
proof = "Důkaz",
proposition = "Tvrzení",
question = "Otázka",
remark = "Poznámka",
solution = "Řešení",
summary = "Souhrn",
theorem = "Věta",
},
da = {
algorithm = "Algoritme",
assumption = "Antagelse",
axiom = "Aksiom",
claim = "Påstand",
conclusion = "Konklusion",
condition = "Betingelse",
conjecture = "Formodning",
corollary = "Korollar",
criterion = "Kriterium",
definition = "Definition",
example = "Eksempel",
exercise = "Øvelse",
fact = "Faktum",
lemma = "Lemma",
notation = "Notation",
note = "Note",
problem = "Problem",
proof = "Bevis",
proposition = "Forslag",
question = "Spørgsmål",
remark = "Bemærkning",
solution = "Løsning",
summary = "Resumé",
theorem = "Sætning",
},
de = {
algorithm = "Algorithmus",
assumption = "Annahme",
axiom = "Axiom",
claim = "Behauptung",
conclusion = "Schlussfolgerung",
condition = "Bedingung",
conjecture = "Vermutung",
corollary = "Korollar",
criterion = "Kriterium",
definition = "Definition",
example = "Beispiel",
exercise = "Aufgabe",
fact = "Fakt",
hypothesis = "Annahme",
lemma = "Lemma",
notation = "Notation",
note = "Notiz",
problem = "Problem",
proof = "Beweis",
proposition = "Satz",
question = "Frage",
remark = "Bemerkung",
solution = "Lösung",
summary = "Zusammenfassung",
theorem = "Theorem",
},
el = {
algorithm = "Αλγόριθμος",
assumption = "Υπόθεση",
axiom = "Αξίωμα",
claim = "Ισχυρισμός",
conclusion = "Συμπέρασμα",
condition = "Συνθήκη",
conjecture = "Εικασία",
corollary = "Πόρισμα",
criterion = "Κριτήριο",
definition = "Ορισμός",
example = "Παράδειγμα",
exercise = "Άσκηση",
fact = "Δεδομένο",
lemma = "Λήμμα",
notation = "Σημειογραφία",
note = "Σημείωση",
problem = "Πρόβλημα",
proof = "Απόδειξη",
proposition = "Πρόταση",
question = "Ερώτημα",
remark = "Παρατήρηση",
solution = "Λύση",
summary = "Σύνοψη",
theorem = "Θεώρημα",
},
en = {
algorithm = "Algorithm",
assumption = "Assumption",
axiom = "Axiom",
claim = "Claim",
conclusion = "Conclusion",
condition = "Condition",
conjecture = "Conjecture",
corollary = "Corollary",
criterion = "Criterion",
definition = "Definition",
example = "Example",
exercise = "Exercise",
fact = "Fact",
hypothesis = "Hypothesis",
lemma = "Lemma",
notation = "Notation",
note = "Note",
problem = "Problem",
proof = "Proof",
proposition = "Proposition",
question = "Question",
remark = "Remark",
solution = "Solution",
summary = "Summary",
theorem = "Theorem",
},
es = {
algorithm = "Algoritmo",
assumption = "Suposición",
axiom = "Axioma",
claim = "Afirmación",
conclusion = "Conclusión",
condition = "Condición",
conjecture = "Conjetura",
corollary = "Corolario",
criterion = "Criterio",
definition = "Definición",
example = "Ejemplo",
exercise = "Ejercicio",
fact = "Hecho",
hypothesis = "Hipótesis",
lemma = "Lema",
notation = "Notación",
note = "Nota",
problem = "Problema",
proof = "Demostración",
proposition = "Proposición",
question = "Pregunta",
remark = "Observación",
solution = "Solución",
summary = "Resumen",
theorem = "Teorema",
},
eu = {
algorithm = "Algoritmoa",
assumption = "Hipotesia",
axiom = "Axioma",
claim = "Aldarrikapena",
conclusion = "Ondorioa",
condition = "Baldintza",
conjecture = "Aierua",
corollary = "Korolarioa",
criterion = "Irizpidea",
definition = "Definizioa",
example = "Adibidea",
exercise = "Ariketa",
fact = "Egitatea",
lemma = "Lema",
notation = "Notazioa",
note = "Oharra",
problem = "Buruketa",
proof = "Frogapena",
proposition = "Proposizioa",
question = "Galdera",
remark = "Oharpena",
solution = "Emaitza",
summary = "Laburpena",
theorem = "Teorema",
},
fi = {
algorithm = "Algoritmi",
assumption = "Oletus",
axiom = "Aksiooma",
claim = "Väite",
conclusion = "Päätelmä",
condition = "Ehto",
conjecture = "Otaksuma",
corollary = "Seurauslause",
criterion = "Kriteeri",
definition = "Määritelmä",
example = "Esimerkki",
exercise = "Harjoitus",
fact = "Fakta",
lemma = "Lemma",
notation = "Merkintätapa",
note = "Muistiinpano",
problem = "Ongelma",
proof = "Todistus",
proposition = "Väittämä",
question = "Kysymys",
remark = "Huomautus",
solution = "Ratkaisu",
summary = "Yhteenveto",
theorem = "Lause",
},
fr = {
algorithm = "Algorithme",
assumption = "Supposition",