Skip to content

Add a "LaTeX Citations" tab to the entry editor#5155

Merged
LinusDietz merged 52 commits into
masterfrom
latexintegration
Aug 9, 2019
Merged

Add a "LaTeX Citations" tab to the entry editor#5155
LinusDietz merged 52 commits into
masterfrom
latexintegration

Conversation

@davidemdot

@davidemdot davidemdot commented Jul 30, 2019

Copy link
Copy Markdown
Member

This pull request adds a LaTeX Citations tab to the entry editor, to search for citations to the active entry in the LaTeX file directory (it can be configured in the Library properties dialog).

The new tab can be disabled in the preferences.


Summary of changes

An improved back-end

  • Optimized parsing performance
  • Non-existing nested files are skipped
  • Better exception handling

The new tab

  • New tab in the entry editor: LaTeX Citations
  • This tab could be disabled in the entry editor preferences
  • A progress indicator appears while parsing
  • Search cancellation if the active entry is changed (background tasks)
  • Parsed files are stored when the tool is run for the first time (much better performance)
  • The current search path is shown at the bottom, next to a button to change the LaTeX file directory
  • Error logging and handling (some of them are shown in the entry editor)

A custom user interface controller for listing citations

  • Citations list view is the same for dialog tool and tab (CitationsDisplay)
  • Context of citations, instead of the full line (which is shown as a tooltip)
  • Changed absolute file path to a relative one, from the search path
  • New icons and styles for context, file path and position (line and column) of a citation

Miscellaneous

  • Updated EntryEditor class for injecting dependencies and fixing minor bugs
  • Renamed tool: LaTeX Citations instead of LaTeX references

That is how it works

latexcitations


  • Change in CHANGELOG.md described
  • Manually tested changed features in running JabRef
  • Screenshots added in PR description (for bigger UI changes)
  • Ensured that the git commit message is a good one

davidemdot and others added 30 commits May 31, 2019 02:05
@LinusDietz

Copy link
Copy Markdown
Member

Hey @davidemdot, didn't check the code yet. Have tested the feature and it seems that the directory JabRef parses is my home directory. As a result I get the following error:
Screen Shot 2019-08-01 at 11 31 07

I guess the problem is somewhere here:
https://github.com/JabRef/jabref/pull/5155/files#diff-83e88d28f1ee5c44f11ec9e20bc30891R113

@davidemdot

Copy link
Copy Markdown
Member Author

Hey @LinusDietz!

Firstly, it tries to get the LaTeX file directory. If you did not configure it, it will search in your working directory (preferencesService.getWorkingDir()).

You can set the LaTeX file directory in the 'Library properties' dialog.

@LinusDietz

LinusDietz commented Aug 1, 2019

Copy link
Copy Markdown
Member

You can set the LaTeX file directory in the 'Library properties' dialog.

Okay, didn't know that.

  • My suggestion would be to display the current search path at the bottom of the tab and add a button to directly manipulate the LaTeX file directory.

  • The exception in the screenshot should be caught anyways and the directory should just be skipped in the parsing.

  • Another issue is that it seems that the whole LaTeX file directory is parsed each time the Entry Editor is opened or a different entry is selected. This takes about 10 seconds for me, which is too long for the feature to be useful. Can you cache the result of the parsing?

  • The implementation of the parsing follows the input{} commands of LaTeX. Every time a file is not found (due to whatever reason), an exception is thrown. Can you test for the existence of the file before reading it and issue a log message instead?

13:11:00.851 [pool-3-thread-4] ERROR org.jabref.logic.texparser.DefaultTexParser - Error opening a TEX file
java.nio.file.NoSuchFileException: /Users/dietzl/git/diss/presentations/docsem2018/../../corporate_design/Ressourcen/Praesentation/../../corporate_design/Ressourcen/Praesentation/Praeambel.tex

@davidemdot

Copy link
Copy Markdown
Member Author

Thanks for your feedback! I will work on it and tell you something as soon as possible.

@davidemdot davidemdot mentioned this pull request Aug 2, 2019
4 tasks
* Update for adding latest changes (no final version)

* Fix small issues

* Update for improving code

* Add localization keys

* Update styles

* Remove unused code and improve exceptions handling

* Add latest improvements
- Change CitationViewModel to CitationsDisplay.
- Improve styles and icons.
- Remove unused code.
@davidemdot

Copy link
Copy Markdown
Member Author

After latest changes, it looks like...

latexcitationstab

:"D

@LinusDietz LinusDietz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I really like the feature now! I have very few comments. I'd say we should merge this when those are addressed 🎉

Comment thread src/main/java/org/jabref/logic/texparser/DefaultTexParser.java Outdated
Comment thread src/main/java/org/jabref/logic/texparser/DefaultTexParser.java Outdated
@davidemdot

Copy link
Copy Markdown
Member Author

Good points, @LinusDietz. It is done!

Comment thread src/main/java/org/jabref/logic/texparser/DefaultTexParser.java Outdated
@davidemdot davidemdot added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Aug 6, 2019
@davidemdot davidemdot changed the title Add 'LaTeX Citations' tab to the entry editor Add a "LaTeX Citations" tab to the entry editor Aug 6, 2019

@Siedlerchr Siedlerchr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In general lgtm, just one question about the path in the test. Why did it change?


expectedParserResult.addKey(EINSTEIN_C, Paths.get("foo/bar"), 1, 0, 21, citeString);
expectedParserResult.addKey(EINSTEIN_A, Paths.get("foo/bar"), 1, 26, 47, citeString);
expectedParserResult.addKey(EINSTEIN_C, Paths.get(""), 1, 0, 21, citeString);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't understand the change here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it does not really matter.

@LinusDietz LinusDietz merged commit be8663a into master Aug 9, 2019
@LinusDietz

Copy link
Copy Markdown
Member

To move on with this I have merged the PR. Great work! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: entry-editor component: ui project: gsoc status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants