Tag Info

Hot answers tagged

7

The \number primitive is not needed in those contexts. But you need \dimexpr in \setlength, unless you load calc. Example: \documentclass{article} \newcounter{numofboxes} \newcounter{numofgaps} \newlength{\textsectionwidth} \newlength{\truetextsectionwidth} \newlength{\gapwidth} \setlength{\gapwidth}{10pt} % an easy number ...


6

Every time you use a list with items you can replace the default item label using, for example, \item[7] Item contents here. \item[24] Item contents here. Or if you want an empty item just use \item[]. Those commands will not affect the list margins/alignments.


5

Probably you want something like \newtheorem{theorem}{Theorem}[section] \newtheorem{proposition}[theorem]{Proposition} \newtheorem{definition}[theorem]{Definition} That is number theorem within section and the others to follow the same numberation of theorem MWE \documentclass{amsart} \newtheorem{theorem}{Theorem}[section] ...


4

I believe it's better to use the \label-\ref mechanism. If you change your mind about the numbering, you just need to change the definition of \lnnumding. Linking the counter to mocklisting that's stepped at each call of python resets it to zero. By setting labels you gain more flexibility (at the expense of having to provide a label). ...


4

Use \tag and the fact that \label at the start of a subequations environment refers to the current main equation number. \documentclass{article} \usepackage{amsmath} \newcommand{\subs}{\textup{s}} \begin{document} \begin{subequations}\label{eq:litdiff} \begin{equation} \frac{\partial}{\partial t}(\widetilde{c}_{\subs}(r,z,t)+c_{\subs,0})= ...


3

Use the package option counter-within=section in order to get a reset of the question counter each time a section starts (See chapter 8 of the exsheets documentation) \documentclass{article} \usepackage[counter-within=section]{exsheets} \begin{document} \section{One} \begin{question} This is question number 1 in section 1. \end{question} ...


3

You can do this: \newcommand*\abcRoman[1]{\csname abc\Roman{#1}\endcsname} ... \abcRoman{myabc} \stepcounter{myabc} Well, I suspect that this may not be what you really need, however, that depends on knowing what you want to use your code for. As egreg suggests, if you can use lowercase roman numerals for your macros, you can get on the safer side: ...


3

The \appendix command is better suited for this, but it could be achieved without it as well. The resetting of the chapter counter at the beginning of the appendix confuses hyperref, so hypertexnames=false option is necessary, to provide correct link anchors. \documentclass{book} \usepackage[hypertexnames=false]{hyperref} \begin{document} ...


3

Use for example the forloop package and a counter as loop variable. I applied the counter numofrows as threshold (here set to 25) The length \fillinboxwidth can be changed. Although I am not fond of having to much lines in a table, I think, it's reasonable to have them if people fill in the table by hand. \documentclass{article} ...


3

A fancy solution with expl3: \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\filltheblanks}{om} {% #1 = width, default fill; #2 = number of lines \IfNoValueTF{ #1 } {% no optional argument given, compute the available width \jlanza_compute_width:n { #2 } } {% set the width of the column of blanks to the ...


3

The best way I think it is to define a new listing environment that does that at its beginning and at its end. For example, let's call it mylisting: \lstnewenvironment{mylisting}[1][] {\lstset{% basicstyle=\footnotesize\ttfamily, % Standardschrift escapechar=ยข, language=python, #1 }% \setcounter{lstNoteCounter}{0}} ...


3

You have to expand the row number as far as you can before adding it to the \tablines token list. Here's one way of achieving that: \documentclass{article} \newcounter{it} \newcounter{tot} \newtoks\tablines \newcommand{\addtomytablines}[1]{\tablines\expandafter{\the\tablines#1}} \setcounter{it}{2} \setcounter{tot}{7} \loop ...


3

Here's a solution with amsthm \documentclass{article} \usepackage{amsthm} \newtheorem{thm}{Theorem} \newtheorem*{innergoal}{Theorem \thegoal} \newcounter{goal} \setcounter{goal}{-1} \newif\ifnotfirstgoal \newenvironment{goal} {\ifnotfirstgoal\else \global\notfirstgoaltrue \stepcounter{thm}% \fi \xdef\thegoal{\thethm.\noexpand\arabic{goal}}% ...


2

You can do this with two counters, one inside the \addtomytablines command, and one for the main loop. (I don't fully understand why.) I took the liberty of cleaning up your code and writing it in LaTeX. \documentclass{article} \newtoks\tablines \def\addtomytablines#1{\tablines\expandafter{\the\tablines#1}} \newcounter{row} \newcounter{loop} ...


2

\documentclass{article} \renewcommand{\thesection}{\alph{section})} \begin{document} \section{First} \addtocounter{section}{2} \section{Second, but counted as fourth} \end{document} Another approach uses more 'configurability': \documentclass{article} \renewcommand{\thesection}{\alph{section})} \newcounter{sectionstoskip} ...


2

The \xintiloop from xinttools is an expandable loop, which provides an iteration index via the macro \xintiloopindex, hence this provides a simple minded tool for generating rows inside a tabular (the code for \xintiloop itself is only a few lines long, thus if one wished to not load any package, one could put it directly in the source file). Customize as ...


2

A \addtocounter{equation}{-1} will do. However, I don't get the nonumber directive in a equation you refer to later, so I deleted it: \documentclass{article} \usepackage[utf8x]{inputenc} \usepackage{amsmath} \begin{document} \begin{equation} \frac{\partial}{\partial ...


1

I cannot figure out what are you going to do. But for your subquestions: calculate the height of a node in a tikz pictures Similar to \widthof within tikzpicture \makeatletter \newcommand\getheightofnode[2]{% \pgfextracty{#1}{\pgfpointanchor{#2}{north}}% \pgfextracty{\pgf@ya}{\pgfpointanchor{#2}{south}}% \addtolength{#1}{-\pgf@ya}} ...


1

Here another method in LaTeX2e which defines a macro \blanklist[<width>]{<number>}: \documentclass{article} \newcounter{tablinegen} \newcounter{tabrow} \newcommand{\nl}{\stepcounter{tabrow}\\ \hline} \newcommand{\blankline}{\thetabrow & \nl} \newcommand{\blanklist}[2][.8\textwidth]{% \begingroup \setcounter{tablinegen}{0} ...


1

The exam class defines the partno counter, in order to achieve the startover at (b) the resetting of the partno counter has to be cheated by setcounter{partno}{1}. \documentclass{exam} \begin{document} \begin{parts} \part this is part a. \end{parts} \begin{parts} \setcounter{partno}{1} \part This should be part b. \part This should be part c. \end{parts} ...


1

It appears the names of counters and theorems live in the same namespace, so goal the counter and goal the theorem environment clobbered each other. Changing the counter's name to goalnarrow fixed the problem. I'd still be interested in hearing more info on why and preferred solutions. Minimum working example: The relevant bits of my preamble are: ...



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