Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjustable problem numbers don't affect header until the second page #8

Open
anrddh opened this issue Sep 23, 2017 · 3 comments · May be fixed by #9
Open

Adjustable problem numbers don't affect header until the second page #8

anrddh opened this issue Sep 23, 2017 · 3 comments · May be fixed by #9

Comments

@anrddh
Copy link

anrddh commented Sep 23, 2017

Hey,

One of my professors likes to number his problems as if the homework was really one giant homework, instead of multiple weekly assignments. As in, problem 1 on homework 2 is really problem 7 for example.

I noticed that the header still says problem 1 on the first page instead of problem x, though the problem numbers are correct from the second page onwards.

It's not a biggie, but hopefully, it can be fixed soon :)

@kiarashgl
Copy link

Ping!

ocelotsloth added a commit to ocelotsloth/latex-homework-template that referenced this issue Dec 7, 2020
This patch fixes a bug where the header's problem
counter is not updated when the problem counter is
overriden.

fixes jdavis#8

Signed-off-by: Mark Stenglein <mark@stengle.in>
@ocelotsloth
Copy link

@kiarashgl can you give that a try?

You just need to add the following line:

        \nobreak\extramarks{Problem \arabic{homeworkProblemCounter}}{}\nobreak{}

Into the homeworkProblem environment definition here:

%
% Homework Problem Environment
%
% This environment takes an optional argument. When given, it will adjust the
% problem counter. This is useful for when the problems given for your
% assignment aren't sequential. See the last 3 problems of this template for an
% example.
%
\newenvironment{homeworkProblem}[1][-1]{
    \ifnum#1>0
        \setcounter{homeworkProblemCounter}{#1}
        \nobreak\extramarks{Problem \arabic{homeworkProblemCounter}}{}\nobreak{}
    \fi
    \section{Problem \arabic{homeworkProblemCounter}}
    \setcounter{partCounter}{1}
    \enterProblemHeader{homeworkProblemCounter}
}{
    \exitProblemHeader{homeworkProblemCounter}
}

@kiarashgl
Copy link

@ocelotsloth That fixes the problem. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants