1

I created/copied this piece of latex preamble code:

\makeatletter
\def\@lesson{}
\def\@lessonabbr{}
\newcommand{\lesson}[4]{
    \ifthenelse{\isempty{#3}}{
    \def\@lessonabbr{Les #1}
        \def\@lesson{Lesson #1}
        \def\@fullLesson{\hfill \small{#2}\hr \@lesson \hfill \small{#4} \\}
        \subsection[\@lessonabbr]{\@fullLesson}
    \label{\@lesson}
    }{
    \def\@lessonabbr{Les #1: #3}
        \def\@lesson{Lesson #1: #3}
        \def\@fullLesson{\hfill \small{#2}\hr \@lesson \hfill \small{#4} \\}
        \subsection[\@lessonabbr]{\@fullLesson}
    \label{\@lesson}
    }
}
\makeatother

\lesson{1}{Mar 18 2022 Fri (16:40:24)}{Write an inequality from Graph}{Unit 2}

How would I make it automatically create a label for me by replacing the spaces with _ and making it all lowercased? I want to use the title of the lesson along with the lesson number. For this case, the label would look like this: les1:write_an_inequality_from_graph_unit_2

Any help will be greatly appreciated!

4

0

You must log in to answer this question.

Browse other questions tagged .