Questions tagged [environments]

{environments} is for general questions related to (La)TeX environments. For questions about environment subcategories like {lists}, {quoting} environments, or {floats} use the appropriate tag instead.

Filter by
Sorted by
Tagged with
3 votes
2 answers
31 views

Fix spacing in custom matrix environment

I have made a custom matrix environment for using Gauss Jordan elimination, I need a vertical bar between the two halves of my matrix. Here is what I have slopped together \newenvironment{gjmatrix}[1] ...
LaTeXJunkie's user avatar
0 votes
0 answers
44 views

Code blocks for \newenvironment [closed]

Where can I find the documentation for \newenvironment ? Had a look in source2e.pdf but there in not much information. For instance, it does not mention the begin and end code blocks.
Fluffy's user avatar
  • 49
2 votes
2 answers
117 views

Custom Environment with Parentheses around Optional Parameter

I am trying to create a custom "proof" environment that behaves as follows: \begin{proof}\end{proof} should produce \textit{Proof.}, while \begin{proof}{method}\end{proof} should produce \...
Baguette Boy's user avatar
0 votes
1 answer
49 views

How convert equation environment to dmath environment automatically?

Sometimes I use software to generate Latex which does not support breqn package. It can create equation environment. Is it possible to add some code, in the preamble only, which converts any \begin{...
Nasser's user avatar
  • 20.1k
1 vote
3 answers
46 views

Figures not indenting with a custom environment

For my homework questions, I have multiple questions which present proof-type and standard solution-type answers. So as something similar to the standard amsthm \begin{proof}....\end{proof} ...
Ammardian's user avatar
1 vote
1 answer
51 views

Custom environments with referencing

I have a small number of examples (3, 4, or 5 maybe) which are repeated throughout my document to help the reader understand new concepts as they are introduced using the same set of examples. I would ...
SEP101's user avatar
  • 11
0 votes
1 answer
45 views

Fully expand an argument of a newenvironment created with expl3

In this answer, I was provided with the following code that solves my original problem. \ExplSyntaxOn \NewDocumentEnvironment{withalignment}{m} { \begin{\vincent_alignment:n { #1 }} } { \end{\...
Vincent's user avatar
  • 4,683
0 votes
2 answers
56 views

Expand macro in options list for environment

I am trying to define some options for an environment using a macro. \usepackage{tabularray} .... % previous parameter definition, does not scale \def\cellax{1} \def\cellay{2} \def\cellaw{4} \def\...
stimulate's user avatar
  • 107
1 vote
2 answers
82 views

Create a new environment that can switch between center, flushleft, flushright from based on a parameter

I would like to create an environment that, provided with either center, left or right creates a center, flushleft, or flushright environment. My current code is the following: \newenvironment{...
Vincent's user avatar
  • 4,683
1 vote
1 answer
48 views

What is the correct/best way to control the optional arguments of an environment so they can be easily edited later

Edit: I would like to know what the best practice is for creating a method to edit the desired optional arguments of all instances of an environment from one location. Motivation: So I'm using minted ...
GBR6000's user avatar
  • 38
0 votes
1 answer
27 views

How to make environments appear by using code abbreviations?

I am looking for a way in LaTeX to make environments like \begin{equation} ... \end{equation} appear by just typing in a self-made abbreviation, e.g. 'be'. For the reason that the abbreviation shall ...
user1234321's user avatar
2 votes
2 answers
43 views

Demoting unnumbered section using newenvironment not working for subfile

I am trying to export a tex using subfile into a main tex file. The file structure is the same for both the main file and subfile. The importing of the subfile is an addendum. The leveldown of the ...
Ozooha Ozooha's user avatar
0 votes
0 answers
12 views

Broken titleps page style with clearpage and thispagestyle after a custom environment

The titleps style does not apply the last page style for section 1.3 before the cleardoublepage command (see the custom \cleardoubletransition command). I think the bug is linked to titleps because if ...
vepain's user avatar
  • 23
0 votes
0 answers
12 views

Define a heading style command, which ignores leading white space if it is used at the beginning of an environment

I want to define a kind of heading, that i can use in a shaded environment. I want this "heading" have a bit of leading vertical space, but would like to eliminate this space if the command ...
Shylock's user avatar
  • 15
2 votes
1 answer
26 views

\AtBeginEnvironment does not work for the questions environment in the exam class

Please see the following MWE. \documentclass{exam} \usepackage{etoolbox} % The following does not have any effect on the output \AtBeginEnvironment{questions}{\setcounter{question}{4}} \begin{...
Masroor's user avatar
  • 17.7k
0 votes
1 answer
15 views

How to make minted work inside custom environments?

I have am using the macro below and sometimes I the content I pass in via the third argument contains a minted environment. However, the code doesn't compile. How can I fix this issue? \newcommand{\...
Chad Winters's user avatar
5 votes
3 answers
310 views

Why isn't my environment restored?

I don't know why, but I tried to follow https://tex.stackexchange.com/a/286089/116348 to redefine an environment like: \let\answers\questions \let\endanswers\endquestions in order to save and restore ...
tobiasBora's user avatar
  • 7,427
2 votes
1 answer
73 views

How to parse square bracket arguments into several curly braced arguments?

I have an environment which I specify w/... \begin{code}{TITLE}{LANGUAGE}{CAPTION} \end{code} I'd like be able to specify it instead like... \begin{code}[title={TITLE},language={LANGUAGE},caption={...
user41177's user avatar
  • 167
1 vote
3 answers
93 views

The display math mode and the `center` environment

I have asked a question at How to delete a command in the \BODY macro of environment defined by \NewEnviron about the problem when I try to convert my ex environment to the multi environment of moodle ...
phchon's user avatar
  • 51
1 vote
1 answer
34 views

How to make new environment using an existing environment? File ended while scanning use of \FancyVerbGetLine

I have a setup that works OK as is. I needed to make this code as an environment so less typing. When I do that I get an error. Here is the original setup \documentclass[12pt,titlepage]{article} \...
Nasser's user avatar
  • 20.1k
0 votes
1 answer
43 views

Cannot add pictures to new environment

I copy pasted an environment I found around here to create an "Example" section as defined below: \usepackage[framemethod=tikz]{mdframed} \usepackage{amssymb} \usepackage{etoolbox} \...
kid_a's user avatar
  • 1
1 vote
0 answers
82 views

How to delete a command in the \BODY macro of environment defined by \NewEnviron

My environment defined by \NewEnviron macro contains a macro \mymacro. How can to delete the macro \mymacro in the \BODY macro, when it executes? \documentclass{article} \NewEnviron{myenviron}{\...
phchon's user avatar
  • 51
0 votes
1 answer
34 views

Cannot create an environment for a table cell

I have an environment whose behavior depends some outer circumstances. In some cases, the environment should act as a table cell (and in other cases it should act as a paragraph). The appropriate \...
NickKolok's user avatar
  • 617
1 vote
1 answer
39 views

Toggle to hide minted environment

For a syllabus .cls I'm updating for work, I already have a answer environment, that is only shown when the documentclass is provided the answers toggle (by default, the class receives noanswer). I ...
pkok's user avatar
  • 63
1 vote
1 answer
35 views

Underfull hbox with tblr [duplicate]

I do not understand why this generates a Underfull \hbox (badness 10000) warning: \documentclass{article} \usepackage{enumitem} \usepackage{tabularray} \UseTblrLibrary{varwidth} \usepackage{xcolor} \...
leparc's user avatar
  • 131
1 vote
1 answer
26 views

Extra line from new itemize environment in tabular

I am having problems getting rid of the new line that appears in some cases in a newly defined itemize environment inserted in a tabular array: \documentclass{article} \usepackage{enumitem} \...
leparc's user avatar
  • 131
2 votes
1 answer
65 views

How to create a solution environment

I want to create a solution environment that works somehow like this: If at the beginning of the document, solutions are TRUE I want to show the text in the environment and be highlithed. If it is ...
Fischer's user avatar
  • 33
0 votes
1 answer
55 views

Stepslist: "Step k of n"

I am trying to come up with a new enumerated list environment "stepslist" such that the items are marked with "Step k of n", where n is the total number of items in one stepslist ...
Alp Uzman's user avatar
  • 284
0 votes
0 answers
34 views

How can I prevent a page break when defining AtBeginEnvironment?

I am trying to add a horizontal bar before my theorem environment, using \AtBeginEnvironment{theorem}{\medskip \noindent {\rule{\linewidth}{2pt}}\nopagebreak} However, the horizontal bar can still ...
Jared Maruskin's user avatar
3 votes
1 answer
32 views

Trying to modify multiaudience environment

I'm using the multiaudience package - works pretty nice. Here is an example \usepackage{multiaudience} \SetNewAudience{internGER} \SetNewAudience{externGER} \DefCurrentAudience{internGER} ... \begin{...
Georg's user avatar
  • 41
0 votes
1 answer
77 views

How to make a specific environment disappear? [duplicate]

I have got several Tikz pictures whose compilation takes up much time. More generally, I am wondering whether there is a switch that can make a specific environment foo disappear as if the code would ...
shuhalo's user avatar
  • 2,485
2 votes
1 answer
72 views

How to make verbatim option optional in my \NewDocumentEnvironment?

How to make the below \NewDocumentEnvironment 3rd argument optional verbatim (optional that escapes special LaTeX characters)? Below is the 3 ways for how to the custom style: (Keep in mind that the ...
Omar Shawky's user avatar
0 votes
1 answer
38 views

How to escape special characters passed as arguments to new environment?

I want to create a new environment that takes one of its inputs as a link which might contain a special character and I want it to be escaped without each person manually escaping each character. I ...
Omar Shawky's user avatar
0 votes
1 answer
65 views

Need help to define a custom environment

I want to define a custom theorem environment. I imagine it having two invisible boxes (pictured in yellow and red) where both boxes are filled with text from optional parameters and an equal sign ...
average math enjoyer's user avatar
0 votes
1 answer
36 views

Problem with new environment not reading some commands

I have created my first newenvironment! I had it working, and then I must have done something and it has stopped. The intent is to create an "aside" environment that puts a vertical space, ...
Peter Flom's user avatar
  • 1,176
0 votes
1 answer
61 views

How to force a LateX environment to start on a new page

How can I use \breakbox, in this example, to force the example environment defined below to continue on a new page? Here is an example to clarify: \begin{document} \maketitle \section{test} \begin{...
AHMED KRS's user avatar
1 vote
1 answer
16 views

Errors setting up a custom equation environment using \tcbhighmath

Currently, I'm writing a Macros package to store my custom environments and macros for my homework sheets. I'm trying to create a custom environment which I can define within my package (a .sty file), ...
Ammardian's user avatar
2 votes
1 answer
53 views

Behaviour of counters

I'd like to have a numbered list of marginal query-markers. My attempt (below) correctly gives marginal marks ???1 and ???2, but the increment within the itemize environment seems to get lost, and the ...
Tony Harker's user avatar
0 votes
1 answer
42 views

Creating own environment for writing partial oxidation and reduction reactions [closed]

I was wondering if it is posssible to write my own environment for writing redox equations in form of: O: ... R: ... ___________________________ S: ... O stands for oxidation, R for reduction and S ...
crvenikupus's user avatar
0 votes
2 answers
67 views

Problem renewing command inside an enumerate list

I’ve got a problem renewing a command inside an enumerate environment. I wish to make some exercises and to append the solution of each exercise to a predefined macro called “solutions”. Adding ...
ladi's user avatar
  • 23
1 vote
2 answers
30 views

How to use a variable in a thmnote

I'd like to have the "theorem name" of a theorem be populated using a variable. It isn't working as I had hoped, see below. I'm especially confused because I can successfully get the "...
macbeth's user avatar
  • 111
1 vote
1 answer
36 views

Beamer: Stepwise uncover itemize environment

To uncover all itemize environments in a presentation created with Beamer stepwise, I thought of redefining the itemize environment in the following way: \documentclass{beamer} \renewenvironment{...
NicolasBourbaki's user avatar
0 votes
2 answers
73 views

How to hide this proof depending on my command's value?

The following Latex code allows me to create an appendix automatically where proofs are stored by setting the value of the command \moveToAppendix to 1. \documentclass[a4paper,USenglish]{article} \...
J. Schmidt's user avatar
0 votes
2 answers
41 views

How to split complex alignments into multiple columns?

My document includes multiple recursive definitions. To increase readability, I split these definition into multiple (usually two) columns. To get more accurate alignments, I use array. Thus, ...
grbll's user avatar
  • 1
0 votes
1 answer
53 views

renewenvironment to change default color of tcolorbox

I want to change the default background color of the \tcolorbox environment. I really like /.append style but I know that's a TiKZ thing. When you uncomment the \renewenvironment in the header, ...
user26305's user avatar
  • 152
1 vote
0 answers
13 views

How to remove small horizontal line at the end of a loop with with noEnd=True in algpseudocodex

I'm using the algpseudocodex package with the option noEnd=True since I don't like the EndFor/EndWhile, etc, at the end of each loop. The problem is that I would like to remove the small horizontal ...
Zio Franco's user avatar
1 vote
0 answers
91 views

LaTeX Error: Environment longtable undefined

I've been trying to create long tables for my thesis. Everytime I compile I get errors that prevent the creation of a PDF view. Here's the code: \begin{longtable}{lllllllll} \caption{Table A.1: Poggio ...
madcat09's user avatar
2 votes
1 answer
77 views

Theorem environment overrides personal commands

I have defined a \imag command to assign the value of the imaginary unit with the font \texttt. However when I call the command \imag inside a theorem environment with the plain style the font is ...
SimoPape's user avatar
1 vote
1 answer
23 views

Prevent environments table and figure to change default colour

When environment table is invoked, everything within it becomes black. Similarly, the caption of figure is also black. In the MWE below, capital letters and caption are both black: \documentclass{...
Pygmalion's user avatar
  • 6,155
1 vote
1 answer
39 views

Wrapping verbatim environment (xsimverb)

I am designing a library that needs to deal with some verbatim code. For now, I use the great xsimverb package that provides nice things, like gobble, deal with basically all kinds of characters… I ...
tobiasBora's user avatar
  • 7,427

1
2 3 4 5
64