Tag Info

Hot answers tagged

6

You have (at least) two options (enter the instructions in the preamble): \numberwithin{foo}{section} (requires the amsmath package). Instances of the foo environment will be numbered like "1.1", "1.2", etc. \makeatletter \@addtoreset{foo}{section} \makeatother Instances of the foo environment will be numbered like "1", "2", etc. within each section, ...


6

Will this do? \documentclass{article} \usepackage{array} \newcounter{rowno} \setcounter{rowno}{0} \renewcommand\therowno{\alph{rowno}} \begin{document} \begin{tabular}{!{\stepcounter{rowno}\strut\therowno)}lll} a & b & c \\ d & e & f \end{tabular} \end{document}


5

The easiest way is to use a new column type which automatically counts the number of rows, e.g. by using the array package and the \newcolumntype. I assumed to have a left justified 2nd column. This does not work, if the L column is specified more than once, of course! \documentclass{book}% \usepackage{array} \usepackage{etoolbox}% ...


3

I suggest enumitem rather than the pretty inflexible paralist. \documentclass{article} \usepackage{enumitem} \newenvironment{mydefs} {\begin{enumerate}[ nosep, label=\P\slshape\thesection.\alph*\ , ref=\thesection.\alph*, leftmargin=0pt,labelwidth=0pt,align=left,itemindent=\parindent,labelsep=0pt ]} {\end{enumerate}} ...


3

If I understand well your question, \newcounter{foo}[chapter] does what you want. If you want that the chapter number is part of the representation of foo, add \renewcommand{\thefoo}{\thechapter.\arabic{foo}} If foo is an already defined counter by a package and you have no control over its definition, add \usepackage{chngcntr} and do ...


3

The problem is that \define@key doesn't expand its argument; also \index should be expanded at definition time in the replacement text of \define@key, not at runtime. Using \index is not necessary, \the\count@ does the same (or \@arabic\count@, if you prefer. And \index is a badly chosen name anyway: try building an index for your document to see why. ...


2

You need to use xpatch: \documentclass[]{article} \usepackage[nonumber]{cuisine} \usepackage{xpatch} \makeatletter \xpatchcmd{\Displ@ySt@p}{\arabic{st@pnumber}}{}{}{} \makeatother \begin{document} \begin{recipe}{Name}{4}{\fr12 hour} \ing[5]{units}{something} STEP 1 STEP 2 ... \end{recipe} \end{document}


2

\documentclass{article} \newcounter{mycounter} \setcounter{mycounter}{1} \newcommand{\mycounter}{\stepcounter{mycounter}\arabic{mycounter}} \begin{document} \begin{enumerate} \item[\mycounter] test \item[\mycounter] test \end{enumerate} \end{document}


2

Here is an update to my answer using ideas from Counters for use in array/tabular cells: \documentclass{article} \usepackage{array} \makeatletter \def\insert@column{% \the@toks \the \@tempcnta \global\advance\c@tabcol\@ne \ignorespaces \@sharp \unskip \the@toks \the \count@ \relax} \let\old@arraycr\@arraycr ...


2

Is there a simple way to get the number of rows in a given tabular? Use some of the ideas in Coounter for use in array/tabular cells. Below I've added \savetabularrows{<label>} which stores the number of rows using the traditional \label-\ref system. This allows you to \ref{<label>} it elsewhere in the document, or use \thetabrow directly ...


1

The asparaenum environment can be emulated by the enumitem package. The option wide emulates items as paragraphs and the compact lists with the options noitemsep and nosep. \newlist creates customized lists based in itemize, enumerate and description. Example \documentclass{article} \usepackage{enumitem} \newlist{mydefs}{enumerate}{1} ...


1

If you want that effect only when using \newpage, the code below works \let\anewpage\newpage \renewcommand{\newpage}{\anewpage\addtocounter{page}{1}}


1

Here's a general enumeration style builder. \documentclass{article} \usepackage{enumitem,xparse} \ExplSyntaxOn \int_new:N \l_severus_temp_int \cs_new_protected:Npn \severus_enumeration:nn #1 #2 { \int_case:nvF { #2 } { g_severus_enum_#1_tl } { \use:c { @ctrerr } } } \cs_generate_variant:Nn \int_case:nnF { nv } \cs_new_protected:Npn ...


1

As I said in comments a not so difficult way is to define new counter representation commands and tell enumitem (rather than enumerate) how to use it. The idea is as follows: the internal counter command can be defined using \ifcase\or ...\or ...\fi similar to how \@fnsymbol is defined. In order to make this a little bit more comfortable than defining the ...



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