Hot answers tagged

18

An environment can be defined in the LaTeX kernel (list, but also enumerate), in the document class (quote, titlepage), or in a package you load. There's no hard and fast rule for finding what's the case for the environment you want to know about. Of course, if you want to know the definition of bytefield, you'll look in the package that provides it. ...


7

\tcblower is a very special marker which ends an environment (the content box of the upper part) and begins another environment (the content box of the lower part). Therefore, all environments and TeX groups of the upper part have to be closed, before \tcblower is used. This also means that you cannot already begin an environment or TeX group for the lower ...


7

It is an environment by definition (as that's what the official latex manual calls it) however it does have one more or less unique property in that unlike any normal environment the content is not in a TeX group, this is for efficiency reasons and makes little observable difference as there can be no code after the environment that is executed.


5

Here's a tcolorbox version with sidebyside for the logo. Please note that such a box is not breakable! \documentclass{article} \usepackage[svgnames,dvipsnames,x11names]{xcolor} \usepackage[most]{tcolorbox} \usepackage[tikz]{bclogo} \newtcolorbox{framed}[1][]{ colframe=lightgray, colback=yellow!40!white, enhanced jigsaw, sharp corners, lower ...


4

Here's a variant based on the preceding code, which should work in any environment and is compatible with cleveref: \documentclass{article} \usepackage{ebgaramond, ebgaramond-maths} \usepackage{chngcntr, mathtools,} \usepackage{framed, etoolbox, cleveref} \makeatletter \newcounter{framedeqn} \AtBeginEnvironment{framed}{\let\c@equation\c@framedeqn\def\...


4

There's no need for a whole new equation environment, only a fake counter has to be established which is used inside by saying \let\c@equation\c@fakeequation Remember, that \c@foo is the internal representation macro of the counter foo, so this means that unless specified otherwise all operations to the equation counter are actually done with fakeequation,...


4

When you do \if\relax\givencasesteps\relax the first time, the macro \givencasesteps expands to \item This ... (... denotes other tokens that are irrelevant here), but \if continues expansion until another unexpandable token remains (there is already \relax). Hence \item is expanded and its expansion starts with \@hyper@itemfalse, which in turn expands ...


3

The basis of the environment you want already exists, if I've well understood: it's leftbar from the framed package. Here are two ways of patching it: \documentclass{article} \usepackage{framed} % \usepackage[table, svgnames]{xcolor} \newenvironment{note}{ \leavevmode \begin{tabular}{>{\columncolor[gray]{0.8}}p{0.1cm}p{0.2cm}p{\dimexpr \textwidth - 1....


3

I prefer to avoid monkeying with counter names. \documentclass{article} \usepackage[many]{tcolorbox} \usepackage{cleveref} \newcounter{savedequation} \newcounter{tcbequation} \newtcolorbox{note}[1][]{% code={% \setcounter{savedequation}{\value{equation}}% \setcounter{equation}{\value{tcbequation}}% \renewcommand{\theequation}{N\arabic{...


3

Very close to your code fragment, just replaces \fbox by \fcolorbox from the xcolor package: \documentclass{article} \usepackage{framed} \usepackage{xcolor} \usepackage{graphicx} \definecolor{note}{rgb}{1 1 0.5} \makeatletter \renewenvironment{framed}{% \def\FrameCommand##1{\hskip\@totalleftmargin \fboxsep=\FrameSep\fcolorbox{black}{note}{##...


3

Here is an elementary implementation of paradigm that sets up the tabular as well as the first column, based on a redefinition of \\. Note that you should avoid using a terminal \\ before \end{tabular} (or \end{paradigm}): \documentclass{article} \usepackage{array} \newcounter{paradigmlinecnt} \makeatletter \newcommand{\paradigmnewline}{% \...


2

You would have to edit latex.el, but as you said, not the best choice. Not heavily tested, but putting this into your init file should do the trick: (defun dj/remove-eqnarray () "Remove eqnarray*? from variable `LaTeX-environment-list'." (let ((evil-envs '("eqnarray" "eqnarray*"))) (LaTeX-environment-list) (dolist (env evil-envs) (setq ...


2

Here's my naive shot: \documentclass{exam} \newcounter{mydepth}% \newcommand{\myenvironmentname}{% \ifnum\value{mydepth}=0notinquestion\fi% \ifnum\value{mydepth}=1question\fi% \ifnum\value{mydepth}=2part\fi% \ifnum\value{mydepth}=3subpart\fi% \ifnum\value{mydepth}=4subsubpart\fi% \ifnum\value{mydepth}>4undefinedquestion\fi% }% \newcommand{\myquestion}{\...


2

Is this what you desire? I would apply the \if.... test inside of the TestEnvironment. \documentclass{article} \RequirePackage[utf8]{inputenc} \usepackage{xcolor} \usepackage{lettrine} \usepackage{blindtext} \usepackage{gtrcrd} \newcounter{Cnt} \setcounter{Cnt}{1} \input EileenBl.fd \newif\ifuselettrine \newcommand*\initfamily{\usefont{U}{EileenBl}{xl}{n}}...


2

I redefine the shaded environment from framed to have a frame, then define a note environment, based on ntheorem with option framed, as a shaded theorem: \documentclass[english]{article} \usepackage[utf8]{inputenc} \usepackage{babel} \usepackage{geometry}% \usepackage[x11names]{xcolor} \usepackage{fourier, erewhon} \usepackage{lipsum} \usepackage{...


2

Perhaps not the full solution, but it works by 'ignoring' the mandatory parameter of the environment. Since LaTeX expects mandatory parameters delimited by {...}, the usage of a parameter without {...} will just grab the first token: For example \newcommand{\foo}[1] \foo This is is a nice text will just grab the first character here, i.e. T and assumes ...


1

Since table cells are treated as TeX groups, toggling a conditional defined with \newif remains local in the group, i.e. \lighttrue will stick to that cell and the next cell (or row) is unaware of the change. In order to activate the change globally a \global\lighttrue or \global\lightfalse must be applied. \documentclass{article} \usepackage{calc} \...


1

I believe you want something like this: \usepackage{fancyvrb} \newenvironment{jeditoutput} { \VerbatimEnvironment \begin{Verbatim}% } { \end{Verbatim}% } The \VerbatimEnvironment tells fancyvrb to look for \end{jeditoutput} as the end of the environment, rather than \end{Verbatim}. Then you can proceed to use the normal fancyvrb environment. The % ...


1

The following is a comprehensive example showing various "theorem-like" environments. If you typeset this you will see that, while the theorem, axiom, proposition, lemma, and corollary environments set their text in italics (that's what the \theoremstyle{plain} does, among other things), the definition, example, exercise, and problem environments set their ...


1

Will this do what you want? (You may also create the Problem environment similarly.) \documentclass{article} \usepackage{amsthm} \theoremstyle{plain}% default \newtheorem{theorem}{Theorem}[section] \newtheorem{lemma}[theorem]{Lemma} \renewcommand{\qed}{\quad\hbox{\qedsymbol}}% run-in QED \begin{document} \begin{lemma} If integer $n$ is divisible by 4, ...


1

A preliminary version with article instead of abntex2 (that one fails!) \documentclass{article} \usepackage{tocloft} \usepackage{chemfig} \usepackage{environ} \newcommand{\listofstructformname}{List of structural formulas} \newlistof{structform}{stf}{\listofstructformname} \makeatletter \NewEnviron{structuralFormula}[1]{% \let\c@equation\c@structform ...



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