On 5/26/25 7:50 AM, [email protected] wrote:
I want to define a style for questions and a style for solutions.
I want the question to have a counter, and the solutions to have no counter.

I have the following in my local layout:
```
Counter question
  Within section
End
Style question
LatexName question
LatexType Environment
LabelCounter question
LabelString "Q \thequestion"
Preamble
% latex macros go here
EndPreamble
End

Style solution
CopyStyle question
LabelString "Solution"
LatexName solution
Preamble
% latex macros go here
EndPreamble
End
```

but this increases the question counter when solution style is in use.

I.e. in section 1 I have
Question 1.1
Solution
Question 1.3
Solution
Question 1.5
Solution

How can I stop Solution from increasing the counter?

Since you copied the question style, it copied the use of the counter, too, and it increments it when you use the Solution layout, even though you don't display the counter. I'd try

LabelCounter ""

in the Solution layout (to cancel the copied style), or if that doesn't work:

LabelCounter "Solution"

and then just don't use that counter. You would need to declare the counter earlier, though.

Riki


--
lyx-users mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-users

Reply via email to