Tag Info

Hot answers tagged

15

Now that you added a new answer with all your requirements, I created an expl3 solution. This comes with an extra feature, that counts all lines (so if you leave two blank lines, then Line 6 Line 7 Line 8 are added). \documentclass{scrartcl} \usepackage{xparse,xcolor} \newcounter{srcline} \ExplSyntaxOn \NewDocumentEnvironment{scrlines} { } { \endgraf ...


9

I'm not sure how robust this solution is, but I simply redefine the catcode for the newline character to make it active, then append the new command to it. \documentclass{memoir} \usepackage{libertine} % want this font \usepackage{xcolor} % for color \usepackage{xspace} \newcounter{srcline} \newcommand{\linemark}{% \stepcounter{srcline}% ...


6

A slight modification of Manuel's answer to track lines even across paragraph breaks. \documentclass{memoir} \usepackage{xcolor} \newcounter{srcline} \newcommand{\linemark}{\stepcounter{srcline}% \textcolor{red}{\textsc{Line~\thesrcline}}} % Playing with the gobbling of \par \makeatletter ...


6

The report class uses chapter.equation numbering, enclosed by parentheses. If the equation number should be used alone without referring to the chapter number, then \counterwithout{equation}{chapter} can be used. It requires chngcntr package, however. \documentclass{report} \usepackage{amsmath} \usepackage{chngcntr} \begin{document} \chapter{First} ...


5

Peter's answer has the disadvantage of printing the text you put before subsection numbers in references to the subsections and in the ToC, as well. To avoid that, instead of renewing the meaning of \thesubsection, it's better to load the titlesec package and define \titleformat{\subsection}{\normalfont\large\bfseries}{Task \thesubsection}{1em}{} MWE: ...


4

\label{a} must be written before \\. And there was a \Equation error, most probably a typo. \documentclass[12pt]{article} \usepackage{amsmath,amssymb} \begin{document} \begin{align} a &= a \label{a} \\ b &= b \label{b} \end{align} Equation \eqref{a} is different from equation \eqref{b}. \end{document}


4

You have to set the counter enumi to the value of theorem at the start and set theorem to the value of enumi at the end. \documentclass{article} \usepackage{amsthm,thmtools,enumitem,lipsum} \declaretheorem[name=Theorem, numberwithin=section]{theorem} \newenvironment{thmenumerate} {\enumerate[ label=\thesection.\arabic*, ...


4

It is well known that the *-form of the \newtheorem command does not take any optional argument. The following code illustrates the correct usage: \documentclass{amsart} % Removed all irrelevant/superfluous/twice-loaded packages. \theoremstyle{definition} \newtheorem{thm}{Theorem}[section] \newtheorem*{prop*}{Proposition} \begin{document} \title{Big ...


3

Simply add numberwithin=chapter to the definition: \documentclass[12pt]{book} \usepackage[english]{babel} \usepackage[margin=2cm]{geometry}% just for the example \usepackage{xcolor} \usepackage{amsthm} \usepackage{thmtools} \usepackage{mdframed} \usepackage{etoolbox} \declaretheoremstyle[ spaceabove=6pt, spacebelow=6pt, ...


3

Well, after all, I think I could give this code a chance: \documentclass{article} \usepackage{amsthm,thmtools,enumitem,lipsum} \declaretheorem[name=Theorem, numberwithin=section]{theorem} \makeatletter \newenvironment{thmenumerate} {\enumerate[ label=\thetheorem, before=\def\@listctr{theorem} ]} {\endenumerate} \makeatother \begin{document} ...


2

Try using the pandoc-eqnos filter. You can install pandoc-eqnos as root using the bash command pip install pandoc-eqnos To tag an equation with the label eq:description, use $$ y = mx + b $$ {#eq:description} The prefix #eq: is required whereas description can be replaced with any combination of letters, numbers, dashes, slashes and underscores. If ...


2

Just reordering the position of the place where \begin{subequations} and \end{subequations} appear as the below example solves the problem: \documentclass{revtex4-1} \usepackage{amsmath} \begin{document} \begin{subequations} \begin{widetext}% I need this widetext thing. \begin{equation} 1 = 1 ...


2

The tocbibind has no provision for numbering the table of contents. The easiest method is to redefine \tableofcontents to do it and to load tocbibind with the nottoc option in order to avoid double inclusion. \documentclass[11pt,a4paper]{article} \usepackage[utf8]{inputenc} %Character set \usepackage[numbib,nottoc]{tocbibind} \makeatletter ...


2

Here's one possibility using the totcount package; process the document twice to get the value for the total number of blocks. In this first approach, you use the \countblock command for every block that you want to be numbered: \documentclass{tikzposter} \usepackage{lipsum} \usepackage{totcount} \newtotcounter{myblocks} \newcommand\countblock{% ...


2

As mentioned @Werner, this you can accomplised with emunitem packages or with paralist: \documentclass{article} \usepackage{paralist} \begin{document} \begin{enumerate}[(i)] \item A \item B \item C \end{enumerate} \end{document}


2

This uses enumitem and its ability to clone the usual enumerate lists with \newlist and define it as a maximum 2 level nesting list, with first level labelled lower case roman figures, the deeper level with upper case roman figures. \documentclass{article} \usepackage{enumitem} \newlist{myromanumerate}{enumerate}{2} ...


2

I suggest using enumitem to define your myenumerate, and also set \myitem to be equivalent to \item: \documentclass{article} \usepackage{enumitem} \newlist{myenumerate}{enumerate}{1} \setlist[myenumerate,1]{label=(\roman*)} \let\myitem\item \begin{document} \begin{myenumerate} \myitem A \myitem B \myitem C \end{myenumerate} \end{document} If ...


2

You should update two macros in order to achieve your desired output: \documentclass{memoir} \renewcommand{\chapternumberline}[1]{}% Gobble chapter number in ToC \renewcommand{\cftchapterdotsep}{\cftdotsep}% Chapter dots in ToC \begin{document} \tableofcontents \chapter{A chapter} \end{document} \chapternumberline formats the number associated with ...


2

Here's a way: \documentclass{beamer} \usepackage[persian]{babel} \usepackage[compatibility=false]{caption} \setbeamertemplate{caption}[numbered] \DeclareCaptionLabelFormat{rlnumber}{#1 \LR{#2}} \captionsetup{labelformat=rlnumber} \setmainfont[Script=Arabic]{XB Zar} \setsansfont[Script=Arabic,Numbers=Arabic]{XB Zar} \begin{document} \begin{frame} ...


2

The empheq package provides clever means to create nice equations. Using wrappers for some other setup requires some work to do (see section 6 Creating something new for examples and descriptions) I've decided to use a special reactempheq environment which uses the common equation counter but applies the (R1) format. The usual empheq environment is not ...


2

Something like this? \documentclass[12pt]{article} \usepackage{mathtools,amsthm} \newtheoremstyle{case}{}{}{}{}{}{:}{ }{} \theoremstyle{case} \newtheorem{case}{Case} \begin{document} \begin{proof} \begin{case} something \end{case} \begin{case} case \end{case} \end{proof} \end{document}


2

A solution with enumitem package, here without changing the paragraph counter format, only the enumi label is prepended with \arabic{paragraph} in the \setlist command. This will be applied for all enumerate environments. If the change should be local only, just say \begin{enumerate}[label={\arabic{paragraph}.\arabic*}] then. \documentclass{article} ...


1

As John Kormylo stated, you can use counters to adjust the page numbers in your document. The TOC title is showing in the heading of the first part because the default headers for the memoir class show the chapter title in the heading. This can be disabled with \pagestyle{plain} and turned back on later in the document if you want with ...


1

To get the right chapter labels, use \renewcommand\thesection{Chapter \arabic{section}:} EDIT @Werner makes an excellent point. Here's a better approach (may need to play around with the spacing) which won't mess up your labels and references. To change TOC appearance \usepackage{tocloft} \renewcommand{\cftsecpresnum}{Chapter } ...


1

Special care must be taken, of course, in order to produce the correct output also in the table of contents. The \@part command, as defined in the amsbook document class, issues an \addcontentsline command as follows: \addcontentsline{toc}{part}{\partname\ \thepart. \protect\enspace\protect\noindent#1}% As you can see, a period is added after \thepart; ...


1

Not knowing what document class you are using I cannot guarantee that this will work. This example uses the book document class and the associated \appendix macro to establish that the author is finished with the book and is on to the appendices, subsequently each chapter is treated like an appendix. Also, you should heed the comment from @ChristianHupfer ...


1

Had the same Problem once. The important thing is that you label your equation inside the equation environment. Otherwise \ref{eqn:x}, \autoref{eqn:x}, \eqref{eqn:x} will give you something else. 1.1 This works: \begin{equation}\label{eqn:x} v=\frac{s}{t} \end{equation} 1.2 This too: \begin{equation} v=\frac{s}{t}\label{eqn:x} \end{equation} 2. This ...


1

I am writing this answer based on another answer on this site and upon Christian Hupfer's answer here. There are many other useful points on that question too. %pdfLaTeX \documentclass{book} \usepackage{amsmath} \renewcommand\theequation{\arabic{equation}} \begin{document} \chapter{First} \section{First section} \subsection{First subsection} ...


1

Right now, you are changing the caption format for all captions in your document. In your case, \captionsetup[subfigure]{} or \captionsetup[sub]{} do not work as they are meant for real subfigures and not continued floats (56 seconds later, I fount out its [ContinuedFloat] from Ulrike's answer above :-)). Therefore, I would just add the caption redefinition ...


1

If you want a different style for continued floats setup them with their own format: \documentclass{article} \usepackage{caption} \DeclareCaptionLabelFormat{rlnumber}{#1 \bf{#2}} \DeclareCaptionLabelFormat{continued}{#1 #2-\arabic{ContinuedFloat}} \captionsetup{labelformat=rlnumber} \captionsetup[ContinuedFloat]{labelformat=continued} ...



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