Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
competitive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bruno Freitas Tissei
competitive
Commits
4b213008
Commit
4b213008
authored
6 years ago
by
Bruno Freitas Tissei
Browse files
Options
Downloads
Patches
Plain Diff
Small fixes to latex generator
Signed-off-by:
Bruno Freitas Tissei
<
bft15@inf.ufpr.br
>
parent
55264722
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
notebook/gen_latex.py
+21
-9
21 additions, 9 deletions
notebook/gen_latex.py
with
21 additions
and
9 deletions
notebook/gen_latex.py
+
21
−
9
View file @
4b213008
...
@@ -48,23 +48,35 @@ class Tree:
...
@@ -48,23 +48,35 @@ class Tree:
class
LatexGenerator
:
class
LatexGenerator
:
def
__init__
(
self
,
tree
):
def
__init__
(
self
,
tree
):
# TODO: Create output file, add header and finish code parsing and latex
self
.
tree
=
tree
self
.
tree
=
tree
self
.
hierarchy
=
[
'
chapter
'
]
+
[
i
*
'
sub
'
+
'
section
'
for
i
in
range
(
3
)]
self
.
hierarchy
=
[
'
chapter
'
]
+
[
i
*
'
sub
'
+
'
section
'
for
i
in
range
(
3
)]
self
.
gen_latex
(
tree
,
0
)
self
.
gen_latex
(
tree
)
# Prints elements in arr in Latex format.
# Prints section title in Latex format.
def
gen_code_latex
(
self
,
content
,
depth
):
# TODO: Instead of parsing format, get name of section through header of
print
(
'
\\
'
+
self
.
hierarchy
[
depth
]
+
'
{
'
+
content
+
'
}
'
)
# the algorithm/problem file. Capitalization should be used only for
# directories.
def
gen_title_latex
(
self
,
content
,
depth
):
text
=
'
'
.
join
(
list
(
map
(
lambda
x
:
x
.
capitalize
(),
content
.
split
(
'
.
'
)[
0
].
split
(
'
_
'
))))
print
(
'
\\
'
+
self
.
hierarchy
[
depth
]
+
'
{
'
+
text
+
'
}
'
)
# Prints code in Latex format.
def
gen_code_latex
(
self
,
path
):
# TODO: Add code parsing funcion and code to latex generation
pass
# Generates Latex for entire tree recursively
# Generates Latex for entire tree recursively
def
gen_latex
(
self
,
sub
,
depth
):
def
gen_latex
(
self
,
sub
,
path
=
''
,
depth
=
0
):
if
type
(
sub
)
==
list
:
if
type
(
sub
)
==
list
:
for
i
in
sub
:
for
i
in
sub
:
self
.
gen_code_latex
(
i
,
depth
)
self
.
gen_title_latex
(
i
,
depth
)
self
.
gen_code_latex
(
path
+
i
)
else
:
else
:
for
i
in
sub
:
for
i
in
sub
:
self
.
gen_
cod
e_latex
(
i
,
depth
)
self
.
gen_
titl
e_latex
(
i
,
depth
)
self
.
gen_latex
(
sub
[
i
],
depth
+
1
)
self
.
gen_latex
(
sub
[
i
],
path
+
i
+
'
/
'
,
depth
+
1
)
def
main
():
def
main
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment