mailing-list for TeXmacs Users

Text archives Help


Re: [TeXmacs] Numbering of enumeration lists and numbering of references to labels


Chronological Thread 
  • From: Marc Mertens <address@hidden>
  • To: address@hidden
  • Subject: Re: [TeXmacs] Numbering of enumeration lists and numbering of references to labels
  • Date: Wed, 27 Mar 2019 19:55:18 +0100

Hi using a normal text editor to enter the macro works for me. If
however if I use texmacs and in normal mode tries to enter the macro as
follows:
\assign --> <assign||>
eqref --> <assign|eqref|>
\macro --> <assign|eqref|<macro|>
lab|Equation \reference -> <assign|eqref|<macro|lab|Equation
<reference|>
so far so good, but when I try to enter the arg macro with \arg I
just get <assign|eqref|<macro|lab|Equation <reference|args> instead of
  <assign|eqref|<macro|lab|Equation <reference|<arg|>>>> and I'm stuck.

If I use 'Edit Preample' I get something like
<inactive|<assign|eqref|lab|Equation <inactive|<reference|>>>> and I
have the same proble in inserting the arg macro.
It seems that the source view (edit preample) is not working correctly
(unless I'm still missing something). I'm using TexMacs version 1.99.
Anyhow, your solution of using a editor like kate to type in the macro
works for me.

Thanks for your help

Marc Mertens


On Wed, 2019-03-27 at 16:32 +0100, Giovanni Piredda wrote:
> And by the way it is also possible to edit the file generated by
> TeXmacs with a text editor and add the macro definition just after
> the <\body> command. So the liens between (and excluding :-)  ) 
> %%%%%%, saved into a file, should be readable by TeXmacs:
> %%%%%%
> <TeXmacs|1.99.8>
>
> <style|generic>
>
> <\body>
>
>
>   <assign|eqref|<macro|lab|Equation <reference|<arg|lab>>>>
>
>   <\equation>
>     \<mu\>=<frac|<big|sum><rsub|1><rsup|N>x<rsub|n>|n><label|eqtest>
>   </equation>
>
>   refer to <eqref|eqtest>
>
>   \;
>
>   \;
> </body>
>
> <\initial>
>   <\collection>
>     <associate|preamble|false>
>   </collection>
> </initial>
>
> <\references>
>   <\collection>
>     <associate|eqtest|<tuple|1|?>>
>   </collection>
> </references>
>
> %%%%%%
>
> As well the following should be a valid style file:
>
> %%%%%%
>
> <TeXmacs|1.99.8>
>
> <style|<tuple|source|german>>
>
> <\body>
>    <assign|eqref|<macro|lab|Equation <reference|<arg|lab>>>>
>
>   \;
> </body>
>
> <initial|<\collection>
> </collection>>
>
> %%%%%%
>
> Am 26.03.2019 um 22:44 schrieb Giovanni Piredda:
> > It is possible to do it with a style file, to load, or it is also
> > possible within the same document, to test things
> > quickly:         from the menu: tools, macros, edit preamble (not
> > edit macros, I am not able to get that to work as well!), and then
> > again deselect edit preamble to go back to normal editing.
> >
> > I used the following guide for writing macros:
> > http://www.texmacs.org/Tutorial/Editing/Chapter4.html
> > and some help from this too:
> > https://www.mindomo.com/de/mindmap/texmacs-b207992c90c046bdbe4053cb
> > df88b5d5
> > and I have to fight a bit too because I can't get everything
> > straight at the first attempt; but eventually it works :-)
> > The definition with the style file has worked more promptly than
> > the definition using the "edit preamble" menu item.
> >
> > G.
> >
> > Am 26.03.2019 um 22:33 schrieb Marc Mertens:
> > > Thanks all for your solutions, I will try them out. To be honest
> > > I have
> > > never defined my own macros so I have first to learn how to
> > > define
> > > them. Am I correct that I first have to define my own style file
> > > to
> > > define a macro? I saw in tools a macro editor but I could not use
> > > it to
> > > define the eqref macro.
> > >
> > > Thanks in advance
> > >
> > > Marc Mertens
> > >
> > > On Tue, 2019-03-26 at 10:07 +0100, Massimiliano Gubinelli wrote:
> > > > As for the first question. I did a small research, relevant
> > > > macros to
> > > > the handling of lists and enumerations are contained in 
> > > >
> > > > TeXmacs/packages/standard/std-list.ts
> > > >
> > > > in particular a new counter is defined via
> > > >
> > > > <new-counter|item>
> > > >
> > > > which in turn defines a series of macros to handle the counter
> > > > like
> > > > <reset-item>
> > > > <the-item>
> > > > <inc-item>
> > > >
> > > > if you want to reset the counter at an arbitrary number, you
> > > > have to
> > > > add this at the beginning of the new environment
> > > >
> > > > <assign|<counter-item>|10>
> > > >
> > > > for example. Note that this has to really be at the beginning
> > > > of the
> > > > enumerate environment, in particular before the first item.
> > > >
> > > > Note also that <counter-item> is a macro which returns the name
> > > > of
> > > > the variable which contains the counter.
> > > >
> > > > Best
> > > > Max
> > > >
> > > >
> > > >
> > > >
> > > > > On 26. Mar 2019, at 03:26, Giovanni Piredda <pireddag@posteo.
> > > > > de>
> > > > > wrote:
> > > > >
> > > > > I know one way of getting what you want for the second
> > > > > question,
> > > > > but it is not completely automatic.
> > > > >
> > > > > You can define and load the following macro:
> > > > >
> > > > >
> > > > > <assign|eqref|<macro|lab|Equation <reference|<arg|lab>>>>
> > > > >
> > > > > (and similar ones for theorems, propositions and so on)
> > > > >
> > > > > and use it in place of the \reference macro. The advantange
> > > > > of
> > > > > using \eqref with respect to typing everytime "Equation
> > > > > \reference"
> > > > > is that it will ensure consistent formatting.
> > > > >
> > > > > I suspect there is a way to write a macro to automatically
> > > > > recognize the type of reference and format it according to
> > > > > type,
> > > > > like the cleveref package for LaTeX, but - at least for now -
> > > > > it is
> > > > > too complicated for me to figure it out.
> > > > >
> > > > >
> > > > > Giovanni
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Am 25.03.2019 um 19:49 schrieb Marc Mertens:
> > > > > > Hello,
> > > > > > I have two questions concerning TexMacs. The first is
> > > > > > about the
> > > > > > numbering of enumeration list, when I insert a enumeration
> > > > > > it
> > > > > > always
> > > > > > start at 1, a, i etc. Is it possible to specify the start
> > > > > > numbering at
> > > > > > a different number.
> > > > > > The second is of the numbering of references. When you
> > > > > > insert a
> > > > > > label for a theorem, proposition etc  or a displayed
> > > > > > formula and
> > > > > > reference to it the references used the same x.y format for
> > > > > > both.
> > > > > > So
> > > > > > sometimes you have to confusion that for example a
> > > > > > reference
> > > > > > displays
> > > > > > the same number (for example 10.14) but in one case it
> > > > > > refers to
> > > > > > a
> > > > > > theorem and in the other case it references to a displayed
> > > > > > formula. You
> > > > > > can not seen the difference. Is it somehow possible to
> > > > > > display
> > > > > > for the
> > > > > > reference to display 'eq 10.14' if it refers to a displayed
> > > > > > formula and
> > > > > >  'theorem 10.14' if it refers to a theorem (and likewise
> > > > > > for
> > > > > > lemmas,
> > > > > > propositions ...).
> > > > > > I searched in the manual but could not found a way to
> > > > > > do this
> > > > > > two things.
> > > > > >
> > > > > > Thanks in advance for a possible answer and also for a
> > > > > > excellent
> > > > > > math
> > > > > > editor.
> > > > > >
> > > > > >
> > > > > > Marc Mertens
> >  
>  



Archive powered by MHonArc 2.6.19.

Top of page