# Tag Info

7

Maybe I'm missing an important complication, but I think all you need to do is (a) define a "scratch" counter variable named, say, scratchcounter, in the preamble and (b) use an instruction such as \setcounter{scratchcounter}{\value{theorem}} immediately after the theorem in question to store the number of the theorem (minus the "prefix") in the counter ...

5

Update (2016/05/22) I've uploaded a new version of cntperchap to CTAN, being called xcntperchap now, it's available on my personal package as well and it will allow for multiple track levels. Edit (2016/05/09): Update: I found a small weird bug in xassoccnt, that lead to some nasty off-by-one value. See the scratch version of a new cntperchap - look-alike ...

4

See the improved version at the bottom, using tikz styles. coltitle=black works wonders (the default is coltitle=white) ;-), but white text colour on white background may be difficult to read (;-)) To use a common counter for both listings environmens, use use counter from=cpp, for example. \documentclass{book} \usepackage{listings} ...

4

count255 is still a scratch register (and as insertions still have to be below 255, the block of count/skip/length/box allocations below 255 is still skipped by \new... depending how many \newinsert there have been.

4

Define \UnitLabel with an argument: \documentclass{article} \usepackage{lipsum} \usepackage{xparse} \newcounter{Unit} \NewDocumentCommand{\UnitLabel}{m}{% \makebox[4.5em][l]{Unit #1}% } \NewDocumentCommand{\Unit}{ m }{% \refstepcounter{Unit}% \section*{\UnitLabel{\Roman{Unit}}#1} \addcontentsline{toc}{section}{\UnitLabel{\Roman{Unit}}#1}% } ...

3

Use \DeclareExpandableDocumentCommand -- this does not allow an optional argument at the end of the argument list, but this is no issue here! The \NewDocumentCommand version isn't expandable, see e.g. \show\UnitLabel: \UnitLabel=\protected macro: ->\makebox [4.5em][l]{Unit \Roman {Unit}}. l.25 \show\UnitLabel i.e. \UnitLabel is protected. The xparse ...

3

The idea of \StrBehind is good, but you have to use it in a different way. \StrBehind{\getrefnumber{orbitcomeagre}}{.}[\orbitcomeagrenumber] \setcounter{theorem}{0\orbitcomeagrenumber} The 0 is for avoiding issues when the reference is not yet defined and \StrBehind would output nothing. \documentclass{article} \usepackage{xstring,refcount} ...

2

Something like this? \documentclass{article} \begin{document} \newcount\group \newcount\subj \newcount\nors \group=0 \loop \advance\group by 1 \subj=0 {\loop \advance\subj by 1 \nors=0 {\loop \advance\nors by 1 { group \the\group, subject \the\subj, run \the\nors \par \ifnum\group=2 ...

2

You can use the command \determinelistcharacteristics and then \structurelistsize to access the value. Example: \starttext \determinelistcharacteristics [chapter] [criterium=text] number of chapters: \structurelistsize \startsectionlevel [title=Foo] \startsectionlevel [title=title 1] section 1 \stopsectionlevel \startsectionlevel [title=title 2] ...

2

Here is a way to achieve what you want... Use \addtocounter{algocf}{-1} to reduce the Algorithm counter before setting a countinued algorithm. Use \strut as part of the caption to ensure that they present at a similar height if you want to avoid a "jumping" effect when skipping between pages. Mark the end of an algorithm with a \label that you can use to ...

2

The following solution implements \extractthmnum{<cnt>}{<ref>} in a similar way to refcount's \setcounterref: \documentclass{article} \newtheorem{theorem}{Theorem}[section] \newcounter{mycount} \makeatletter \def\@extractthmnum#1.#2{#2} \newcommand{\extractthmnum}[2]{% \extractthmnum{<cnt>}{<ref>} \setcounter{#1}{0}% Default ...

1

(If this is not a duplicate....) All that is needed in this case is to use the optional argument to \newcounter: \newcounter{contentCounter}[section] Where the [section] indicates that contentCounter should be reset to zero with each use of \section. Note that if you need to modify a counter initially defined without the optional argument (or, ...

1

It's a common problem: a conditional cannot straddle two (or more) alignment cells. Here's a simpler implementation in xparse: \documentclass{article} \usepackage{xparse} \usepackage{tabularx} \newcounter{basesize} \setcounter{basesize}{15} \ExplSyntaxOn % \storedata{<name>}{item1,item2,...} \NewDocumentCommand{\storedata}{mm} { ...

1

In case anyone else is struggling with a similar problem, I am posting the solution I found (even though it indicates I was missing a crucial understanding of something simple): In my example I had a spelled out table showing what I wanted: \vspace{10pt}Example of how it should look: \begin{tabularx}{\linewidth}{|c|c|X|c|} \hline Column 1 & Column2 ...

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