jupyter_latex_envs icon indicating copy to clipboard operation
jupyter_latex_envs copied to clipboard

update to notebook 5.0

Open chrisjsewell opened this issue 7 years ago • 5 comments

Hey, cool package, really interested for use with my https://chrisjsewell.github.io/ipypublish/

However I notice that its Compatibiilty specification (in the yaml) is only set to notebook 4.0. When I tested it out on a notebook 5.0 (via nbextensions) its been a little buggy in terms of resolving reference links (getting some ??) and citations:

  1. I have and @online citation which doesn't resolve
  2. I have an @article that resolves as (Kirkeminde and Ren, undefined) and I'm not sure what the undefined is meant to be
  3. The reference section says it can't find the bibliography (despite it resolving the above citation)

Not sure if this is related to the version change?

Cheers

chrisjsewell avatar Jul 10 '17 21:07 chrisjsewell

Hi yes, I shall update the yaml. I have tested it with notebook 5. without problems.

As noted in #22, it seems that there has been some regressions in some recent modifications that affects the bibliography. I will have a look as fast as I can, but I am quite busy these days. I would be helpful if you could upload somewhere a notebook + bib with reproducible issues. Also if you can detail the issue you mention in https://github.com/chrisjsewell/ipypublish/issues/6

Regarding your ipypublish package, we may certainly do something together (merging some ideas of ipypyblish in latex_envs and reciprocally).

jfbercher avatar Jul 10 '17 22:07 jfbercher

Regarding the issues in chrisjsewell/ipypublish#6, I don't seem to be able to replicate them now (maybe I upgraded a package in the interim), so don't worry about that. It's mainly the reference resolving fix that would be nice:

  • The simple example works
  • For the second example, I've copy/paseted the problem area below.
  • I'm using OS X Yosemite and my conda environment is listed at https://github.com/chrisjsewell/ipypublish/blob/master/conda_packages.txt
  • I actually use cleverref (e.g. \cref{fig:example}) for my referencing, so it would be good to have those resolved.
Property 1

If all the akak in equation (??????) of definition 1 are zero, then the filter has a finite impulse response.

Proof
Let δ[n]δ[n] denote the Dirac impulse. Take x[n]=δ[n]x[n]=δ[n] in (??????). This yields, by definition, the impulse response: 

The citations I talked about are from a bib just containing:

@online{_world_2015,
  title = {World {{Oil}} and {{Gas Review}} 2015 - {{Eni}}},
  url = {http://www.eni.com/en_IT/company/culture-energy/world-oil-gas-review/world-oil-gas-review-2015.shtml},
  timestamp = {2016-05-26T16:36:27Z},
  urldate = {2016-05-25},
  date = {2015},
  file = {...}
}

@article{kirkeminde_thermodynamic_2012,
  title = {Thermodynamic Control of Iron Pyrite Nanocrystal Synthesis with High Photoactivity and Stability},
  volume = {1},
  issn = {2050-7496},
  doi = {10.1039/C2TA00498D},
  abstract = {...},
  langid = {english},
  number = {1},
  journaltitle = {Journal of Materials Chemistry A},
  shortjournal = {J. Mater. Chem. A},
  author = {Kirkeminde, Alec and Ren, Shenqiang},
  urldate = {2017-06-18},
  date = {2012-11-29},
  pages = {49--54},
  file = {...}
}

chrisjsewell avatar Jul 11 '17 16:07 chrisjsewell

Yeh happy to collab (when we have the time!). I guess the dream is to have the ultimate hybrid of, for example, TexMaker/MS Word/Jupyter Notebook.

One thing that I would like to pick your brains on, since you have experience with nbextensions, is implementing chrisjsewell/ipypublish#1. How easy/hard it would be to have a button that, for instance, puts a coloured border around all cells that have a "latex_figure" key in their metadata or hides all cells that don't have it?

chrisjsewell avatar Jul 11 '17 17:07 chrisjsewell

Various updates

  • Compatibility is fixed in the yaml file, cf https://github.com/jfbercher/jupyter_latex_envs/commit/bb3795f027eed5881eaca1a17cea4af549bcd83d

  • Exotic references call. : enable to use \cref, \xref etc in addition to standard \ref, cf https://github.com/jfbercher/jupyter_latex_envs/commit/1ec2ec69c41cd03582082dc4188c624d6c37cb1b

  • reworked bibliography: references section and tags in the text are now updated immediately when the reference style is modified, see commits

    • cleanup / reset cit_table on reload https://github.com/jfbercher/jupyter_latex_envs/commit/5627686d368ff3158c5288396e039c9405e1e6c8
    • fix errors on some non existing fields, eg authors, in the bibtex file https://github.com/jfbercher/jupyter_latex_envs/commit/bdfd6a613363bda77981d172b2a3b9b714d6bb89
  • The other references errors were due to te fact that

  • (i) @online is not a standard bibtex field and the fallback to "unknown" didn't worked. This is corrected now. Notice that you can change citation style by editing the template at the beginning of latex_envs.js

  • (ii) date is not a standard bibtex field. The styles wait for month and year, so the "undefined" when you try to use the (author, year) format. I have added a small code to create the year field if it is not present but date; https://github.com/jfbercher/jupyter_latex_envs/commit/7e540bfe991d14190a8f4a99bdc43874af1581c0 and https://github.com/jfbercher/jupyter_latex_envs/commit/27873174703fd04fc5a79fcfe4b4ee0b75a1848b

  • Finally for the incorrect rendering of equation references, I realized that something may have change in the way MathJax inteprets $$.$$. Sometime ago this was treated as equivalent to \begin{equation} \end{equation}, which supports label; but this has changed and $$.$$ are not numbered anymore. It seems that I already realized that but only updated part of the documentation (not changed the $$.$$ in listings). I added code to automatically interpret $$.$$ as begin -end equation, see https://github.com/jfbercher/jupyter_latex_envs/commit/03ab296d4ec9b4ae72c6f8654f13811641720145. I still need to update the doc; then I will do a new release on Pypi.

jfbercher avatar Jul 22 '17 15:07 jfbercher

Yeh brilliant ta :)

FYI, for creating html reports/presentations in ipypublish, I created a 'simple' nbconvert preprocessor to handle latex tags: https://github.com/chrisjsewell/ipypublish/blob/master/ipypublish/preprocessors/latextags_to_html.py

Its obviously not as 'complete' as yours, handling whole equation environments etc. One thing I do a little differently is that, rather than have reference section, I simply use the doi or url field to create a hyperlink directly to the source.

See here for the outcome: https://chrisjsewell.github.io/ipypublish/Example.html#References-and-Citations

chrisjsewell avatar Jul 27 '17 12:07 chrisjsewell