Giter Club home page Giter Club logo

tinplate's Introduction

TINplate

GitHub

๐Ÿ“” -> ๐Ÿ’ญ ๐Ÿ’ก ๐ŸŽˆ Template of ICPC Notebooks

Usage

Basic usage

  1. Install dependencies:

  2. Install fonts

    Download font files then run sudo cp -r /path/to/download/fonts /usr/share/fonts/truetype/ && fc-cache -f

    Run fc-list | grep Fira to check installation status

  3. Clone this repo and then open it

  4. Run python -m pip install -r requirements.txt to install requirements

  5. Run python manager.py run to generate all the contents and compile notebook.tex

Full usage

Run python manager.py --help to see all the commands.

Configuration

All the configuration is in config.yml

# The parent folder of `notebook_code_dir`, `notebook_doc_dir` and `cheatsheet_dir`
src_dir: src
# The folder contains all the codes which will be listed
notebook_code_dir: code
# The folder contains all the documentation
notebook_doc_dir: doc
# The folder contains all the cheatsheet documentation
cheatsheet_dir: cheatsheet

# The folder contains all the test codes
test_dir: test

# The name of the file that will be compiled
notebook_file: notebook

# Listing all test code before compiling if `true`
export_testcode_in_notebook: true

# Notebook config
notebook:
  # Chapters config, the content will be generated in the order of this field
  chapters:
    # Should be formed in: ${chapter_key}: ${title}
    # All the chapter is titled as ${title},
    # and all resources for the following sections of each chapters should be placed in these folders:
    # - code: ${src_dir}/${notebook_code_dir}/${chapter_key}
    # - documentation: ${src_dir}/${notebook_doc_dir}/${chapter_key}
    # - test code: ${test_dir}/${chapter_key}

    example: Example

  # Section config
  sections:
    # Config of sections following the chapter ${chapter_key}
    example:
      # Should be an array, the elements of which should be formed in:
      #    ${section_key}: ${title}
      #    code_ext: ${extension_name_of_code}
      #    test_ext: ${extension_name_of_test_code}
      # The relevant files should be in:
      # - code: ${src_dir}/${notebook_code_dir}/${chapter_key}/${section_key}.${extension_name_of_code}
      # - documentation: ${src_dir}/${notebook_doc_dir}/${chapter_key}/${section_key}.tex
      # - test code: ${test_dir}/${chapter_key}/${section_key}.${extension_name_of_test_code}

      - helloworld: Hello
        code_ext: hpp
        test_ext: cpp

# Cheatsheet config
cheatsheets:
  # Should be formed in: ${cheatsheet_key}: ${title}
  # The relevant files should be in: ${src_dir}/${cheatsheet_dir}/${cheatsheet_key}.tex
  example: Euler formula
  example2: A sequence

# Code style config, will be used in linting and compiling PDF
default_code_style: common
code_styles:
  # Should be formed in: ${extension_name}: ${code_style_name}
  C: cpp
  cc: cpp
  cp: cpp
  cpp: cpp
  CPP: cpp
  c++: cpp
  cxx: cpp
  H: cpp
  hh: cpp
  hp: cpp
  h++: cpp
  hpp: cpp
  HPP: cpp
  hxx: cpp

# Compiling test code command config, ${filename} is the name of file that will be compiled
test_commands:
  cpp:
  - g++
  - ${filename}

# Linting command config, ${filename} is the name of file that will be linted
formatting_commands:
  cpp:
    - clang-format
    - -style=file
    - -i
    - ${filename}

tinplate's People

Contributors

tiphereth-a avatar

Stargazers

 avatar  avatar

Watchers

 avatar

tinplate's Issues

Command '['bibtex', 'notebook.bib']' returned non-zero exit status 1.

When I clone this repository and run the program, an error occurs.

OS: Ubuntu 22.04
Python: 3.10.4
LaTeX: TeX Live 2022

The detailed log is as follows:

ยป python manager.py run
2022-05-15 18:24:16 INFO manager.py::reformat_all_codes [1655] 2 file(s) found
2022-05-15 18:24:16 INFO manager.py::reformat_all_codes [1655] finished
2022-05-15 18:24:16 INFO manager.py::generate_notebook_contents [1655] 1 chapter(s) found
2022-05-15 18:24:16 INFO manager.py::generate_notebook_contents [1655] 1 section(s) found in config
2022-05-15 18:24:16 INFO manager.py::load_from [1655] 1 file(s) found
2022-05-15 18:24:16 INFO manager.py::load_from [1655] 1 file(s) found
2022-05-15 18:24:16 INFO manager.py::generate_notebook_contents [1655] 1 section(s) generated from existing files
2022-05-15 18:24:16 INFO manager.py::generate_notebook_contents [1655] 1 section(s) in total
2022-05-15 18:24:16 INFO manager.py::generate_cheatsheet_contents [1655] 2 file(s) found:
2022-05-15 18:24:16 INFO manager.py::compile_all [1655] step 1 / 4
------------------------------------------------------------------------------------------------------------------------
This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./notebook.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-04-29> (./ICPCnotebook.cls
Document Class: ICPCnotebook 2022/05/15 v0.1 Template class of Tifa's ICPC Note
book
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/report.cls
Document Class: report 2021/10/04 v1.4n Standard LaTeX document class
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2022/texmf-dist/tex/latex/algorithms/algorithm.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/float/float.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/ifthen.sty))
(/usr/local/texlive/2022/texmf-dist/tex/latex/algorithmicx/algpseudocode.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/algorithmicx/algorithmicx.sty
Document Style algorithmicx 1.2 - a greatly improved `algorithmic' style
)
Document Style - pseudocode environments for use with the `algorithmicx' style
) (/usr/local/texlive/2022/texmf-dist/tex/latex/amsfonts/amsfonts.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsfonts/amssymb.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/amscls/amsthm.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/geometry/geometry.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/iftex/ifvtex.sty
(/usr/local/texlive/2022/texmf-dist/tex/generic/iftex/iftex.sty)))
(/usr/local/texlive/2022/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2022/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
(/usr/local/texlive/2022/texmf-dist/tex/generic/infwarerr/infwarerr.sty))
(/usr/local/texlive/2022/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pdfescape/pdfescape.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/hycolor/hycolor.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/letltxmacro/letltxmacro.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/auxhook/auxhook.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/kvoptions/kvoptions.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2022/texmf-dist/tex/generic/intcalc/intcalc.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/etexcmds/etexcmds.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/hyperref/puenc.def)
(/usr/local/texlive/2022/texmf-dist/tex/latex/url/url.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/bitset/bitset.sty
(/usr/local/texlive/2022/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty))
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/atbegshi-ltx.sty))
(/usr/local/texlive/2022/texmf-dist/tex/latex/hyperref/hxetex.def
(/usr/local/texlive/2022/texmf-dist/tex/generic/stringenc/stringenc.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/atveryend-ltx.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty
))) (/usr/local/texlive/2022/texmf-dist/tex/latex/tools/multicol.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/listings/listings.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/listings/lstmisc.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/listings/listings.cfg))
(/usr/local/texlive/2022/texmf-dist/tex/latex/pdflscape/pdflscape.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/lscape.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2022/texmf-dist/tex/latex/graphics-def/xetex.def))))
(/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.te
x
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-li
sts.tex))
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/pgf.revision.tex)))
(/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/graphicx.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
ode.tex))
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-xetex.de
f
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx
.def
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-p
df.def))))
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.
code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.
code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/graphics-cfg/color.cfg))
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.
tex
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic
.code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigo
nometric.code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.rando
m.code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.compa
rison.code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.
code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round
.code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.
code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integ
erarithmetics.code.tex)))
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)
) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfint.code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.co
de.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconst
ruct.code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage
.code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.co
de.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicst
ate.code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransform
ations.code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.cod
e.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.c
ode.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathproce
ssing.code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.co
de.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.cod
e.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.cod
e.tex
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.
code.tex))
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.co
de.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretranspare
ncy.code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.
code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorerdf.code.
tex)))
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.cod
e.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.
tex)
(/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version
-0-65.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version
-1-18.sty))
(/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/utilities/pgffor.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex)
) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/math/pgfmath.sty
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex))
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)))
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.cod
e.tex
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothan
dlers.code.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.cod
e.tex)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/librarie
s/tikzlibrarytopaths.code.tex)))
(/usr/local/texlive/2022/texmf-dist/tex/latex/tocloft/tocloft.sty))
(/usr/local/texlive/2022/texmf-dist/tex/latex/l3backend/l3backend-xetex.def)
No file notebook.aux.
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/ts1cmr.fd)
*geometry* driver: auto-detecting
*geometry* detected driver: xetex
(/usr/local/texlive/2022/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/refcount/refcount.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/gettitlestring/gettitlestring.s
ty))

Package hyperref Warning: Rerun to get /PageLabels entry.

(/usr/local/texlive/2022/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsfonts/umsb.fd) [1] [1]
(./_gen/contents_notebook.tex
Chapter 1.
(./src/doc/example/helloworld.tex)
(/usr/local/texlive/2022/texmf-dist/tex/latex/listings/lstlang1.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/listings/lstlang1.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/listings/lstmisc.sty)
(./src/code/example/helloworld.hpp)) (./_gen/contents_cheatsheet.tex [1]
Chapter 2.
(./src/cheatsheet/example.tex) (./src/cheatsheet/example2.tex))
No file notebook.bbl.
[2] (./notebook.aux)

LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.


Package rerunfilecheck Warning: File `notebook.out' has changed.
(rerunfilecheck)                Rerun to get outlines right
(rerunfilecheck)                or use package `bookmark'.

 )
(see the transcript file for additional information)
Output written on notebook.pdf (4 pages).
SyncTeX written on notebook.synctex.gz.
Transcript written on notebook.log.
2022-05-15 18:24:16 INFO manager.py::compile_all [1655] step 2 / 4
------------------------------------------------------------------------------------------------------------------------
I couldn't open file name `notebook.bib.aux'
Traceback (most recent call last):
  File "/home/agoh/TINplate/manager.py", line 251, in <module>
    cli()
  File "/home/agoh/miniconda3/envs/TINplate/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/agoh/miniconda3/envs/TINplate/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/agoh/miniconda3/envs/TINplate/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/agoh/miniconda3/envs/TINplate/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/agoh/miniconda3/envs/TINplate/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/agoh/TINplate/manager.py", line 188, in _compile
    compile_all(no_fmt, no_gen, clean)
  File "/home/agoh/TINplate/libs/decorator.py", line 9, in inner
    return_val = func(*args, **kwargs, logger=logger)
  File "/home/agoh/TINplate/manager.py", line 176, in compile_all
    subprocess.run(now_proc, encoding='utf8', check=True)
  File "/home/agoh/miniconda3/envs/TINplate/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['bibtex', 'notebook.bib']' returned non-zero exit status 1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.