diff --git a/README.md b/README.md index 4548f565bb08a4c369f9c478b2c4dc4ed66105d5..b95660fe709cfe4ad987378a27d56f0ed32b8d27 100644 --- a/README.md +++ b/README.md @@ -57,11 +57,18 @@ And the generated PDF file looks like this: Don't worry about the label in the upper-left corner: you can just turn it off with the LaTeX switch. +Next, go to the `osvgs` folder. It will contain an image called `myoverlay.svg` (remember this was our label name). + - -to start a beamer project. Edit index.tex (see how you add overlays in the file) and after you edit the overlay `.svg` files, run +At the start, this file contains all the LaTeX contents as editable `svg` contents which we can move around (for instance by rotating the text), and we can add +free-hand drawings to the slide. The bottom layer of the image will always be a non-editable layer containing the **actual** LaTeX content of the slide (in this case the logo and text). You can use this for reference when you edit. When you are happy, simply save the file and re-run ```terminal -slider.py index.tex +python -m slider index.tex ``` -to update the overlays. Note the overlay `.svg` files by default contains all the text in the slide they are imported from. This is helpful -if you want to move elements around. You can always add new overlays by using the '\osvg{my_label}' command in LaTeX. \ No newline at end of file +(it will automatically try to detect the `index.tex` if run without arguments). This will keep all layers up to date, flatten fonts and generally just make sure everything is okay. +You can find the output in the `examples/basic1` folder and the `pdf` file will now look as follows: + + + +- You can add new overlays at any point by inserting a '\osvg{my_label}' command in your LaTeX document +- Overlay-images with multiple layers are automatically converted into '\pause'-frames in LaTeX \ No newline at end of file diff --git a/docs/README.jinja.md b/docs/README.jinja.md index 479ec0792f66568c9557da157b429d94fa30ccfe..e1de0dbd955d8670c296c38e62de031af39eafce 100644 --- a/docs/README.jinja.md +++ b/docs/README.jinja.md @@ -35,11 +35,18 @@ And the generated PDF file looks like this: Don't worry about the label in the upper-left corner: you can just turn it off with the LaTeX switch. +Next, go to the `osvgs` folder. It will contain an image called `myoverlay.svg` (remember this was our label name). + - -to start a beamer project. Edit index.tex (see how you add overlays in the file) and after you edit the overlay `.svg` files, run +At the start, this file contains all the LaTeX contents as editable `svg` contents which we can move around (for instance by rotating the text), and we can add +free-hand drawings to the slide. The bottom layer of the image will always be a non-editable layer containing the **actual** LaTeX content of the slide (in this case the logo and text). You can use this for reference when you edit. When you are happy, simply save the file and re-run ```terminal -slider.py index.tex +python -m slider index.tex ``` -to update the overlays. Note the overlay `.svg` files by default contains all the text in the slide they are imported from. This is helpful -if you want to move elements around. You can always add new overlays by using the '\osvg{my_label}' command in LaTeX. \ No newline at end of file +(it will automatically try to detect the `index.tex` if run without arguments). This will keep all layers up to date, flatten fonts and generally just make sure everything is okay. +You can find the output in the `examples/basic1` folder and the `pdf` file will now look as follows: + + + +- You can add new overlays at any point by inserting a '\osvg{my_label}' command in your LaTeX document +- Overlay-images with multiple layers are automatically converted into '\pause'-frames in LaTeX \ No newline at end of file diff --git a/docs/basic1_nup.pdf b/docs/basic1_nup.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2488476fd60b8d030871d73ffe90ab7b29d0f465 Binary files /dev/null and b/docs/basic1_nup.pdf differ diff --git a/docs/basic1_nup.png b/docs/basic1_nup.png new file mode 100644 index 0000000000000000000000000000000000000000..4beb9d2fca49bf6fc72052a795c710551f0988a3 Binary files /dev/null and b/docs/basic1_nup.png differ diff --git a/docs/build_docs.py b/docs/build_docs.py index 311b89ac790e1899add22f7cc219660bb72f778a..16593ac94b6907dd9df507db7a2e2443048dc4fe 100644 --- a/docs/build_docs.py +++ b/docs/build_docs.py @@ -28,18 +28,17 @@ if __name__ == "__main__": base = os.path.basename(dir) out = beamer_nup(path, output="./" + base + "_nup.pdf", nup=2) - out_png = convert.pdf2png(out) + out_png = convert.pdf2png(out, scale_to=600) print(out_png) - a =234 - pass - my_nup(np + "/index.pdf") + my_nup(f"{np_basic1}/index.pdf") + convert.pdf2png(np + "/index.pdf", "./index0.png") output = np +"/index_2up.pdf" - data = {} + data['resources'] = 'https://gitlab.compute.dtu.dk/tuhe/slider/-/raw/main' with open(np + "/index.tex", 'r') as f: data['basic0_tex'] = f.read() diff --git a/docs/new_project_nup.pdf b/docs/new_project_nup.pdf index e14ce4ce14bfb132fa3d9c085ca13363dd7efcba..5725b6b022a9968db54ec444f10c98ed6f32eaa4 100644 Binary files a/docs/new_project_nup.pdf and b/docs/new_project_nup.pdf differ diff --git a/docs/new_project_nup.png b/docs/new_project_nup.png index 405ca49aff4f4c910fad6d697d6cece6401e8bd8..093273cf64fe917dc43498cfed97f905a3635593 100644 Binary files a/docs/new_project_nup.png and b/docs/new_project_nup.png differ diff --git a/src/slider/__pycache__/convert.cpython-38.pyc b/src/slider/__pycache__/convert.cpython-38.pyc index 6e3612de345e28c7903cf3bab83ab37188e124d2..8836bad5b632e5584653df811c70e05fa4474cb9 100644 Binary files a/src/slider/__pycache__/convert.cpython-38.pyc and b/src/slider/__pycache__/convert.cpython-38.pyc differ diff --git a/src/slider/convert.py b/src/slider/convert.py index 46abe13f49d7756c3a060151db117c18b397db0a..61b85ca74723d2757bbffefbe129a21f2953c6dd 100644 --- a/src/slider/convert.py +++ b/src/slider/convert.py @@ -51,11 +51,13 @@ def pdf2svg(fin, fout, page_no=None): execute_command(cmd) -def pdf2png(fin, fout=None): +def pdf2png(fin, fout=None, scale_to=None): if fout is None: fout = fin[:-4] + ".png" fout = fout[:-4] cmd = f"pdftocairo -png -singlefile {fin} {fout}" + if scale_to is not None: + cmd += f" -scale-to {scale_to}" execute_command(cmd.split()) return fout + ".png" diff --git a/src/slider/jinjastrings/__pycache__/generated.cpython-38.pyc b/src/slider/jinjastrings/__pycache__/generated.cpython-38.pyc index 7f7e7acb4e31d439bcf592a7de3e64f6d81ddbde..58c8f2186bb13216ad5fc88b60674f84f90388b8 100644 Binary files a/src/slider/jinjastrings/__pycache__/generated.cpython-38.pyc and b/src/slider/jinjastrings/__pycache__/generated.cpython-38.pyc differ