Menu

#75 Allow editing iFormulas with an external editor

Next_Release
closed
None
1
2021-09-23
2020-11-14
No

Can we use external text editor for create/edit math object? Copy-paste isn't enough!
May be is possible to make sript in sublime (in typewriter.NET at last) to replase it
Bonuses:

  • brackets highlighting
  • comfortable writing
  • compact math symbols with https://github.com/mvoidex/UnicodeMath sublime plugin
  • snippets using
    I.e.: save text content in temp file -> run customisable user command with this file as parameter -> read file after -> inster in math object -> update if need.

Discussion

1 2 > >> (Page 1 of 2)
  • Jan Rheinlaender

    You can read an external file into a Math object with READFILE. Currently formulas read in like this are not displayed because it is intended as a kind of include-file syntax.
    But it would be possible to add a parameter to READFILE which displays all the formulas in the file.

     
  • Jan Rheinlaender

    No, I need to run external editor for math object. External file - is just my view how can it be implemented (user must don't know anything about external file)

     
  • Jan Rheinlaender

    You mean a new option on the right-click context menu "Open in external editor"? And the editor to use could be defined in the global iMath settings.

     
  • Sergey Chelnokov

    Yes! And else button "Create with external text editor" will be useful.

     
  • Sergey Chelnokov

    Let it will be here, just for myself, for use iside text editor (if it will be implemented):
    Regex to replace variables by _ii_VAL(varname)_ii_:

    H={sqrt{ΔL_{ }^2+b^2}}over{2 cdot tan{{%alpha_1}over{2.001}}}
    t={%gamma_{f5(6)} · %eta · p_n · d_e1}over{2 · (R+%gamma_{f5(6)} · p_n)}
    %delta_м={{n · p · D_м}over{2 · (R_1+n · p)}} · %eta_в
    [p_{}]=min({2 cdot [%sigma_{}] cdot min(%varphi_у;%varphi_d)cdot(s-c)}over{D_a-(s-c)};{2 cdot %varphi_у cdot [%sigma_{}]cdot(s_b-c_b)}over{d_a-(s_b-c_b)})
    p'=(a'+10) cdot 100
    %varphi_d={{2}over{1.75+{d_eq}over{sqrt{(D_a-s+c)cdot(s-c)}}}}cdot(1+{ΣA}over{2 cdot (s-c) cdot sqrt{(D_a-s+c)cdot(s-c)}})
    (%sigma_{})
    (%sigma_{ })
    (%sigma_{0.2})
    
     
  • Sergey Chelnokov

    Let this highlight file for sublime will be here

     
  • Jan Rheinlaender

    Have a look at 2.3.1~beta1 release

     
  • Anonymous

    Anonymous - 2020-11-25

    Cool!!! This is what I wanted.
    But we need fine-tuning:

    • command to create new equations with external editor - open external editor with new empty text or just %%ii
    • use *.eqn instead *.txt - for syntax highlighting setup simplifing in editor
    • I was frustrated when I saw C:\Program at "Editing" instead C:\Program Files\Sublime Text 3\sublime_text.exe and only after that writed C:\Program Files\Sublime Text 3 at Path and sublime_text.exe at "Editing". Please, allow full path or just write "External editor name (use %PATH% to allow run it by name)". Just "Editing" is not so clear.
     
    • Jan Rheinlaender

      Hi. Create new equations is now in beta2.

      The problem with program name with spaces is that someone could distribute a different package of iMath where the external editor is called "format C:". It is always a security problem calling other programs.
      Now I have changed the check so that iMath checks that the program string is really a file. This means that command-line parameters are not possible. That is less restrictive.

       
      • Sergey Chelnokov

        Thank you, Jan, now it's usable!

        But key binding for new formula is missing (or I can't find?)

        ...may be use one shortcut for edit selected and create new formula if nothing selected

        In ideal case - it would be better to open unselected formula if it exists near caret and create new formula if nothing near caret (it's problem of LibreOffice - missing normal way to select formula without mouse).

         
        • Anonymous

          Anonymous - 2020-12-06

          Right I forgot the key binding. For workaround now, you can add

          Sub iMath_Create_External
                  call _iMath_openDialog("insert:external")
          End Sub
          

          to openDialog.xba

           
          • Sergey Chelnokov

            OK.
            Today I edited formulas in document without iMath. Edition with multiple cursors and brackets highlirghting is significantly easier O_o. So it's needed to allow edit/create not iMath formulas too. Even for not-iMath users.

             
            • Jan Rheinlaender

              You are quite right that the standard Math editor has only basic functionality and needs a lot of improvement. But that's a feature request for the LibreOffice Development Team. It has nothing to do with iMath.

               
              • Sergey Chelnokov

                Well, Yes, someone suggested they to introduce highlighting in the editor, but they ignore it.
                ... I should certainly write them this proposal for an external editor. But there is little hope.

                 
              • Sergey Chelnokov

                It just seems that is no difference - iMath or not iMath formula - only it's text content. And I thought it's possible to edit everything

                 
  • Anonymous

    Anonymous - 2020-11-25

    Else one thing to fine-tuning:

    • it would be nice to allow edit in external editor not-iMath formula.
      The difference between iMath and not iMath equations is %%ii existent only - am I right?
     
  • Anonymous

    Anonymous - 2020-11-25

    May be remove temp files after reading? But if they continue exists - it's not a problem.

     
  • Sergey Chelnokov

    More correct highlight for sublime

     
  • Anonymous

    Anonymous - 2020-12-28

    As a result, I set up cudatext. So, now AUTOTEXT is not needed

    This is cudetext settings (with plugins AutoSave and Macroses):

     
  • Sergey Chelnokov

    At this gif I press Ctrl+Shift+E inside cudatext to run "imath:explain EQDEF" macros

     
  • Jan Rheinlaender

    Thanks. I created a new folder on the Sourceforge download page at the top level for editor configs, because they do not change with iMath releases.

     
  • Jan Rheinlaender

    Can we close this ticket?

     
  • Sergey Chelnokov

    It's usable, and it already save many time, but:

    • a small wish: don't generate anything on create formula with editor - let's it will be empty
    • many bugs with loosing changes:
      a) when edit next formula with disabling autoupdate and when fogot to update manually - it's no good, but this is basically expected;
      b) when error on update stops formula updating - it's wasn't expected O_o
      Hands do not reach to find out in detail the conditions of occurrence

    So: We can close this ticket and I create than other bugs, or continue talk about it there

     
    • Jan Rheinlaender

      Hi Sergey,

      why do you not want to generate anything on create formula? You always need the %%ii certainly, and what about the equation number?

       
      • Sergey Chelnokov

        Some reason exists.
        Actualy, I would not want to see even %%ii, вecause I use snippets with aText - they work everywhere: LO Math, CudaText, Notepad, for example:

        ii= --> %%ii @@ EQDEF
        ii! --> %%ii PRINTVAL
        ii( --> _ii_VAL(
        )ii --> )_ii_
        

        And when I want to write PRINTVAL, I don't want to erase EQDEF
        Then, I may want to just type the formula, without %%ii. And somehow it's annoying that you can't edit ordinary formulas as well as iMath formulas.
        Elso, I use some regexpressions, to do more complex things, for example:

        a=x+10
        

        transfomates with bat-file in attach and sd to

        %%ii @a@ EQDEF a=x+10
        %%ii TEXT =_ii_VAL(x)_ii_+10=_ii_VAL(a)_ii_
        

        Equation number is unusable for me. And if label is empty - your iMath generates label by variable name - it's fine and don't need to pregenerate numbers

         
1 2 > >> (Page 1 of 2)

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB