Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cambridge latex style #56

Merged
merged 14 commits into from
Aug 3, 2022
Merged

add cambridge latex style #56

merged 14 commits into from
Aug 3, 2022

Conversation

cheungdaven
Copy link
Member

add Cambridge latex style.
We can use the following command to invoke the Cambridge latex:
d2lbook build pdf --style cambridge

@cheungdaven cheungdaven requested a review from astonzhang July 8, 2022 20:46
@cheungdaven
Copy link
Member Author

The latex function is ready for review. @astonzhang

@astonzhang astonzhang self-assigned this Jul 8, 2022
(1) add automatic QR code generation footnote; (2) change code and text font style; (3) reduce the figure size, and fix some style issues.
d2lbook/build.py Outdated Show resolved Hide resolved
d2lbook/build.py Outdated Show resolved Hide resolved
@astonzhang
Copy link
Member

Besides, please sync changes (e.g., different background colors for input code cells and output code cells) from the master branch with updated environment (e.g., Sphinx 5.1.1 and sphinxcontrib-bibtex 2.4.2).

d2lbook/build.py Outdated
@@ -356,6 +388,9 @@ def linkcheck(self):
@_once
def pdf(self):
self.rst()
if self.config.pdf['style'] is not None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not equal to 'Default'?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to == 'cambridge'

latex_url =

# Specify the latex style. We now support "cambridge" and the defaut sphinx style.
style =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you set the default value here?So users don't need to specify style = Default if they use default style.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they actually do not need to put a default there. it can be empty.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that leaving it empty without any arbitrary default string is better

@@ -5,14 +5,17 @@

__all__ = ['prepare_sphinx_env']

def prepare_sphinx_env(config):
env = SphinxEnv(config)
def prepare_sphinx_env(config, style):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove style argument? See

prepare_sphinx_env(self.config)

def prepare_sphinx_env(config):
env = SphinxEnv(config)
def prepare_sphinx_env(config, style):
env = SphinxEnv(config, style)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove style argument

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@astonzhang
Copy link
Member

Thanks for adding this new feature!

@astonzhang astonzhang merged commit 6515e2b into d2l-ai:master Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants