diff --git a/docs/advanced/pdf.md b/docs/advanced/pdf.md index 3ae1deaf0ab21e938bce2ad4f2580e7710cf0057..942e694d3d39f83709ee5a6b146868b20af1b094 100644 --- a/docs/advanced/pdf.md +++ b/docs/advanced/pdf.md @@ -74,7 +74,7 @@ You can also use Latex to build a PDF of your book. This can behave differently operating system and setup. This section tries to recommend a few best-practices. The default is to build your project as a single PDF file, however it is possible to build -individual PDF files for each page of the project by enabling the `--individualfiles` option +individual PDF files for each page of the project by enabling the `--individualpages` option when using the `pdflatex` builder. ### Installation @@ -113,5 +113,5 @@ jb build mybookname/ --builder latex ``` To build PDF files for each page of the project then you can specify the -option `--individualfiles`. The individual PDF files will be available in the +option `--individualpages`. The individual PDF files will be available in the `latex` build folder and will have the same document name as the source file. diff --git a/jupyter_book/commands/__init__.py b/jupyter_book/commands/__init__.py index 454c95b6b3bad1743da5d152b4dad89923d9b462..327ca353841029d73b49e4200c25292e427c365e 100644 --- a/jupyter_book/commands/__init__.py +++ b/jupyter_book/commands/__init__.py @@ -58,13 +58,13 @@ BUILDER_OPTS = { type=click.Choice(list(BUILDER_OPTS.keys())), ) @click.option( - "--individualfiles", + "--individualpages", is_flag=True, default=False, help="[pdflatex option] Enable build of PDF files for each individual page", ) def build( - path_book, path_output, config, toc, warningiserror, builder, individualfiles + path_book, path_output, config, toc, warningiserror, builder, individualpages ): """Convert your book's content to HTML or a PDF.""" # Paths for our notebooks @@ -99,17 +99,17 @@ def build( raise ValueError(f"Config file path given, but not found: {path_config}") # Builder-specific configuration - if individualfiles: + if individualpages: if builder != "pdflatex": _error( """ - Specified option --individualfiles only works with the + Specified option --individualpages only works with the following builders: pdflatex """ ) - latexoverrides["latex_individualfiles"] = True + latexoverrides["latex_individualpages"] = True # Builder-specific overrides if builder == "pdfhtml": diff --git a/jupyter_book/sphinx.py b/jupyter_book/sphinx.py index 97ac8c0238a11557d727ab2b557bd2b40ae8a851..e873bdaabec58bb1f13722c1efbb75f5101cdb2d 100644 --- a/jupyter_book/sphinx.py +++ b/jupyter_book/sphinx.py @@ -222,10 +222,10 @@ def build_sphinx( ) app.config.latex_documents = latex_documents - # Apply Latex Overrides for auto latex_individualfiles option + # Apply Latex Overrides for auto latex_individualpages option if ( latexoverrides is not None - and "latex_individualfiles" in latexoverrides.keys() + and "latex_individualpages" in latexoverrides.keys() ): from .pdf import autobuild_singlepage_latexdocuments diff --git a/tests/test_pdf.py b/tests/test_pdf.py index ca0957b55a419bb4c93ba14cea53fdcfcfb369d1..ef9ba970096b0cf3b7ef0d8aba17d7803e2b07a0 100644 --- a/tests/test_pdf.py +++ b/tests/test_pdf.py @@ -27,11 +27,11 @@ def test_pdflatex(tmpdir): assert path_pdf.joinpath("book.pdf").exists() -def test_pdflatex_individualfiles(tmpdir): +def test_pdflatex_individualpages(tmpdir): path_output = Path(tmpdir).absolute() path_template = path_tests.parent.joinpath("jupyter_book", "book_template") cmd = f"jb build {path_template} --path-output {path_output} \ - --builder pdflatex --individualfiles" + --builder pdflatex --individualpages" run(cmd.split(), check=True) path_pdf = path_output.joinpath("_build", "latex") assert path_pdf.joinpath("book.pdf").exists() @@ -42,11 +42,11 @@ def test_pdflatex_individualfiles(tmpdir): # assert path_pdf.joinpath("intro.pdf").exists() -def test_pdflatex_individualfiles_nested(tmpdir): +def test_pdflatex_individualpages_nested(tmpdir): path_output = Path(tmpdir).absolute() path_template = path_tests.joinpath("books", "nested") cmd = f"jb build {path_template} --path-output {path_output} \ - --builder pdflatex --individualfiles" + --builder pdflatex --individualpages" run(cmd.split(), check=True) path_pdf = path_output.joinpath("_build", "latex") assert path_pdf.joinpath("index.pdf").exists()