Manage counters

Daniel xracoonx at gmx.de
Mon Oct 12 08:58:35 UTC 2020


I have just played a bit with Edit > Manage Counter Values. It's a nice 
feature to have available. However, it was not what I expected at first. 
It seems to be "just" a counter inset which sets the counter at the 
place where it is inserted (which becomes clear when looking at the 
code). I think it would be better placed in the Insert menu under 
"Counter Manager" or so.  The inset is nothing that directly "Edit"s the 
current layout but "Insert"s something in addition to it. The UserGuide 
actually states that this is an "inset" and that it is located in the 
"Insert" menu (which seems the right place IMO). Maybe the limitation 
and functioning could be explained a bit more in that section and an 
example for it's standard usage be provided?

I think it's nice to have the inset available but its use is limited for 
me. In particular, it seems not a feature to "directly" change the 
counter of numbered elements. Here is what I mean: Say, I want to change 
the counter of a Numbered list (enumerate). In the attached document I 
try to reset a Numbered list counter with the inset but it doesn't work. 
This is because `\setcounter` comes either too early (outside of the 
enumerate environment) or too late (after `\item`). I think to work, 
`\setcounter` should be added '''at the beginning or the line''' where 
the counter inset is added as in the attached tex document.

Also, it would be nice to set the counter of a numbered element more 
directly in another sense: setting it to a certain value via the context 
menu of a numbered element sets it to that value (not that value plus 
one as is currently the case with the "Counter Manager" because the 
value is increased by one when it is used e.g. in \section).

Am I right to assume that the inset is *not* suppose to deliver this 
feature?

I am asking because I'd like to look at implementing what I am after 
though I guess that my abilities are too limited for this currently. 
(Maybe someone wants to try to join forces or at least chip in some ideas?)

I know that I can use the enumitem module for this. But it is 
unsatisfactory because it does not give the indication in the work area 
(with the exception for resuming counters). Also, as I imagine it, 
ideally, there would be no added inset. Rather the set value will be 
just indicated by the number in the label and the setting of the 
numbering in the context menu and the "Numbering" dialog. In general, I 
prefer direct indications, if possible, over insets showing me 
information. It is otherwise just a bit more distracting when reading in 
the work area. It's more close to actually writing LaTeX code, i.e. 
non-WYMIWYS. Which is one reason I am not writing LaTeX code.

I am also thinking of being able to set not only the value but the 
format, e.g. "(\roman{enumi})", of the counter, ideally via a nice UI 
with a couple of preset values. But that would probably be even much 
more tricky. However, it might be useful to keep this feature in mind 
for the future when implementing.

Daniel
-------------- next part --------------
#LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 598
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\use_default_options true
\maintain_unincluded_children no
\language english
\language_package default
\inputencoding auto-legacy
\fontencoding auto
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_roman_osf false
\font_sans_osf false
\font_typewriter_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref true
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks false
\pdf_pdfborder false
\pdf_colorlinks false
\pdf_backref false
\pdf_pdfusetitle true
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification false
\use_refstyle 1
\use_minted 0
\use_lineno 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tablestyle default
\tracking_changes false
\output_changes false
\change_bars false
\postpone_fragile_content false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\docbook_table_output 0
\end_header

\begin_body

\begin_layout Standard
\begin_inset CommandInset counter
LatexCommand set
counter "enumi"
value "2"
lyxonly "false"

\end_inset


\end_layout

\begin_layout Enumerate
Three?
\begin_inset CommandInset counter
LatexCommand set
counter "enumi"
value "2"
lyxonly "false"

\end_inset


\end_layout

\end_body
\end_document
-------------- next part --------------
A non-text attachment was scrubbed...
Name: counter_enumerate.tex
Type: application/x-tex
Size: 547 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20201012/b3a261d9/attachment-0001.tex>


More information about the lyx-devel mailing list