New answers tagged environments
2
votes
Accepted
How to reference tcolorbox title
(Disclaimer: I wrote the package, keytheorems, used in this answer.)
You should either use tcolorbox's built-in theorems library, or you can use the package keytheorems which uses amsthm under the ...
1
vote
Dynamically subtract space to make two tcolorbox environments continuous
It is not clear from the example code how the problem manifests itself.
A few points:
It is not elegant to create two (theorem-)environments for the same thing. The idea of LaTeX is that the ...
1
vote
Hide custom environment content based on boolean
A simpler answer with xparse and booleans, it can be nested, and no expansion problems
\documentclass{article}
\newif\ifshow
\NewDocumentEnvironment{testenv}{ +b }{\ifshow#1\fi}{}
\begin{document}
\...
1
vote
How to start itemize on same line as text?
I don't think this is still relevant, but someone I know had the same question as you. After testing egreg's answer in an existing file where I had already defined an other "Example" ...
3
votes
Accepted
Custom counters and environments in latexml
This is a known issue with \refstepcounter. The best solution is if you can employ something that can be labeled, such as an something using amsthm. You can also refer to this discussion.
3
votes
How to create a custom environment in LaTeX for a specific type of content?
You can use \newenvironment to create custom environments:
\documentclass{article}
\newenvironment{reference}{%
% at the start of the environment
\bfseries
}{%
% at the end of the environment
}
...
0
votes
How to put global variables in environments?
I'd exploit property lists.
\documentclass{article}
\ExplSyntaxOn
\NewDocumentCommand{\definevars}{mm}
{% #1 = tag, #2 = data
\manrique_var_define:nn {#1} {#2}
}
\NewExpandableDocumentCommand{\...
1
vote
Automation of custom tables
With the tabularray package, you could use the \NewTblrEnviron macro to create a new tabular environment:
\documentclass{article}
\usepackage{tabularray}
\NewTblrEnviron{mytable}
\SetTblrInner[...
1
vote
Accepted
Automation of custom tables
The code below loads the environment's contents and massages it.
\documentclass{article}
\usepackage[table]{xcolor}
\ExplSyntaxOn
\NewDocumentEnvironment{mytable}{O{\rowcolor{blue!30}}mb}
{% #1 = \...
2
votes
Automation of custom tables
With {NiceTabular} of nicematrix.
\documentclass{article}
\usepackage{nicematrix}
\NewDocumentEnvironment { mytable } { O { } m O { } }
{
\begin{NiceTabular}{#2}[hlines,#1,#3]
\RowStyle[...
1
vote
Accepted
Hook that executes a verbatim environment from fancyvrb
(In the question it is said that solutions are to work with older LaTeX releases, too. So with this answer neither xparse nor expl3 was used although this might have made the task considerably easier.
...
0
votes
Conditional environment using package option
I ended up using both answers to put something together that fits what I want to
\ProvidesPackage{solutions}
\newif\ifsolutions
\solutionsfalse
% If solution is false the environment should blank ...
2
votes
Conditional environment using package option
This is similar to Skillman's answer in that it uses \NewDocumentEnvironment and \colorbox. Since questions are usually typeset as lists, however, this tries to adapt to an enumerate or itemize ...
4
votes
Accepted
Conditional environment using package option
Based on \NewDocumentEnvironment, \colorbox this is rather straight forward. Please keep in mind that \colorbox doesn't allow page breaks inside your solutions.
\documentclass[]{article}
\begin{...
10
votes
Accepted
What does the \end mean in LaTeX's environment?
\end in latex is unrelated to the \end primitive described in the TeXBook.
It is essentially
\def\end#1{\csname end#1\endcsname\endgroup}
This means that \end{foo} will execute \endfoo if it is ...
4
votes
Accepted
Package with environment that changes according to option
You need \ProcessOptions\relax to handle package options.
\ProvidesPackage{solutions}
\newif\ifsolutions
\solutionsfalse
\DeclareOption{solutions}{\solutionstrue}
\DeclareOption{nosolutions}{\...
Top 50 recent answers are included
Related Tags
environments × 3277macros × 435
theorems × 153
spacing × 151
tables × 149
tcolorbox × 111
lists × 107
equations × 97
math-mode × 96
beamer × 93
listings × 92
tikz-pgf × 88
counters × 87
conditionals × 79
align × 78
formatting × 77
floats × 76
cross-referencing × 76
numbering × 74
enumerate × 74
verbatim × 69
page-breaking × 67
indentation × 66
errors × 64
optional-arguments × 62