# Tag Info

9

You can use the comment package: \documentclass{scrreprt} \usepackage{xparse,comment} \newcounter{psctr} \newcounter{probctr}[psctr] \NewDocumentEnvironment{prob}{o} {% \par \addvspace{.15in}% \addtocounter{probctr}{1}% \noindent\textbf{Problem \thepsctr.\theprobctr}% \IfNoValueF{#1}{ (#1 points)}% ...

8

This uses xparse, adding a second optional argument, but used as 3rd. argument, which makes more sense (since it's an addition to the 2nd (mandatory) argument. In addition, I switched to imakeidx which provides for multiple index files. \documentclass[12pt]{book} \usepackage{imakeidx} \usepackage{xparse} \usepackage{blindtext} \makeindex[name=example] ...

7

You can use the verbatim package which defines a comment environment for this purpose. So, writing \let\prob\comment \let\endprob\endcomment you are saying that your prob environment should be treated as a comment. MWE: \documentclass[liststotoc,bibtotoc,headsepline]{scrreprt}%draft \usepackage{xparse,verbatim} \newcounter{psctr} ...

7

I don't know why you want to do this but add \ignorespacesafterend as in {\ignorespacesafterend} Code: \documentclass{amsart} \newenvironment{eq$$}{$$$$}{$$\ignorespacesafterend} \begin{document} \begin{eq} a+b=c \end{eq} There is a extra space at the end of eq'' environment. % <---------- and don't leave a blank ...

6

I recommend using a style instead. This way, you just add , inp=<whatever> to the relevant parent node. \documentclass[tikz,border=5pt,multi,varwidth]{standalone} \usepackage{forest} \begin{document} \forestset{ inp/.style={ prepend={[#1, tier=in]}, }, } \begin{forest} [AND, inp=x [OR, inp=z, inp=y ] ] ...

5

5

You can't use \bgroup for delimiting a mandatory argument. And you want leaders to fill up the page with copies of what you absorbed. \documentclass{article} \newenvironment{double} {% \par % be in vertical mode \setbox0=\vbox\bgroup % start a box \strut % ensure good height for the first line \ignorespaces % ignore the end of line } {% ...

4

Here is your code: \newenvironment{FitToWidth}{ \begin{center} \begin{minipage}{\textwidth} \begin{center} \resizebox{\textwidth}{!}{% } { } \end{center} \end{minipage} \end{center} } This has the following syntax: \newenvironment{arg1}{arg2} But \newenvironment expects 3 arguments (optionally 4 or 5): ...

4

Capture the environment contents, and then resize it. The former is the difficult part, which is causing the problem. However, it's made easy by the environ package: \documentclass{article} \usepackage{graphicx,environ} \NewEnviron{FitToWidth}[1][\textwidth]{% \begin{center} \makebox[\textwidth]{resizebox{#1}{!}{\BODY}}% \end{center} } ...

4

Since you're already using cleveref, it provides the command \namecref. Use it as in the following example: \documentclass{article} \usepackage{amsthm} \usepackage{cleveref} \newtheorem{theorem}{Theorem} %[section] \newtheorem{lemma}[theorem]{Lemma} \newtheorem{proposition}[theorem]{Proposition} \begin{document} \begin{theorem}\label{any} My ...

3

Use the label key for the tcolorbox: \documentclass[12pt]{book} \usepackage[most]{tcolorbox} % this is my current "definition" environment \newtcolorbox[auto counter,number within=chapter]{definition}[1][]{ enhanced, breakable, fonttitle=\scshape, title={Definition \thetcbcounter}, #1 } \begin{document} \chapter{First Chapter} \section{Section ...

3


3

I personally use the versions package for this kind of work. \documentclass[12pt]{scrartcl} \usepackage{amsthm} \newtheorem{thm}{Theorem} \usepackage{versions} \includeversion{prop} %\excludeversion{prop} \includeversion{dem} %\excludeversion{dem} \usepackage{mathtools, amssymb, amsthm} \begin{document} \begin{prop} \begin{thm} ...

3

Regarding definining wrapper environments for other environments, it is better to use the 'real' commands for the environment begin and end macros, i.e. \equation and \endequation in this example and add the trailing % characters at the right position. The question is rather, whether is is useful to do such short wrappers at all;-) \documentclass{amsart} ...

3

The forest package grabs the environment contents with the help of the environ package. In these cases, the workaround is very simple: \newenvironment{cc}{\forest}{\endforest}

3

Unfortunately, xparse defined environments play bad with \beamer@collect@@body. A workaround is using environ: \documentclass{beamer} \usepackage{xparse,environ} \NewEnviron{itemframe}{\expandafter\doitemframe\BODY\ENDBODY} \NewDocumentCommand{\doitemframe}{mo u{\ENDBODY}}{% \begin{frame}{#1} \IfNoValueTF{#2}{NO OPT}{OPT} \begin{itemize} #3 ...

3

No, you can't use \phantom like that. You can use a \parbox inside \phantom to hide the contents, but reserving the space it occupied, or you could use the comment environment from the comment package to hide the contents suppressing the space altogether: \documentclass[draft]{article} \usepackage{comment} \begin{document} a \begin{comment} ...

3

There are two problems: the marco \sepfootnotecontent saves its contents locally which means it is forgotten after the environment ends. The second problem: the macro \BODY is saved as footnote content but what you really want is it the first expansion of \BODY and not the macro itself. With the help of the etoolbox package and its \patchcmd we can easily ...

3

You can make use of the title key directly in \lstnewenvironment{deflist}[3][]{% \renewcommand{\thelstnumber}{{#3} ::=}% \lstset{numbers=left,basicstyle=\ttfamily,title={#2},#1}% }{} then use \begin{deflist}[optional]{title}{sometest} If no title is needed use \begin{deflist}{}{sometest} On the other hand, if you don't like typing {}, you ...

2

This shows only a small amount of the tcolorbox and listings features: \documentclass{article} \usepackage[most]{tcolorbox} \begin{document} \begin{tcblisting}{listing options={numbers=left},colback=green,arc=0mm,auto outer arc} Some Code with math output: $E = mc^2$ \end{tcblisting} % And now listing only ...

2

After digging into the pgfplots code, I came up with this solution. I don't actually understand what this does, but it seems to work to add the following key-handling code: xticklabels/.code={% \pgfplotslistnew\tikzexample@xticklabels{#1}% \let\pgfplots@xticklabels=\tikzexample@xticklabels ...

2

The standard \newenvironment command doesn't allow parameters in the “end part”. You can use xparse and its \NewDocumentEnvironment command that does. \begin{filecontents*}{\jobname.bib} @article{BROUDIC1999, author={X. Broudic}, title={Whatever}, journal={Journal}, date={1999}, } \end{filecontents*} \documentclass{article} \usepackage[T1]{fontenc} ...

2

Like Ulrike said in a comment you can use csquotes block environments. Your attempt looks like csquotes' displaycquotes environment. The output of those environments can be customized by redefining the hooks \mkbegdispquote{<punct>}{<cite>} \mkenddispquote{<punct>}{<cite>} This will however affect all displayquote environments of ...

2

No need to change the internals of sepfootnotes: an \aftergroup trickery is sufficient. \documentclass{article} \usepackage{environ} \usepackage{sepfootnotes} \NewEnviron{nbp}[1]{% \xdef\nbptemp{{#1}{\unexpanded\expandafter{\BODY}}}% \aftergroup\donpb } \newcommand{\donpb}{\expandafter\sepfootnotecontent\nbptemp} \begin{document} ...

2

For code readability you may be better off to set the content using a specially-formed array: \documentclass{article} \usepackage[margin=1in]{geometry}% Just for this example \usepackage{amsmath,array,enumitem} \newlength{\LHS} \newlength{\RHS} \newenvironment{bigalign} {\[% http://tex.stackexchange.com/q/31672/5764 ...

2

I just stole the code from egreg's answer to the linked question Make enumerate` start from a new line and redefined the genthm environment, wrapping * and unstarred version together (with some minor caveat, the position of the star) and added the optional argument. \documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} ...

2

The trick is quite simple: we define a generic unnumbered theorem, where the theorem label is not explicitly given as a word, but given as a macro that we can redefine at will. The redefinition happens in the environment around this newly defined theorem environment: when you say \begin{genthm}{Name} the environment redefines \nonamethmname to the ...

2


2

tabularx is a horizontal mode construct so you can have \\after it but longtable is a vertical mode construct so you can not follow it by \\. \documentclass{article} \usepackage{tabu} \usepackage{longtable} \newcounter{StepListCounter} \newenvironment{steplist} { \renewcommand\item[2]{% \\[\medskipamount] \noindent ...

1

PLEASE consider using @Gonzola's answer as it is the appropriate way to proceed. A text editor that provides a good regular expressions functionality should allow you to patch your document in a single "search and replace" type of manner. I have attempted to use the number freestyle option for \newtcolorbox as described in the package documentation, but ...

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