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

Make it possible to duplicate exercises and/or solutions #11

Open
choldgraf opened this issue Oct 8, 2020 · 9 comments
Open

Make it possible to duplicate exercises and/or solutions #11

choldgraf opened this issue Oct 8, 2020 · 9 comments
Labels
enhancement New feature or request

Comments

@choldgraf
Copy link
Member

I believe that @jni mentioned it is common for them to have exercises in individual chapters and additionally at the end of a book. I think that's a pretty common pattern across fields. It would be nice if authors could write one exercise / solution and then be able to display both elsewhere without creating new labels etc.

I wonder if we could just add this as a keyword to the directives, something like:

```{exercise}
:copy: somelabel
```

and it would look for an exercise node of label somelabel and, if so, copy / paste it into the new location (perhaps with a link that points to the original)

@najuzilu
Copy link
Member

This is easily doable - but the user would have to keep track of all the exercise labels and would have to create a new directive for every exercise they want to copy in the new location. Would it make more sense to simply include all?

@choldgraf
Copy link
Member Author

hmmm - I could see either one being useful, though am not sure what the most-common approach would be. Perhaps @jni has thoughts as I think the elegant SciPy book does this

@jni
Copy link

jni commented Oct 13, 2020

I'm in the copy-all-directive camp, and agree with @najuzilu that it would be painful to have to keep track of each label. (Totally not my forte in any case. 😂) In Elegant SciPy we copy everything. Specifically:

  • the exercises and solutions are both run in their context notebook. The are marked by nested tags essentially as: <exercise> EX <solution> SOL </solution> </exercise>.
  • then we grab the stuff between the <exercise> tags and copy it to the appendix.
  • then we remove the stuff between the <solution> tags from the source chapters.

@choldgraf
Copy link
Member Author

sounds good - then maybe we start with a single "copy all" directive, and if folks ask for single-exercise directives in the future, we can consider adding them then?

@najuzilu
Copy link
Member

I would envision this looking something like

```{copy-exercises}
:include-solutions:
```

We can also introduce a copy-solutions directive which will only copy the solutions.

@choldgraf
Copy link
Member Author

that seems pretty reasonable to me! What does @jni @jstac @mmcky think?

@jni
Copy link

jni commented Oct 15, 2020

Personally I think it should be only

```{copy-solutions}
:include-exercises:
```

I see clear use case for copying only solutions, or solutions + exercises, but not so much for copying the exercises only. Right?

@choldgraf
Copy link
Member Author

choldgraf commented Oct 15, 2020

Good point @jni ,I think copying all solutions will be more common but I could be wrong! What does quantecon do @jstac ?

@jstac
Copy link
Member

jstac commented Oct 15, 2020

We don't have a consistent approach yet. I like the system that @jni is suggesting. It would be great to have this available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants