ajout du logo

This commit is contained in:
François Pelletier 2022-09-18 18:20:37 -04:00
parent 8c72fdb2be
commit 9549eed355
3 changed files with 9 additions and 3 deletions

4
.gitignore vendored
View file

@ -1,4 +1,6 @@
*.txt
*.pdf
*.pyc
*.zip
*.zip
/.idea/
/table.tex

View file

@ -23,7 +23,7 @@ def read_word_list(filename, min_length=2, min_different_letters=2):
return words
def write_grid_to_file(grid, out_file="table.tex", out_pdf="out.pdf", keep_tex=False, words=[]):
def write_grid_to_file(grid, out_file="table.tex", out_pdf="out.pdf", keep_tex=True, words=[]):
""" This function receives the generated grid and writes it to the file (or
to the screen, if that's what we want). The grid is expected to be a list
of lists, as used by the remaining functions.
@ -42,6 +42,7 @@ def write_grid_to_file(grid, out_file="table.tex", out_pdf="out.pdf", keep_tex=F
texfile.write(r"\usepackage{graphicx}" + "\n")
texfile.write("\n")
texfile.write(r"\begin{document}" + "\n")
texfile.write(r"\includegraphics[height=1.5cm]{logo}" + "\n")
texfile.write(r"\section*{Mots-croisés thématique}" + "\n")
# Resize box
@ -73,7 +74,7 @@ def write_grid_to_file(grid, out_file="table.tex", out_pdf="out.pdf", keep_tex=F
if words:
texfile.write(r"\section*{Mots utilisés dans ce mots-croisés}" + "\n")
# Write in several columns
texfile.write(r"\begin{multicols}{4}" + "\n")
texfile.write(r"\begin{multicols}{6}" + "\n")
texfile.write(r"\noindent" + "\n")
# Sort words by size
words.sort(key=lambda word: (len(word), word[0]))
@ -127,6 +128,9 @@ def write_grid_to_file(grid, out_file="table.tex", out_pdf="out.pdf", keep_tex=F
# Copy the latex source to the temporary directory
shutil.copy(out_file, tmpdir)
# Copy logo to the temporary directory
shutil.copy("logo.png", tmpdir)
# Move to the temp directory
os.chdir(tmpdir)

BIN
logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 KiB