mergeron 2024.739105.6__tar.gz → 2024.739123.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mergeron might be problematic. Click here for more details.

Files changed (32) hide show
  1. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/PKG-INFO +2 -3
  2. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/pyproject.toml +2 -3
  3. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/__init__.py +1 -1
  4. mergeron-2024.739123.1/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summarypaired_table_template.tex.jinja2 +130 -0
  5. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/data/jinja2_LaTeX_templates/mergeron.cls +36 -42
  6. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/data/jinja2_LaTeX_templates/mergeron_table_collection_template.tex.jinja2 +12 -9
  7. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/data/jinja2_LaTeX_templates/setup_tikz_tables.tex +61 -45
  8. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/gen/enforcement_stats.py +25 -21
  9. mergeron-2024.739105.6/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summarypaired_table_template.tex.jinja2 +0 -104
  10. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/README.rst +0 -0
  11. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/License.txt +0 -0
  12. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/core/__init__.py +0 -0
  13. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/core/damodaran_margin_data.py +0 -0
  14. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/core/ftc_merger_investigations_data.py +0 -0
  15. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/core/guidelines_boundaries.py +0 -0
  16. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/core/guidelines_boundary_functions.py +0 -0
  17. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/core/guidelines_boundary_functions_extra.py +0 -0
  18. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/core/pseudorandom_numbers.py +0 -0
  19. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/data/__init__.py +0 -0
  20. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/data/damodaran_margin_data.xls +0 -0
  21. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/data/damodaran_margin_data_dict.msgpack +0 -0
  22. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/data/ftc_invdata.msgpack +0 -0
  23. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/data/jinja2_LaTeX_templates/clrrate_cis_summary_table_template.tex.jinja2 +0 -0
  24. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_byhhianddelta_table_template.tex.jinja2 +0 -0
  25. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summary_table_template.tex.jinja2 +0 -0
  26. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/demo/__init__.py +0 -0
  27. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/demo/visualize_empirical_margin_distribution.py +0 -0
  28. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/gen/__init__.py +0 -0
  29. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/gen/data_generation.py +0 -0
  30. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/gen/data_generation_functions.py +0 -0
  31. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/gen/upp_tests.py +0 -0
  32. {mergeron-2024.739105.6 → mergeron-2024.739123.1}/src/mergeron/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mergeron
3
- Version: 2024.739105.6
3
+ Version: 2024.739123.1
4
4
  Summary: Merger Policy Analysis using Python
5
5
  License: MIT
6
6
  Keywords: merger policy analysis,merger guidelines,merger screening,policy presumptions,concentration standards,upward pricing pressure,GUPPI
@@ -29,10 +29,9 @@ Requires-Dist: matplotlib (>=3.8)
29
29
  Requires-Dist: mpmath (>=1.3)
30
30
  Requires-Dist: msgpack (>=1.0)
31
31
  Requires-Dist: msgpack-numpy (>=0.4)
32
- Requires-Dist: numpy (>=1.26,<2)
33
32
  Requires-Dist: scipy (>=1.12)
34
33
  Requires-Dist: sympy (>=1.12)
35
- Requires-Dist: tables (>=3.8)
34
+ Requires-Dist: tables (>=3.10.1)
36
35
  Requires-Dist: types-beautifulsoup4 (>=4.11.2)
37
36
  Requires-Dist: urllib3 (>=2.2.2,<3.0.0)
38
37
  Requires-Dist: xlrd (>=2.0.1,<3.0.0)
@@ -13,7 +13,7 @@ keywords = [
13
13
  "upward pricing pressure",
14
14
  "GUPPI",
15
15
  ]
16
- version = "2024.739105.6"
16
+ version = "2024.739123.1"
17
17
 
18
18
  # Classifiers list: https://pypi.org/classifiers/
19
19
  classifiers = [
@@ -48,11 +48,10 @@ matplotlib = ">=3.8"
48
48
  mpmath = ">=1.3"
49
49
  msgpack = ">=1.0"
50
50
  msgpack-numpy = ">=0.4"
51
- numpy = ">=1.26, <2"
52
51
  python = "^3.12"
53
52
  scipy = ">=1.12"
54
53
  sympy = ">=1.12"
55
- tables = ">=3.8"
54
+ tables = ">=3.10.1"
56
55
  xlsxwriter = ">=3.1"
57
56
  certifi = ">=2023.11.17"
58
57
  types-beautifulsoup4 = ">=4.11.2"
@@ -9,7 +9,7 @@ from numpy.typing import NDArray
9
9
 
10
10
  _PKG_NAME: str = Path(__file__).parent.stem
11
11
 
12
- VERSION = "2024.739105.6"
12
+ VERSION = "2024.739123.1"
13
13
 
14
14
  __version__ = VERSION
15
15
 
@@ -0,0 +1,130 @@
1
+ \begin{table}[bt]
2
+
3
+
4
+ ((* if tmpl_data.test_regime == 'Enforcement' *))
5
+ ((* set prop_title = "Proportion Enforced" *))
6
+ ((* else *))
7
+ ((* set prop_title = "Proportion Cleared" *))
8
+ ((* endif *))
9
+ ((* set prop_title = prop_title|replace(" ", "\\\\") *))
10
+
11
+ ((* if tmpl_data.obs_merger_class_0 == 'All Markets' *))
12
+ ((* set obs_merger_class_0 = "All Markets" *))
13
+ ((* else *))
14
+ ((* set obs_merger_class_0 = "Markets with, ``" + tmpl_data.obs_merger_class_0 + "''" *))
15
+ ((* endif *))
16
+
17
+ ((* set obs_merger_class_1 = "Markets with, ``" + tmpl_data.obs_merger_class_1 + "''" *))
18
+
19
+ \centering
20
+ \caption{FTC Merger Investigations Data}\label{tbl:FTCInvData_\JINVAR{- obs_summary_type }}
21
+ {\footnotesize \JINVAR{ obs_summary_type_title } \\
22
+ Grouped by Entry Conditions and Reporting Period \\[0.5\baselineskip]}
23
+ \begin{tikzpicture}[auto, font = \sffamily]
24
+ \begin{pgfonlayer}{background}
25
+ \matrix[
26
+ datatable,
27
+ nodes = {text width = 27pt,},
28
+ column 1/.style = {nodes = {
29
+ hdrtext,
30
+ text width=\JINVAR{ hdrcol_width -}, fill=OBSHDRFill,
31
+ },},
32
+ record matrix dimensions,
33
+ ] (invres_rate_raw) {
34
+ \JINVAR{ tmpl_data.invdata_datstr -}
35
+ };
36
+ % Horizontal scoring for totals
37
+ \draw[color = OBSHDRFill, line width = 1pt] (invres_rate_raw-\the\tnr-1.north west) -- (invres_rate_raw-\the\tnr-\the\tnc.north east);
38
+ % Vertical scoring for column groups
39
+ \draw[color = OBSHDRFill, line width = 1pt] (invres_rate_raw-1-3.north east) -- (invres_rate_raw-\the\tnr-3.south east);
40
+ \draw[color = OBSHDRFill, line width = 1pt] (invres_rate_raw-1-5.north east) -- (invres_rate_raw-\the\tnr-5.south east);
41
+ \draw[color = OBSHDRFill, line width = 1pt] (invres_rate_raw-1-7.north east) -- (invres_rate_raw-\the\tnr-7.south east);
42
+ \end{pgfonlayer}
43
+
44
+
45
+ %% Header column - row heads - description
46
+ \matrix[
47
+ hcol,
48
+ above right=0pt of invres_rate_raw.north west,
49
+ nodes = {
50
+ text width=\JINVAR{- tmpl_data.hdrcol_width -},
51
+ text depth=10pt,
52
+ },
53
+ ] (hdrcol_desc) {
54
+ \node[align = center,] { \JINVAR{- tmpl_data.hdrcol_desc_text } \\ }; \\
55
+ };
56
+
57
+ % Header row - column heads
58
+ \matrix[
59
+ hrow,
60
+ above right = 0 pt of hdrcol_desc.south east,
61
+ nodes = {
62
+ rotate = 90,
63
+ minimum height = 33pt,
64
+ text depth = 10pt,
65
+ align = left,
66
+ }, %
67
+ ] (hdrrow_raw) {
68
+ {Relative \\ Frequency} &
69
+ {\JINVAR{ prop_title }} &
70
+ {Relative \\ Frequency} &
71
+ {\JINVAR{ prop_title }} &
72
+ {Relative \\ Frequency} &
73
+ {\JINVAR{ prop_title }} &
74
+ {Relative \\ Frequency} &
75
+ {\JINVAR{ prop_title }} \\
76
+ };
77
+
78
+ %% Header row - columns description -- Markets 0 - period 1-2
79
+ \matrix[hrow, above right = 0pt of hdrrow_raw.north west, nodes = {minimum height = 12.5pt, text width = 59.6pt,},] (descrow_pds) {
80
+ \JINVAR{ tmpl_data.obs_periods_str } & \JINVAR{ tmpl_data.obs_periods_str } \\
81
+ \JINVAR{ tmpl_data.mkt_counts_str_class_0 } & \JINVAR{ tmpl_data.mkt_counts_str_class_1 } \\
82
+ };
83
+
84
+ % Header row - Market-1
85
+ \matrix[hrow, above right = 0pt of descrow_pds.north west, nodes = {minimum height = 12.5pt, text width = 124.8pt},] (descrow_mkts) {
86
+ \JINVAR{ obs_merger_class_0 } & \JINVAR{ obs_merger_class_1 } \\
87
+ };
88
+ % Header row - columns description
89
+ \matrix[hrow, above right = 0pt of descrow_mkts.north west, nodes = {minimum height = 12.5pt, text width = 255.2pt},] (descrow_obs) {
90
+ Observed Data \\
91
+ };
92
+
93
+ %% Vertical scoring delineating column groups
94
+ \draw[color = white, line width = 1pt] (descrow_pds-1-1.north east) -- (invres_rate_raw-1-3.north east);
95
+ \draw[color = white, line width = 1pt] (descrow_mkts-1-1.north east) -- (invres_rate_raw-1-5.north east);
96
+ \draw[color = white, line width = 1pt] (descrow_pds-1-3.north east) -- (invres_rate_raw-1-7.north east);
97
+
98
+ %% Fill along header
99
+ \draw[color = OBSHDRFill, fill = OBSHDRFill,]
100
+ (hdrcol_desc.north west |- descrow_obs.north west)
101
+ rectangle
102
+ (hdrcol_desc.north east)
103
+ ;
104
+
105
+ \end{tikzpicture}
106
+
107
+ \setlist{nosep}
108
+ \vspace{\baselineskip}
109
+ {\raggedright\sffamily\tiny%
110
+ %
111
+ % NOTES:
112
+ % \begin{itemize}
113
+ % \item Data for period, 2004--2011 calculated by subtracting reported figures for 1996--2003 from reported figures for 1996--2011
114
+ % \item Ranges of $\Delta HHI$ are defined as half-open intervals with \(\Delta_L \leqslant \Delta HHI < \Delta_H\), except that \(2500 \text{ pts.} \leqslant \Delta HHI \leqslant 5000 \text{ pts.}\) in the closed interval [2500, 5000] pts.
115
+ % \end{itemize}
116
+
117
+ % SOURCES:
118
+ % \begin{itemize}
119
+ % % \item \fullcite{FTCInvData2003}, Table~4.1 and Table~10.2
120
+ % \item Fed. Trade Comm'n (2003), at note~\cref{fn:FTCInvData1996to2003}
121
+ % \item Fed. Trade Comm'n (2011), at note~\cref{fn:FTCInvData1996to2011}
122
+ % \end{itemize}
123
+ \JINVAR{- tmpl_data.invdata_notestr -}
124
+ \vspace{\baselineskip}
125
+ \JINVAR{ tmpl_data.invdata_sourcestr -}
126
+ }
127
+ \vspace{\baselineskip}
128
+ \end{table}
129
+
130
+
@@ -1,23 +1,19 @@
1
- %% https://tex.stackexchange.com/questions/638194/
2
- \ExplSyntaxOn % Switch on expl3 syntax
3
- \sys_ensure_backend: % load the backend code
4
- \pdf_version_gset:n{1.7} % Use provided expl3 function
5
- \ExplSyntaxOff % Switch off expl3 syntax
1
+ \ProvidesClass{mergeron}
6
2
 
7
3
  \LoadClass{scrartcl}
8
4
  \RequirePackage[singlespacing=true]{scrlayer-scrpage}
9
5
  \KOMAoptions{
10
- draft=off,
11
- fontsize=12pt,
12
- paper=letter,
13
- DIV=12,
14
- footnotes=multiple,
15
- numbers=withendperiod,
16
- headsepline=on,
17
- footsepline=off,
18
- abstract=on,
19
- headheight=36pt,
20
- footheight=36pt,
6
+ draft=off,
7
+ fontsize=12pt,
8
+ paper=letter,
9
+ DIV=12,
10
+ footnotes=multiple,
11
+ numbers=withendperiod,
12
+ headsepline=on,
13
+ footsepline=off,
14
+ abstract=on,
15
+ headheight=36pt,
16
+ footheight=48pt,
21
17
  }
22
18
  \RequirePackage[l2tabu, orthodox]{nag}
23
19
 
@@ -25,12 +21,12 @@
25
21
  \setdefaultlanguage[variant=american]{english}
26
22
  % Appendix prefix for scrartcl
27
23
  \newcommand*{\appendixmore}{%
28
- \renewcommand*{\sectionformat}{%
29
- \appendixname~\thesection\autodot\enskip%
30
- }%
31
- \renewcommand*{\sectionmarkformat}{%
32
- \appendixname~\thesection\autodot\enskip%
33
- }%
24
+ \renewcommand*{\sectionformat}{%
25
+ \appendixname~\thesection\autodot\enskip%
26
+ }%
27
+ \renewcommand*{\sectionmarkformat}{%
28
+ \appendixname~\thesection\autodot\enskip%
29
+ }%
34
30
  }
35
31
 
36
32
  \RequirePackage[doublespacing]{setspace}
@@ -59,24 +55,24 @@
59
55
 
60
56
  % Fonts and math
61
57
  \RequirePackage{fontspec}
62
- \setmonofont[Scale=MatchLowercase,]{Fira Mono}
63
- \setsansfont{Fira Sans}
64
- \setmainfont{STIX Two Text}
58
+ \setmonofont[Scale=MatchLowercase,]{Roboto Mono}
59
+ \setsansfont{Roboto}
60
+ \setmainfont{STIXTwoText}
65
61
 
66
62
  \RequirePackage[standard]{ntheorem}
67
63
  \RequirePackage{mathtools}
68
64
  \RequirePackage{unicode-math}
69
- \setmathfont[math-style=ISO]{STIX Two Math}
65
+ \setmathfont{STIXTwoMath}[math-style=ISO]
70
66
  % Separate \mathscr from \mathcal
71
- \setmathfont{STIX Two Math}[range={scr,bfscr},StylisticSet=01]
67
+ \setmathfont{STIXTwoMath}[range={scr,bfscr},StylisticSet=01]
72
68
 
73
69
  \defaultfontfeatures[\rmfamily,\sffamily]{
74
- Ligatures={TeX, Common},
75
- Numbers={proportional, lining}
70
+ Ligatures={TeX, Common},
71
+ Numbers={proportional, lining}
76
72
  }
77
73
  \RequirePackage[
78
- activate={true,nocompatibility},
79
- tracking=true,
74
+ activate={true,nocompatibility},
75
+ tracking=true,
80
76
  ]{microtype}
81
77
 
82
78
  \RequirePackage{tabularray}
@@ -85,9 +81,9 @@
85
81
  %% https://tex.stackexchange.com/questions/286733/change-content-font-in-tabular-environments
86
82
  \makeatletter
87
83
  \appto\@floatboxreset{%
88
- \ifx\@captype\andy@table
89
- \sffamily\addfontfeatures{Numbers={Monospaced, Lining},}
90
- \fi
84
+ \ifx\@captype\andy@table
85
+ \sffamily\addfontfeatures{Numbers={Monospaced, Lining},}
86
+ \fi
91
87
  }
92
88
  \def\andy@table{table}
93
89
  \makeatother
@@ -109,7 +105,7 @@
109
105
  %% Read KOMA-Script documentation
110
106
  \setfootnoterule[0.4pt]{\linewidth}
111
107
  \deffootnote{2.5em}{2.5em}{%
112
- \makebox[2.5em][l]{\hspace{1ex}\thefootnotemark.}%
108
+ \makebox[2.5em][l]{\hspace{1ex}\thefootnotemark.}%
113
109
  }
114
110
 
115
111
  %% For highlighting text with a colored background, soul
@@ -119,7 +115,7 @@
119
115
  %% Properly typset intervals, and avoid messages about unmatched parentheses
120
116
  \RequirePackage{interval}
121
117
  \intervalconfig{
122
- soft open fences,
118
+ soft open fences,
123
119
  }
124
120
 
125
121
  %%% custom commands, environments and symbols
@@ -133,7 +129,7 @@
133
129
  \DeclarePairedDelimiter\set\{\}
134
130
  %% http://mirrors.ctan.org/macros/latex/contrib/mathtools/mathtools.pdf, 27--28
135
131
  \DeclarePairedDelimiterX\SetSuchThat[2]{\lbrace}{\rbrace}{%
136
- #1 \, \delimsize\vert \, \mathopen{}#2
132
+ #1 \, \delimsize\vert \, \mathopen{}#2
137
133
  }
138
134
 
139
135
  %% Sometimes, you just want to comment out several lies of text
@@ -148,14 +144,12 @@
148
144
  \RequirePackage{hyperref}
149
145
  \ProcessOptions\relax
150
146
  \hypersetup{%
151
- unicode=true,
152
- bookmarksnumbered=false,
153
- hidelinks,
154
- pdfencoding=auto,
147
+ bookmarksnumbered=false,
148
+ hidelinks,
155
149
  }
156
150
  \RequirePackage[capitalize, noabbrev]{cleveref}
157
151
 
158
152
  \AtBeginDocument{%
159
- \SetBlockEnvironment{quoting}
153
+ \SetBlockEnvironment{quoting}
160
154
  }
161
155
 
@@ -1,15 +1,16 @@
1
+ \DocumentMetadata{pdfversion=1.7, lang=en-US, pdfstandard=A-3u}
1
2
  \documentclass{mergeron}
2
3
 
3
- \usepackage{luacode}
4
- \begin{luacode}
5
- local function embedfull(tfmdata)
6
- tfmdata.embedding = "full"
7
- end
4
+ %% Get column- and row-counts for tikz matrix
5
+ \newcount\tnr
6
+ \newcount\tnc
7
+ \makeatletter
8
+ \tikzset{record matrix dimensions/.style={execute at end matrix={
9
+ \global\tnc=\pgf@matrix@numberofcolumns
10
+ \global\tnr=\pgfmatrixcurrentrow
11
+ }}}
12
+ \makeatother
8
13
 
9
- luatexbase.add_to_callback(
10
- "luaotfload.patch_font", embedfull, "embedfull"
11
- )
12
- \end{luacode}
13
14
 
14
15
  % Specify location for includegraphics files:
15
16
  \graphicspath{{~/mergeron}}
@@ -32,6 +33,8 @@
32
33
  %% Define colors for tables
33
34
  \definecolor{table_bar_green}{HTML}{dfeadf}
34
35
 
36
+ \usepackage{enumitem}
37
+
35
38
  %% BibLaTex/APA style citation
36
39
  \usepackage[
37
40
  sorting=nyt,
@@ -18,62 +18,78 @@
18
18
  % https://tex.stackexchange.com/questions/167944/auto-word-wrapping-in-a-node-in-tikz
19
19
  % https://tex.stackexchange.com/questions/132741/typewriter-in-tikz-node
20
20
  \tikzset{
21
+ green_bar_filler/.code={%
22
+ \pgfmathtruncatemacro{\itest}{ifthenelse(%
23
+ \pgfmatrixcurrentcolumn==1,0,%
24
+ ifthenelse(iseven(\pgfmatrixcurrentrow),1,3))}
25
+ %\typeout{\the\pgfmatrixcurrentcolumn,\pgfmatrixcurrentrow->\itest}
26
+ \ifcase\itest
27
+ \tikzset{fill=OBSHDRFill}%
28
+ \or
29
+ \tikzset{fill=DataFill}%
30
+ \else
31
+ \tikzset{fill=white}%
32
+ \fi
33
+ },
21
34
  % If you only have numbers, text depth = 0ex; if text, text depth = 0.25ex, (may need tweaking for alignment across cells)
22
35
  anytext/.style = {
23
- align = center,
24
- font = \sffamily\scriptsize,
25
- inner sep = 0pt,
26
- text depth = 0pt,
27
- }, %
36
+ font = \sffamily\scriptsize\addfontfeatures{Numbers={Monospaced,Lining}},
37
+ align = center,
38
+ inner sep = 3pt,
39
+ text depth = 0pt,
40
+ },
28
41
  hdrtext/.style = {
29
- anytext,
30
- text = white,
31
- fill = OBSHDRFill,
32
- }, %
42
+ anytext,
43
+ text = white,
44
+ fill = OBSHDRFill,
45
+ },
33
46
  notetext/.style = {
34
- anytext,
35
- font = \sffamily\tiny,
36
- align = left,
37
- },
47
+ anytext,
48
+ font = \sffamily\tiny,
49
+ align = left,
50
+ },
38
51
  anytable/.style = {
39
- matrix of nodes,
40
- nodes in empty cells,
41
- column sep = -1.0\pgflinewidth,
42
- row sep = -1.0\pgflinewidth,
43
- inner sep = -0.25\pgflinewidth,
44
- outer sep = -0.25\pgflinewidth,
45
- nodes = {anchor = center, minimum height = 12.5pt,}
46
- },
52
+ matrix of nodes,
53
+ nodes in empty cells,
54
+ column sep = -1.0\pgflinewidth,
55
+ row sep = -1.0\pgflinewidth,
56
+ inner sep = -0.25\pgflinewidth,
57
+ outer sep = -0.25\pgflinewidth,
58
+ nodes = {anchor = center, minimum height = 12.5pt,}
59
+ },
47
60
  datatable/.style = {
48
- anytable,
49
- nodes = {
50
- font = \sffamily\scriptsize\addfontfeatures{Numbers={Monospaced,Lining}},
51
- align = right,
52
- inner xsep = 3pt,
53
- inner ysep = 0pt,
54
- text depth = 0pt,
55
- draw = none,
56
- fill = none,
57
- },
58
- every even row/.style = {
59
- nodes = {fill = DataFill}
60
- },
61
+ anytable,
62
+ nodes = {
63
+ anytext,
64
+ align = right,
65
+ draw = none,
66
+ fill = none,
67
+ green_bar_filler,
61
68
  },
62
- hrow/.style = {
63
- anytable,
64
- nodes = {
65
- hdrtext,
66
- draw = none,
67
- fill = OBSHDRFill,
68
- text width = 40pt,
69
- },
69
+ % every even row/.style = {
70
+ % nodes = {fill = DataFill}
71
+ % },
72
+ },
73
+ hdrtable/.style = {
74
+ anytable,
75
+ nodes = {
76
+ hdrtext,
77
+ draw = none,
78
+ fill = OBSHDRFill,
70
79
  },
80
+ },
81
+ hrow/.style = {
82
+ hdrtable,
83
+ nodes = {text width = 40pt,},
84
+ },
71
85
  hcol/.style = {
72
- hrow,
73
- nodes = {text width = 60pt,},
74
- },
86
+ hdrtable,
87
+ nodes = {text width = 60pt,},
88
+ },
75
89
  }
76
90
  % Define layers for later reference
77
91
  % https://tex.stackexchange.com/questions/40840/put-a-node-behind-another-in-a-tikz-diagram
78
92
  \pgfdeclarelayer{background}
79
93
  \pgfsetlayers{background,main}
94
+
95
+
@@ -91,23 +91,27 @@ moe_tmpl = Template(R"""
91
91
 
92
92
  # Define the LaTeX jinja environment
93
93
  # http://eosrei.net/articles/2015/11/LaTeX-templates-python-and-jinja2-generate-pdfs
94
- with resources.as_file(
95
- resources.files(f"{_PKG_NAME}.data.jinja2_LaTeX_templates")
96
- ) as _tmpl_folder:
97
- LaTeX_jinja_env = Environment(
98
- block_start_string=R"((*",
99
- block_end_string="*))",
100
- variable_start_string=R"\JINVAR{",
101
- variable_end_string="}",
102
- comment_start_string=R"((#", # r'#{',
103
- comment_end_string=R"#))", # '}',
104
- line_statement_prefix="##",
105
- line_comment_prefix="%#",
106
- trim_blocks=True,
107
- lstrip_blocks=True,
108
- autoescape=select_autoescape(disabled_extensions=("tex.jinja2",)),
109
- loader=FileSystemLoader(_tmpl_folder),
110
- )
94
+ # The context manager does not point to a templates folder, so it doesn't work here
95
+ # So, we brute-force a solution
96
+
97
+ _tmpl_folder = re.search(
98
+ r"'(.*)'", str(resources.files(f"{_PKG_NAME}.data.jinja2_LaTeX_templates"))
99
+ )[0].strip("'")
100
+
101
+ LaTeX_jinja_env = Environment(
102
+ block_start_string=R"((*",
103
+ block_end_string="*))",
104
+ variable_start_string=R"\JINVAR{",
105
+ variable_end_string="}",
106
+ comment_start_string=R"((#", # r'#{',
107
+ comment_end_string=R"#))", # '}',
108
+ line_statement_prefix="##",
109
+ line_comment_prefix="%#",
110
+ trim_blocks=True,
111
+ lstrip_blocks=True,
112
+ autoescape=select_autoescape(disabled_extensions=("tex.jinja2",)),
113
+ loader=FileSystemLoader(_tmpl_folder),
114
+ )
111
115
 
112
116
  # Place files related to rendering LaTeX in output data directory
113
117
  if not (_out_path := DATA_DIR.joinpath(f"{_PKG_NAME}.cls")).is_file():
@@ -129,7 +133,7 @@ if not (_DOTTEX := DATA_DIR / Rf"{_PKG_NAME}_TikZTableSettings.tex").is_file():
129
133
  shutil.copy2(_tex_path, _DOTTEX)
130
134
 
131
135
 
132
- LTX_ARRAY_LINEEND = R"\\" "\n"
136
+ LTX_ARRAY_LINEEND = "\\\\\n"
133
137
  LaTeX_hrdcoldesc_format_str = "{}\n{}\n{}".format(
134
138
  "".join((
135
139
  R"\matrix[hcol, above=0pt of {}, nodes = {{",
@@ -173,15 +177,15 @@ ZONE_STRINGS = {
173
177
  ZONE_DETAIL_STRINGS_HHI = {
174
178
  0: Rf"HHI < {HHI_POST_ZONE_KNOTS[1]} pts.",
175
179
  1: R"HHI ∈ [{}, {}) pts. and ".format(*HHI_POST_ZONE_KNOTS[1:3]),
176
- 2: Rf"HHI {HHI_POST_ZONE_KNOTS[2]} pts. and ",
180
+ 2: Rf"HHI {HHI_POST_ZONE_KNOTS[2]} pts. and ",
177
181
  }
178
182
 
179
183
  ZONE_DETAIL_STRINGS_DELTA = {
180
184
  0: "",
181
185
  1: Rf"ΔHHI < \text{{{HHI_DELTA_KNOTS[1]} pts.}}",
182
- 2: Rf"ΔHHI \text{{{HHI_DELTA_KNOTS[1]} pts.}}",
186
+ 2: Rf"ΔHHI \text{{{HHI_DELTA_KNOTS[1]} pts.}}",
183
187
  3: R"ΔHHI ∈ \text{{[{}, {}) pts.}}".format(*HHI_DELTA_KNOTS[1:3]),
184
- 4: Rf"ΔHHI \text{{{HHI_DELTA_KNOTS[2]} pts.}}",
188
+ 4: Rf"ΔHHI \text{{{HHI_DELTA_KNOTS[2]} pts.}}",
185
189
  }
186
190
 
187
191
  ZONE_STRINGS_LATEX = {
@@ -1,104 +0,0 @@
1
- \begin{table}[bt]
2
- ((* if tmpl_data.obs_merger_class_0 == 'All Markets' *))
3
- ((* set obs_merger_class_0 = tmpl_data.obs_merger_class_0 *))
4
- ((* else *))
5
- ((* set obs_merger_class_0 = "Markets with, ``" + tmpl_data.obs_merger_class_0 + "''" *))
6
- ((* endif *))
7
-
8
- ((* if tmpl_data.test_res == 'Enforcement' *))
9
- ((* set prop_title = "Proportion Enforced" *))
10
- ((* else *))
11
- ((* set prop_title = "Proportion Cleared" *))
12
- ((* endif *))
13
-
14
- ((* set obs_merger_class_1 = "Markets with, ``" + tmpl_data.obs_merger_class_1 + "''" *))
15
-
16
- \centering
17
- \caption{FTC Merger Investigations Data}\label{tbl:FTCInvData_\JINVAR{ tmpl_data.obs_summary_type|replace(" ", "") -}}
18
- {\footnotesize \JINVAR{ tmpl_data.obs_summary_type_title } \\
19
- Grouped by Entry Conditions and Reporting Period \\[0.5\baselineskip]}
20
- \begin{tikzpicture}[auto, font = \sffamily]
21
- \begin{pgfonlayer}{background}
22
- \matrix[datatable, nodes = {text width = 27pt,},] (enf_rate_raw) {
23
- \JINVAR{ tmpl_data.invdata_datstr -}
24
- };
25
- % Horizontal scoring for totals
26
- \draw[color = OBSHDRFill, line width = 1pt] (enf_rate_raw-\JINVAR{- tmpl_data.invdata_numrows -}-1.north west) -- (enf_rate_raw-\JINVAR{- tmpl_data.invdata_numrows -}-8.north east);
27
- % Vertical scoring for column groups
28
- \draw[color = OBSHDRFill, line width = 1pt] (enf_rate_raw-1-2.north east) -- (enf_rate_raw-\JINVAR{- tmpl_data.invdata_numrows -}-2.south east);
29
- \draw[color = OBSHDRFill, line width = 1pt] (enf_rate_raw-1-4.north east) -- (enf_rate_raw-\JINVAR{- tmpl_data.invdata_numrows -}-4.south east);
30
- \draw[color = OBSHDRFill, line width = 1pt] (enf_rate_raw-1-6.north east) -- (enf_rate_raw-\JINVAR{- tmpl_data.invdata_numrows -}-6.south east);
31
- \end{pgfonlayer}
32
-
33
- \matrix[hrow,
34
- above = 0 pt of enf_rate_raw,
35
- nodes = {minimum height = 33pt, text depth = 10pt, text width = 60pt, align = left, inner sep = 3pt,},
36
- ] (hdrrow_raw) {
37
- \node[rotate = 90] {Relative \\ Frequency \\}; &
38
- \node[rotate = 90] {\JINVAR{ prop_title|replace(" ", "\\\\") } \\}; &
39
- \node[rotate = 90] {Relative \\ Frequency \\}; &
40
- \node[rotate = 90] {\JINVAR{ prop_title|replace(" ", "\\\\") } \\}; &
41
- \node[rotate = 90] {Relative \\ Frequency \\}; &
42
- \node[rotate = 90] {\JINVAR{ prop_title|replace(" ", "\\\\") } \\}; &
43
- \node[rotate = 90] {Relative \\ Frequency \\}; &
44
- \node[rotate = 90] {\JINVAR{ prop_title|replace(" ", "\\\\") } \\}; \\
45
- };
46
- % Header row - columns description -- Markets 0 - period 1-2
47
- \matrix[hrow, above left = 0pt of hdrrow_raw.north, nodes = {minimum height = 12.5pt, text width = 65.6pt,},] (descrow_raw_pds1) {
48
- \JINVAR{ tmpl_data.obs_periods_str }
49
- \JINVAR{ tmpl_data.mkt_counts_str_class_0 }
50
- };
51
- % Header row - columns description -- Markets 1 - period 1-2
52
- \matrix[hrow, above right = 0pt of hdrrow_raw.north, nodes = {minimum height = 12.5pt, text width = 65.6pt,},] (descrow_raw_pds2) {
53
- \JINVAR{ tmpl_data.obs_periods_str }
54
- \JINVAR{ tmpl_data.mkt_counts_str_class_1 }
55
- };
56
- % Header row - columns description
57
- \matrix[hrow, above left = 0pt of descrow_raw_pds1.north east, nodes = {minimum height = 12.5pt, text width = 130.8pt},] (descrow_raw_mkt1) { \JINVAR{ obs_merger_class_0 } \\
58
- };
59
- % Header row - columns description
60
- \matrix[hrow, above right = 0pt of descrow_raw_pds2.north west, nodes = {minimum height = 12.5pt, text width = 130.8pt},] (descrow_raw_mkt2) { \JINVAR{ obs_merger_class_1 } \\
61
- };
62
- % Header row - columns description
63
- \matrix[hrow, above left = 0pt of descrow_raw_mkt2.north east, nodes = {minimum height = 12.5pt, text width = 261.2pt},] (descrow_raw_top) {
64
- Observed Data \\
65
- };
66
- % Vertical scoring for column groups
67
- \draw[color = white, line width = 1pt] (descrow_raw_pds1-1-1.north east) -- (enf_rate_raw-1-2.north east);
68
- \draw[color = white, line width = 1pt] (descrow_raw_mkt1-1-1.north east) -- (enf_rate_raw-1-4.north east);
69
- \draw[color = white, line width = 1pt] (descrow_raw_pds2-1-1.north east) -- (enf_rate_raw-1-6.north east);
70
-
71
- % Header column - row heads
72
- \matrix[hcol, left = 0pt of enf_rate_raw, nodes = {
73
- text width = \JINVAR{ tmpl_data.hdrcol_raw_width -},
74
- inner xsep = 3 pt,
75
- },] (hdrcol_raw) {
76
- \JINVAR{ tmpl_data.invdata_hdrstr -}
77
- };
78
- % Header column - row heads - description
79
- \JINVAR{ tmpl_data.invdata_hdrcoldescstr }
80
-
81
- % Fill along header
82
- \draw[color = OBSHDRFill, fill = OBSHDRFill,]
83
- (hdrcoldesc_raw.north west |- descrow_raw_top.north west)
84
- rectangle
85
- (hdrcoldesc_raw.north east)
86
- ;
87
- ((# % Separator for header column
88
- \draw[color = white, line width = 1pt] (descrow_raw_mkt1-1-1.north west) -- (enf_rate_raw-1-1.north west); #))
89
-
90
- % Notes below table
91
- \matrix[anytable,
92
- below right = 4pt and 4pt of hdrcol_raw.south west,
93
- nodes = {notetext, minimum height = 8pt, text width = \JINVAR{ tmpl_data.invdata_notewidth -}\linewidth,},
94
- ] (notestext) {%
95
- \JINVAR{ tmpl_data.invdata_notestr -}
96
- SOURCES: \\
97
- % TODO: Table numbers need updating
98
- % \(\cdot\) \fullcite{FTCInvData2003}, Table~4.1 and Table~10.2 \\
99
- \JINVAR{ tmpl_data.invdata_sourcestr -}
100
- % \(\cdot\) \fullcite{FTCInvData2011}, Table~4.1 and Table~10.2 \\
101
- };
102
- \end{tikzpicture}
103
- \end{table}
104
-