Opened 11 years ago

Closed 8 years ago

Last modified 7 years ago

#2304 closed enhancement (fixed)

OMNotebook: displaying equations

Reported by: Lennart Ochel Owned by: arunkumar palanisamy
Priority: high Milestone:
Component: OMNotebook Version: trunk
Keywords: Cc:

Description

In order to document something it is often helpful to write equations. Is it possible to improve this in OMNotebook with some kind of latex integration (or similar)?

Change History (31)

comment:1 by Martin Sjölund, 11 years ago

Milestone: 1.9.01.9.1

Postponed until 1.9.1

comment:2 by Martin Sjölund, 10 years ago

Milestone: 1.9.11.9.2

This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).

comment:3 by Martin Sjölund, 10 years ago

Milestone: 1.9.21.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:4 by arunkumar palanisamy, 9 years ago

Can you elaborate the question, with an example. how the OMNotebook should function?

comment:5 by Adeel Asghar, 9 years ago

Owner: changed from Adeel Asghar to arunkumar palanisamy
Status: newassigned

comment:6 by Lennart Ochel, 9 years ago

OMNotebook has different kind of cells, e.g. text cells to document the sheet. It would be good to have also something like a latex cell for advanced documentation and writing equations in a mathematical way.

Last edited 9 years ago by Lennart Ochel (previous) (diff)

comment:7 by arunkumar palanisamy, 9 years ago

Added support to add new cell namely LatexCells, Add the Tex script in the cells and evaluate, The ouptut is reported as an image, Each Latex cell accepts a maximum of 1 page output.

comment:8 by Lennart Ochel, 9 years ago

I tested the new latexcells and they work quite well.
In order to make this a useful feature, it is in my opinion necessary to hide the latex source most of the time. Latexcells will be used for documentation and displaying the source together with the output is not really helpful and will clutter up the worksheets too much.
Can you change it so that the latex source is only displayed if a cell is selected or not yet evaluated? Otherwise the generate image or the error message should be displayed.

comment:9 by arunkumar palanisamy, 9 years ago

Then what about when saving the document, should the Latex source be saved or not for successfully evaluation, I think it will have problems in saving and opening the files with the same style when it was saved. If we hide the latex source for successful evaluation when saving the document the choice has to be made whether the latex source should be saved or not, if we don't want to save the latex source then, when opening the saved file we can see the images but not the Latex source so the users cannot do any further modification of the output. The save and open operation works on XMl parsing of the created data structures

comment:10 by Adeel Asghar, 9 years ago

The Latex source should always be there and should be saved to the file. Its only that we graphically show/hide it depending on the output/evaluation.

comment:11 by Martin Sjölund, 9 years ago

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:12 by arunkumar palanisamy, 9 years ago

Added functionality to hide the Latex source, After evaluation only the output part is shown. To get back to the latex source for further modification, a small button is added to the right top corner of output cell, click on the button to get the latex source. Also Latex cells has to be evaluated individually as peter suggested.

comment:13 by Lennart Ochel, 9 years ago

To make this even more valuable one could define a template latex frame. This could be defined hard coded or even better as editable template in the settings. Therewith, a user would just need to define the actual latex code that should be displayed without adding the latex frame for each latex cell (which will probably always the same).

comment:14 by arunkumar palanisamy, 9 years ago

I cannot understand what you are saying,

comment:15 by Lennart Ochel, 9 years ago

What I meant is that you have to always define a latex header and footer at the moment. I see no good reason to copy that into each latex cell. Wouldn't it be better to store it in the global OMNotebook settings? Then it would be enough to just write the equations itself (e.g. $$a^2+b^2=c^2$$) into the latex cells. There could be also an option to disable the global latex header/footer in case that one like to copy it into each latex cell.

Example header:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{geometry}
\geometry{a4paper, left=30mm, right=30mm, top=0mm, bottom=0mm} 
\begin{document}

Example footer:

\end{document}

comment:16 by Lennart Ochel, 9 years ago

BTW: It seems that the latex source (and the error log) defines the latex cell height. It would be good if it would be adjusted if the latex output is displayed. If the output is smaller than the source, then there is a lot of white space following the output and if the output is larger than the source, then the output is just displayed partially.

comment:17 by arunkumar palanisamy, 9 years ago

It is because, the input(latex source) is hiding behind the output, and the input and output together form the cell height, So the input cell area determines the height of the output,you can adjust the input layout to fix the height of the output.Even in the pdf layout of latex generation there is empty space

comment:18 by arunkumar palanisamy, 9 years ago

Did some manipulation to display the image in the top left position of the output cell, So all the empty space surrounding the image is removed with only cropped contents as a box, Now you can always see the output aligned to the top left even if it is a single line. From this view you can have more control with the documentation and adjust the layout.

comment:19 by arunkumar palanisamy, 9 years ago

Improved the hiding of latex source without the use of buttons, now after the evaluation, the latex source will hide below the output, To see the latex source, double click on tree view of latex cells , like when you select the cells with single click, u should double click to see the latex source, also made some manipulations to automatic height adjustments according to output.

comment:20 by Lennart Ochel, 9 years ago

The new latex cells are quite nice. But unfortunately I cannot reevaluate a latex cell as long as the source is selected. At the moment you have to select the old output and press [shift]+[enter]. That's not very intuitive.

comment:21 by arunkumar palanisamy, 9 years ago

No the cells are always evaluated or reevaluated, regardless whether you select the source or simply click on the latex cell output and press the eval button. If you do not make any changes to the latex script and press the eval button, the same output will be there so you are unable to see the changes, but in the background the cell is always evaluated and new output is displayed, if you make changes to the script and evaluate the cells then you can see the changes which is truly a reevaluation. Note the latex cells cannot be evaluated through eval_all functionality.

comment:22 by Henning Kiel, 9 years ago

Latex Cells are great.

I have just two problems with it:

  1. (Here, onn OS-X) it does not find "latex" command, because for some reason, when starting the OMNotebook.app Latex is not on the path. When started from command line (where latex is on the path), it works fine.
  1. As already mentioned before it is very useless and annoying that you have to type a whole Latex document including "\documentclass{article}\begin{document}" and "\end{document}"

Solutions:

  1. Add a preference to OMNotebook where you can (optionally) select a path at which latex command is searched for.
  1. Automatically add a standard latex framework to the text, so that you can simply have
    $ \ddot{y}+2\dot{y}-y=\sin(x) $
    

comment:23 by Henning Kiel, 9 years ago

I just committed code to fix the two problems I stated before: https://github.com/OpenModelica/OMNotebook/commit/e10801e516f05b88ddd77c795f771f7721736bea

The first is a special OS X hack to add /usr/texbin to the PATH, because it is not present if you double click the OMNotebook App (but it IS there when called from command line)

The second checks if "\begin{document}" is missing and adds \documentclass{article}\begin{document}\thispagestlye{empty} at the front and \end{document} at the end.
So, now you can open a latex cell and just type $a_1$

comment:24 by arunkumar palanisamy, 9 years ago

Perfect, Thanks for the fix, I am working on windows operating system and i checked your commit everything is working fine

comment:25 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.5

Milestone pushed to 1.9.5

comment:26 by Martin Sjölund, 9 years ago

Milestone: 1.9.51.10.0

Milestone renamed

comment:27 by Christoph <buchner@…>, 8 years ago

Hm, can't this ticket be closed?

in reply to:  27 comment:28 by arunkumar palanisamy, 8 years ago

Yes this ticket can be closed

comment:29 by Lennart Ochel, 8 years ago

Resolution: fixed
Status: assignedclosed

comment:30 by Henning Kiel, 8 years ago

When printing a re-opened onb file the evaluated Latex output is not shown, though it is displayed correctly on the screen. (see ticket:3712)

comment:31 by Martin Sjölund, 7 years ago

Milestone: 1.10.0

Milestone deleted

Note: See TracTickets for help on using tickets.