Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
22 views

Forcing markdown in a comment environment creates a runaway argument

I would like to create documents that include markdown within environments that can be hidden. Currently, I am using pandoc with a custom template and following the instructions for hiding ...
4
votes
1answer
59 views

Workaround for tabularx inside environment when using csquotes

I need an environment that presents data in a table. The number of right-most columns shall be adjusted at compile-time, and the first column is dynamic width. For this reason I am using \usepackage{...
2
votes
2answers
29 views

Nested newenvironment definitions, within a table

I'm trying to define two environments, one to be used inside the other. The first is a section in a CV, the second a subsection (cvitem). The latter holds an unordered list (commented for now, to ...
1
vote
2answers
44 views

How can we Define our own Simple Environment for Source Code?

Inside of our document we wish to define a new environment for blocks of source code \newenvironment{srcblock}% % Define the environment Later, we will use the environment: \begin{srcblock} % use ...
0
votes
1answer
46 views

Self-defined table template

When I write the template below, where: the first parameter has been designed for optional headers: the second has been designed to pass to tabularx. I get the following error: Forbidden control ...
2
votes
1answer
39 views

Define a new environment based on “proof”

I want to change the word "Proof" as in \begin{proof}...\end{proof} to "Solution". I found out that \begin{proof}[Solution]...\end{proof} could do the trick. But is there a way to define a new ...
7
votes
1answer
60 views

Effect of `\label` on caption position in new environment

I use a new environment and have tried to refer to it using the \label-\refcommands. I'm running into the problem that the \label command affects the vertical position of the caption. The MWE is: \...
1
vote
0answers
32 views

mintinline inside environ

\mintinline inside of an environment created by \NewEnviron of environ package seems to be strange. There are some unintended blank spaces, after the macros followed by \. What should I do to fix it? ...
1
vote
1answer
63 views

Formatting of new environment based on minipage and sidecaption

In my memoir-based document, I need to occasionally insert some content (text quote or pseudocode) and I want to be able to add a caption. Because the content must appear exactly where I want it, I ...
8
votes
2answers
367 views

Environment decorators

I'm looking for a way to write a "decorator" (in Python terminology) or a "wrapper" for LaTeX environments: a way to give addition behaviour with save of the notation. For example, before every \begin{...
2
votes
1answer
31 views

Setting up new font in environment

I'm defining a new environment to display some text in devanagari, but the text does not appear to be centered, despite defining \centering in the environment: \documentclass{article} \usepackage{...
7
votes
2answers
245 views

LaTeX 2e environment that “knows” the name of surrounding environment

I'd like to have a LaTeX 2e-environment which when occurring inside another environment "knows" the name of the surrounding environment. Is this possible? I know that \@currenvir provides the ...
0
votes
1answer
50 views

Environment definition adds vertical space above

I already have found the solution to define a new environment without the additional space above the paragraph. But why does the "vanilla" way of defining this not work? Pictures MWE \documentclass[...
2
votes
2answers
76 views

Create a new environment with the same numbering as \newtheorem

The setup \theoremstyle{definition} \newtheorem{definition}{Definition}[section] \theoremstyle{plain} \newtheorem{theorem}[definition]{Theorem} \newcounter{nremarkctr} \newcommand*{\nremarkname}{...
2
votes
1answer
104 views

Newly defined environment swallows the text it contains

I want to define an environment to format test directions. So I do this: \documentclass{minimal} \usepackage{lipsum} \newenvironment{directions} { \noindent \fbox{ \begin{minipage}[t]{...
0
votes
1answer
37 views

mcexam a custom type question

I'm trying to create an exam using the code provided by him. Here is the code: \documentclass[twoside]{article} \usepackage[english]{babel} % set fonts \usepackage[utf8]{inputenc} \usepackage[T1]{...
6
votes
2answers
217 views

Unwanted line break after beginning of solution environment in exam class

Question update: Ulrich's answer (and its iterations) largely achieves the desired behavior: An answer environment (ans is the answer environment in the new MWE provided below) where the end is ...
1
vote
1answer
32 views

LaTeX Error: \begin{zentriert} on input line 54 ended by \end{document}

i'm very new to latex and i'm trying to define a new environment that uses a existing environment and does some extra stuff at the beginning and the end. The environment i'm talking about is the "...
1
vote
1answer
16 views

How do I set multiple text styles in an envirnoment defined in a layout file?

I'm trying to make the font monospace, bold, and small at the same time in an environment defined in my layout file. This seems like a ridiculously simple thing to do, but I've been struggling with ...
0
votes
1answer
20 views

Command needed for proper textstyle

I would like to know if there is a predefined latex command/environment/package that I can use to write something in style "Availability" or "Lecutures" shown in the picture below:
2
votes
1answer
31 views

Automatic arrangement of the same type of theorem environments

Consider the following: \documentclass{article} \newtheorem{exe}{Exercise} \newtheorem{sol}{Solution} \begin{document} \begin{exe} \dots \end{exe} \begin{sol} here the ...
1
vote
1answer
33 views

How to make a new environment based on a given table

I want to make an environment obj (numbered by chapter) such that the command \begin{obj}{Text 1} Text 2 \end{obj} generates the following (assuming that this is the first obj environment in ...
2
votes
1answer
48 views

Creating own block environment in csquotes

I'm trying to create my own blockquote environment in csquotes. The \blockquoteQ command should behave like the normal \blockquote command but instead of typesetting the text upright and in quotation ...
2
votes
1answer
125 views

Defining a new environment

I have asked before, but I never got the answer I was looking for. (old question is here: Defining a new figure environment) As the title suggests I'm looking for a way to make 2 images stand side by ...
1
vote
1answer
51 views

Writing a theorem inside a theorem

I want to write couple of theorems inside a main theorem body. In particular I want to write something like the following: I tried using the command \newtheorem to create Main Theorem and then used ...
2
votes
1answer
32 views

Newenvironment - find the length of input

I am trying to define a new environment where the input text is placed inside a minipage, which has width equal to the length of the input text (something like a variable width box). What I would ...
1
vote
2answers
81 views

Conditional environment

In a huge document, I would like to use 'env1' or 'env2' environment depending on the value of a global variable 'flagenv'. How could I define an environment 'foo' so that I can write something like : ...
0
votes
0answers
32 views

creating theorems using newtcbtheorem and have them over multiple pages

I've stumbled upon this great question and answer was given by @Andrew, but I'm wondering: looking at the code and all if it's at all possible to have the theorems or even the lemmas or definitions ...
0
votes
1answer
24 views

Define \newtheorem environment using jheppub.styt

I am using the JHEP style for writing a paper in latex. I would like to define new theorem\definition... environments, for example \newtheorem{thr}{\color{Blue} Theorem}\numberwithin{thr}{section} ...
2
votes
1answer
34 views

How to define two labels inside an environment to compute the number of pages the environment spans?

I would like to count the number of pages that a certain environment (named myenv) spans. In principle, I set two labels, one in the beginning and one in the end of the environment. These labels ...
1
vote
1answer
42 views

Conditionals used in a new environment of detection of how many lines of quotation and with the selection of a language in XeLaTeX

I would like that a new environment of quotation/quote detect how many lines a text has, then will increase or decrease the quotation length/margin. For example: \newenvironment{citacao}[1]% {\...
0
votes
0answers
25 views

Adding conditional to environment

I want my assignment solutions to appear only when I set a variable to 1. Right now what I have is \documentclass{article} \newenvironment{solution}{\paragraph{\textbf{Solution:}}}{\par} \...
3
votes
1answer
76 views

Define a \<name> and \end<name> pair directly rather than define an environment called <name>?

While defining an environment <env> also defines the \<env> and \end<env> declarations, what are the circumstances where defining those declarations directly (without defining an ...
6
votes
1answer
51 views

How to compare number from \newenvironment argument

I am trying to create a new environment as follows \newenvironment{letters}[1]{% \vspace{-3mm} \ifnum #1=1% \else \begin{multicols}{#1} \fi \begin{enumerate}[label=\textbf{...
0
votes
0answers
27 views

How to setup multiple listing environment names

It works with one environment name. But failed with two names and above. MWE: \documentclass{report} \usepackage[top=3cm,bottom=3cm,left=4cm,right=3cm]{geometry} \usepackage{caption} % add ability ...
0
votes
0answers
31 views

Unexpected vspace between text and enumerate

I have the following big vspace that appeared after having modified and compiled my document. The latex code that corresponds to the picture is the following: % Presents the methodology steps. The ...
0
votes
0answers
22 views

LaTeX URL error occurs, but only if the URL is hidden

I have an environment that I sometimes hide using the environ package. I also include hyperlinks using hyperref, some of which contain the % sign. I'm running into a confusing issue where LaTeX fails ...
0
votes
1answer
51 views

Defining a new figure environment

I want to define a new environment, that sets up two \figure side by side. I have already done it manually, but I need to make a shortcut for it, so I can just write "\begin{sidebyside}"+enter to make ...
6
votes
0answers
69 views

Help with my custom environment

I am currently working on a document class for homework problems which should have a certain layout. To this aim I have created a new environment for the problems and it already works to some extend, ...
2
votes
1answer
38 views

Requested a small change in the code

I am not an expert user of TeX. I want to make a small change in the code below according to my need. The option for choices is \choise0 for wrong answer and \choice1 for the correct answer How do ...
5
votes
2answers
64 views

Customizing ref of reaction environment

I am using the reaction environment from the chemmacros package to typeset a few, simple chemical reactions. I would like to customize the way I am referencing to my reaction. Ideally, the whole ...
2
votes
1answer
31 views

Regular non-italic font in theorems

What can I do if I want a regular non-italic font character in the theorem environment? Neither text{} nor textit{} seem to work, and similar questions all ask about changing the style of the entire ...
1
vote
2answers
37 views

tikzcd doesn’t work in custom environment

I have a document class test.cls, in which I have defined a custom environment myenvironment using the environ package as follows: \NeedsTeXFormat{LaTeX2e} \ProvidesClass{test} \LoadClass{article} \...
0
votes
0answers
14 views

Creating Commands which Make New Environments [duplicate]

I want to make a command similar in idea to \newtheorem. Specifically, I need to create a command which defines a new environment that takes optional arguments. However, the command also takes in ...
2
votes
2answers
19 views

Wrapping a New Environment Around Theorem Environment

I'm trying to make a new environment which wraps around a theorem environment defined by newtheorem in the amsthm package. However, passing in a optional argument into the environment and then into ...
4
votes
1answer
108 views

Text after tcolorbox Overlapping with Figure inside wrapfig

I've been trying to use wrapfig inside a tcolorbox environment that has an amount of text that will not cover the height of the figure inside the environment. The following code resulted in the text ...
1
vote
1answer
43 views

Consecutive numbering in theorem enviroments, inside framed boxes

I want to write propositions, lemmas, theorems, corollaries inside the chosen boxes and definitions NOT inside boxes, all of them with consecutive numbering. I searched for similar posts and I found ...
1
vote
1answer
25 views

How to use boolean to toggle display of environment that may contain verbatim?

I'd like to create an environment solution that either displays its contents or nothing depending on whether the boolean solutions is set. Currently I'm trying: \documentclass{article} \usepackage{...
2
votes
1answer
19 views

excludecomment fails when used with newenvironment

I can hide a proof environment using the comment package: \documentclass{article} \usepackage{comment,amsthm} \excludecomment{proof} \begin{document} This is always printed. \begin{proof}[...
0
votes
0answers
13 views

How to use `renewenvironment` and `scalebox` to make `align` block fit within `\textwidth`?

So I have a lot of align environments. However, half of the equations do not fit within the \textwidth. I know that I can use renewenvironment to modify the align environment in such a way that the ...