Hot answers tagged

11

Define an environment within which counter stepping and ToC-writing is disabled. This allows great freedom: \documentclass{article} \usepackage{xparse} \newcounter{savesection} \newcounter{savesubsection} \newcounter{savesubsubsection} \newenvironment{quietsections} {% Store sectional counters \setcounter{savesection}{\value{section}}% \...


8

\renewcommand*\thechapter{\ifnum\value{chapter}<10 0\fi\arabic{chapter}}


8

Here's an addition of an extrastuff counter, that is stepped each time \myextrafootnote is used. However, more than 26 additions aren't possible this way, since \alph{extrastuff} is used. If you need even more additions, the alphalph package for increasing the counter output is useful! \documentclass{book} \newcounter{extrastuff}[chapter] \newcommand{\...


7

The optional argument of the \footnote command expects an integer containing the number of the footnote, not the textual representation of that number. So, you should use \footnote[\value{footnote}]{#1} instead of \footnote[\thefootnote]{#1} Addition So, where does the extra “a” come from? To understand this, let us examine step by step how the ...


6

At its simplest, setting the section counter to -1 will cause the next section to be 0. \documentclass{book} \begin{document} \setcounter{section}{-1} \section{text} \end{document} To change the appearance of sectioning, for example to add the subsection number by default, one needs to redefine \thesection, as well. \documentclass{article} \usepackage{...


6

UPDATE at the end, with automatic restoration of arbitrary counters!!!! Use a dummycounter that resets with the upper section level and \let\c@subsection\c@dummycounter, i.e. explicitly use the count register c@dummycounter instead of c@subsection If this is used inside of the minipage, the \let operation does not leak outside (since minipage is an ...


5

Forest provides the option baseline which aligns the current node with TeX's baseline when setting the tree. For this case, we can include the option in the definition of the syll style and automatically set the option. The code below sets the root node as the baseline if it is not empty or its first child otherwise. \documentclass{article} \usepackage{...


5

The error is the usage of \subcaption* outside its own box or environment. The subcaption manual explicitly states that \subcaption needs a box or an environment, i.e. \begin{table} \begin{minipage}{0.4\textwidth} % some content \subcaption{Foo} \end{minipage} \end{table} In principle, it's better to use the subfigure and subtable environments ...


5

Putting the chapter counter on the reset list of part is easy with the LaTeX core macro \@addtoreset \makeatletter \@addtoreset{chapter}{part} \makeatother Or use the chngcntr package and \counterwithin*{chapter}{part}. \usepackage{chngcntr} \counterwithin*{chapter}{part} In this case I used \counterwithin* to prevent a change of \thechapter. For more ...


4

The command \etocsettocdepth sets the depth of the ToC for the \localtableofcontents and is similar to \setcounter{tocdepth}{1}, for example. \etocsettocdepth is sticky until another call will change the value eventually. If another tocdepth is requested in between, \etocsetnexttocdepth can be used instead -- this setting is used only for one (i.e. the next) ...


3

As Christian already mentioned, \subcaption has to be placed inside a group (or a box) since it's very much \caption and therefore interferes with the specific caption type counter. To see how this is a problem, use \subcaption before \caption inside one of your figures. Depending on the spread of your current non-grouped used of \subcaption, one can fix ...


3

\frontmatter removes the \chapter numbering, so you'll have to use \mainmatter somewhere... either in introduzione.tex or capitolo1.tex. However, I'd place it inside your main TeX file since it aids in the visible document structure. \frontmatter is defined like this inside book.cls: \newcommand\frontmatter{% \cleardoublepage \@mainmatterfalse \...


3

A slightly more robust solution than that proposed by @HeikoOberdiek is to use \Alph to format the name of the current appendix. For example, I have multiple appendix chapters (A, B, etc.), and otherwise have my table names formatted with a period between chapter number and table number, so the following update of \thetable continues this convention through ...


3

Like this? Considering comments to question, the code employ empheq package and also environment multlined from package mathtools, which is called by empheq: \documentclass{article} \usepackage[a4paper,margin=1in]{geometry} \usepackage{empheq} \begin{document} \begin{empheq}[left={f(x)=}\empheqlbrace]{align} x_1, & \text{ if } x\in \...


3

Here is a solution. The counter lstlisting is defined using \AtBeginDocument so the change must be done after \begin{document} or using \AtBeginDocument \documentclass{book} \usepackage{lipsum} \usepackage{listings} \usepackage{chngcntr} \AtBeginDocument{\counterwithin{lstlisting}{chapter}} \begin{document} \chapter{Foo} \begin{lstlisting}[caption={bla ...


3

It's possible with a theorem name style and shifting a overlay out of the box with overlay={\node[...]} \documentclass{article} \usepackage[most]{tcolorbox} \usepackage{xcolor} \newtcbtheorem[number within=subsection]% {theorem} % \begin.. {Theorem} % Title {%theorem style = margin apart, % Style enhanced, colback=white, colframe=lightgray, ...


3

Based on Christian's solution, I've introduced a magic number as left skip and the result looks like: \documentclass{article} \usepackage[most]{tcolorbox} \usepackage{xcolor} \newtcbtheorem[number within=subsection]% {theorem} % \begin.. {Theorem} % Title {%theorem style = margin apart, % Style enhanced, colback=white, colframe=lightgray, theorem ...


2

The package xgreek explicitly redefines \@alph and \@Alph to use greek numbers. If those specific greek numbering style is not needed in the rest of the document, it's possible to switch back to the Latin style by catching the original definition and return to them after xgreek has been loaded. \documentclass[a4paper,12pt]{article} \makeatletter \let\...


2

A solution without using any further package, just LaTeX core features like \@addtoreset (I used the document body code from the OP and added the correct \thefigure definition) \documentclass{article} \makeatletter \@addtoreset{figure}{section} \makeatother \renewcommand{\thefigure}{\arabic{section}-\arabic{figure}} \begin{document} \listoffigures \...


2

I am not sure i understood the question you want \documentclass{book} \usepackage{lipsum} \usepackage{amsmath} \usepackage[a4paper]{geometry} \makeatletter \@addtoreset{equation}{section} \renewcommand\theequation{\thesection.\@arabic\c@equation} \makeatother \begin{document} \chapter{Foo} \section{Foo bar} \begin{equation} \begin{array}{lll} \...


2

Building on Christian's ideas, here's a version that resets the equation number in the proofs and keeps the outer ones to the standard. It also allows changing (locally) the symbol in a given proof environment (default are asterisks). \documentclass{article} \usepackage{amsmath,amsthm,xpatch} \usepackage{hyperref} \ExplSyntaxOn \cs_new:Npn \stars #1 { \...


2

Something like this? This works with hyperref even for multiple occurences of ** (which is unclear,however, then) as long as the dummy proof counter proof isn't reset. The equation number is expanded first before it's used in \loopstars. Of course, this will provide trouble if there are more than 10 symbols, i.e. the equation 'number' will get too wide!...


2

Saying \usepackage[hyperref]{ntheorem} isn't enough here. The hyperref package must be loaded too! \documentclass[11pt]{article} \usepackage[utf8x]{inputenc} \usepackage[T1]{fontenc} \usepackage[english]{babel} \usepackage{amsmath,amssymb,mathrsfs} \usepackage[hyperref]{ntheorem} \usepackage{hyperref} {\theoremheaderfont{\normalfont\bfseries} \...


2

It's possible with a little manual work. With \startsubequation you fix the equation number and each \tagsubequation command will step the subcounter. Until you use \tagsubequation, the main equation number will not increase. \documentclass{article} \usepackage{amsmath} \makeatletter \newcounter{manualsubequation} \renewcommand{\themanualsubequation}{\...


2

As daleif mentionted: The numbering scheme can confuse readers, but here's a solution. The command \clevercnt checks whether (sub)section counters are greater than zero and uses the full format then, otherwise another, shorter format is used. \documentclass{book} \usepackage{amsmath} \usepackage{amsthm} \newtheorem{thm}{Theorem}[subsection] %\...


2

Elaborating on Werner’s answer (with compliments to his crystal ball… :-) \documentclass[a4paper]{article} \usepackage[T1]{fontenc} % not actually necessary, but recommended \usepackage[width=14cm]{geometry} % just for this example \usepackage{amsmath} \begin{document} Text before. \begin{equation} \begin{split} \text{PRODUCTION}_{i,t} &= ...


2

Here are some options: Define a "fake chapter" to be used that doesn't have a number. Add the following to your preamble: \makeatletter \let\l@chapternonum\l@chapter \newcounter{chapternonum} \renewcommand{\thechapternonum}{} \makeatother and use \includepdf[...,addtotoc={1,chapternonum,1,<heading>,<label>}]{<file>} The output ...


2

The caption package used with svmult.cls issues a warning Package caption Warning: \caption will not be redefined since it's already (caption) redefined by a document class or package which is (caption) unknown to the caption package. See the caption package documentation for explanation. More serious is the error message ...


2

Here is a solution. Update All what we need is \let\l@section\l@subsection \documentclass{article} \usepackage{mwe}% just for the example \usepackage{amsmath} \numberwithin{equation}{section} \numberwithin{figure}{section} \numberwithin{table}{section} \begin{document} \tableofcontents \listoffigures \listoftables \section{Foo} \section{Bar} \...


2

After each \subsection, you need to increment the section counter so as to reset all the other counters. Since this also resets the subsection counter, you need to reset it to equal the new section number. I combined these into the macro \appsection. \documentclass{article} \usepackage{mwe}% just for the example \usepackage{amsmath} \numberwithin{...



Only top voted, non community-wiki answers of a minimum length are eligible