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}% ...


4

The alphalph commands needs \value{countername} instead of the counter name only, just like \number, e.g. \number\value{countername} always will print the counter as a number, not as defined \thecountername, which could have been defined somewhere else to be totally different what is expected. The correct usage of \AlphAlph is ...


4

You want to do \edef\temp{{#1}}, but you can simplify the definition of \push and other parts of the code as well. \documentclass[openany]{article} \usepackage{tikz} %Define stack data structure commands (\push, \pop, \splitstack) \newtoks\braketpairingstack \braketpairingstack={\empty} \def\push#1#2{% \edef\tmp{{#1}\the#2}% #2=\expandafter{\tmp}% } ...


4

You can use \dtlexpandnewvalue to expand the \ref in \sortitem. However, this can only be done once \ref has been defined and which is only after the .aux file has been created. Hence, the following is the output after the second run: During the first run this will be displayed as: Notes: To allow for use with hyperref I now check to see if ...


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

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 ...


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 ...


1

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


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} ...



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