Hello, i am new to LyX and trying to do something i think is pretty basic but can't seem to find how.
I like how the environment "Section" has a counter on it, so that when creating a new section, it is numeralised automatically.
I would like to have the same to make a sheet of maths exercices, so an "exercice" environnement, with a counter integrated in it, but instead of being "1." or "2." at the begging of the line, it's "exercice 1" or "exercice 2". Can't seem to find how to do it, but it would be useful, so that if i add exercices in between, i don't have to re enumerate the whole thing.
Thanks
LyX ⇒ Environment that enumerate and start with a word
- Stefan Kottwitz
- Site Admin
- Posts: 10307
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Environment that enumerate and start with a word
It depends on how you are doing that environment. But you can redefine how the counter is printed, like \renewcommand*{\theexercice}{exercice \arabic{exercice}}.
Stefan
Stefan
LaTeX.org admin
Re: Environment that enumerate and start with a word
Thanks.
How do you create an environment. There is a 4 step guide on how to on this site -> https://tex.stackexchange.com/questions ... 779#129779 (first anwser), but it seems complicated, i have to copy and modify some files, is there a way to do it in LyX UI?
How do you create an environment. There is a 4 step guide on how to on this site -> https://tex.stackexchange.com/questions ... 779#129779 (first anwser), but it seems complicated, i have to copy and modify some files, is there a way to do it in LyX UI?
- Stefan Kottwitz
- Site Admin
- Posts: 10307
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Environment that enumerate and start with a word
I don't use the LyX UI myself, I prefer LaTeX. As I also see in the link you provided, it get's difficult with LyX if a document is not standard.
With LaTeX, I would use the
exam class (looks easy to work with), such a template, or the
xsim package (looks difficult to learn).
Stefan
With LaTeX, I would use the


Stefan
LaTeX.org admin
Re: Environment that enumerate and start with a word
In fact it is not as difficult as you might think. You need to load the "Customisable lists (enumitem)"-Module via Document -> Settings -> Modules -> List Enhancements.
Then you can put this in your Preamble: (Mention, that LyX gives you an error, if you're defining a numeration without using it. So you should comment it out, if you put in your standard-Preamble)
edit: Enumitem can do much more than you actually need in this situation. Maybe the LyX-User's Guide (Section 3.3.7) has enough to solve your problem in an even easier way. (But only if you don't want to have all numerations in this way.)
Then you can put this in your Preamble:
Code: Select all
\setenumerate{label=exercise \arabic*}
edit: Enumitem can do much more than you actually need in this situation. Maybe the LyX-User's Guide (Section 3.3.7) has enough to solve your problem in an even easier way. (But only if you don't want to have all numerations in this way.)