jckantor / nbpages

Command line tool to maintain a repository of Jupyter notebooks.
https://jckantor.github.io/nbpages/
MIT License
1 stars 4 forks source link

How to handle references? #21

Open adowling2 opened 4 years ago

adowling2 commented 4 years ago

End goal: extend "tags" with chapter and section.

adowling2 commented 4 years ago

@jckantor Document how the tag would work with cross-referencing.

Idea: Create individual tags for each book subsection. For example, navidi-4e::3.1 for section 3.1 in the 4th edition of Navidi.

adowling2 commented 4 years ago

Discussed a macro feature for adding section names into a reference list for the book. Add this information to put into a seperate .cfg file such as textbook_references.cfg.

adowling2 commented 4 years ago

Two possible approaches:

  1. LaTeX way: create a label and refer to the label.
  2. With tags: tag cells, create a central reference.

With tags, we want a "specialized" index of references. For example, navidi-4e::something means navidi-4e book.

Specialized tag index display (HTML) would look like this:

William Navidi (2015), Probability and Statistics for Scientists and Engineers:

Need: references database with:

The base tag could be a bibtex reference/label.

references.txt would be the database.

adowling2 commented 4 years ago

This is a hierachical index. This would be abstracted to each level of the hierachy has an additional explanation string.

adowling2 commented 4 years ago

When building the tag index, first handle all non-hierachical tags. Then process hierachical tags.

jckantor commented 4 years ago

I put together a little proof of concept. Look at https://jckantor.github.io/nbpages/02.06-Heirarchical-Tagging.html This shows what the tags might look like, some typical processing, and a proposal on how to link with references. The idea is that the references would be in a json file or python dictionary.

The idea is that

author::Felder-Rousseau-Bullard::Chapter-3 author::Felder-Rousseau-Bullard::Page-22

would all match a reference given as

author::Felder-Rousseau-Bullard

So the reference would match up with all keys sharing the same stem. The initial author is optional. It's there if you want to create multiple types of indices, for example

exercise::Problem-1 code-example::differential-equations::nonlinear code-example::differential-equations::linear concept::mass-balance

What do you think? Would that capture what you had in mind?

jckantor commented 4 years ago

Ha ... got it. What we're doing is merging tags. So imagine you have a bunch of cells. Some are tagged

Author::Felder-Rousseau-Bullard::Chapter-3 Author::Felder-Rousseau-Bullard::Chapter-2

and many more. The tag index stores links to these cell. But for cells tagged

Author::Felder-Rousseau-Bullard::

(note the terminal ::) it is the content of the cell are copied into the index. What ever is stored in the cell is written directly in the tag index. That could include a title line for an author or exercise index. It also could include bibliographic strings.

With this mechanism references can be distributed throughout the notebooks, no special files required. Pretty nifty.

adowling2 commented 4 years ago

@jckantor Cool! Here are some thoughts:

adowling2 commented 4 years ago

Would it be feasible to define shortcut labels? For example, in a tab-separated bib file, the user could specify 'FRB' should be replaced with 'Author::Felder-Rousseau-Bullard::'?

jckantor commented 4 years ago

You can always create a list of current tags with nbpages --tags.

Multiple books

Smith::Book-1:Chapter-1 Smith::Book-2:Chapter-3

The bibliographic entries would be in

Smith::Book-1:: Smith::Book-2::

The index would whatever tags are being used. So section numbers, page numbers, doesn't matter. Extends to problems just fine. For example, to create a homework set, use tag

Homework::10::

for a cell to print at the top. Then tag the cells you want to include in the homework at

Homework::10::Problem-1 Homework::10::Problem-2

etc.