{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.

learn more… | top users | synonyms (3)

2
votes
2answers
116 views

PGF keys passing arguments to multiple environments

I'd like to combine both tcolorbox and textpos to place boxes to a specific position in a page. Here is a MWE: \documentclass[]{article} \usepackage{pgfkeys} \usepackage{tcolorbox} ...
5
votes
1answer
37 views

The Environ package misbehaviour on empty content

I have encountered a problem with the environ package. It returns a wrong \BODY value when the content of an environment is empty. Here is an example: \documentclass[12pt]{article} ...
2
votes
0answers
80 views

using block environment for arabic/persian Beamer and right alignment

I have a problem with block environment in Beamer. I am using persian/arabic language. For the block environment, I want the title of the block and the text inside the block be aligned on the right ...
4
votes
1answer
254 views

How to create hide-able environments

I am relatively new to writing LaTeX packages. I would like to create an environment so that anything contained in that environment can be ignored when producing output. The desired behavior would ...
7
votes
1answer
203 views

Redefine block environment in beamer

I'm trying to redefine the block environment in beamer so that the itemize/enumerate bullets follow the color of block title instead of structure: \documentclass{beamer} ...
2
votes
1answer
85 views

Can the `verbatim` environment be used inside a custom environment definition?

I have the following code: \documentclass{minimal} \newenvironment{abc} {\begin{verbatim}} {\end{verbatim}} \begin{document} % This works. \begin{verbatim} abc \end{verbatim} % This does not ...
2
votes
1answer
58 views

Why is my custom wrapfig environment messed up?

I want to create a wrapper environment for wrapfigure in order to locally set \initextsep to 0. I know, it could be done differently, but this code is exhibiting strange behaviour. It moves the figure ...
2
votes
1answer
41 views

foreach and renewcommand

I want renew a variable in a foreach loop, but my codes won't work. Please help! \documentclass{article} \usepackage{pgffor} \newcommand\tests{ \newcommand\mytext{aaa} \foreach \i in ...
2
votes
3answers
64 views

Suppressing vertical space between environments

I specified two environment in a LaTeX document to highlight different lines of codes: \newenvironment{code}{\color{blue}}{\ttfamily}{\par} \newenvironment{codegrey}{\color{grey}}{\ttfamily}{\par} ...
7
votes
2answers
155 views

A problem with environment starting macro

For some reason I want a macro \BeginControl such that \BeginControl{\environment} is equivalent to \begin{environment}. I have put together some code. It usually works but there is a problem with ...
2
votes
1answer
72 views

Treat environment content as string, replace substrings and interpret afterwards

I would like to define an environment which "parses" its content and changes it before displaying it. An additional difficulty comes because I also need to replace whitespaces. The more flexibility ...
1
vote
1answer
174 views

How to learn LaTeX in the right way? [closed]

Many people always say that LaTeX is the best typesetting system which is flexible and powerful. For me, I have used LaTeX for one year already but I still have some problems with it. Let me talk ...
1
vote
1answer
40 views

font consistency in environment (theorem…) and in general text

I am using a template, and it uses the font \usefont{T1}{bch}{m}{n}\selectfont{}, the third font in the code and output, for the text in general. But this font is not used inside environments, like ...
6
votes
1answer
66 views

How to end a user-defined environment having conditional start definitions?

For silly example, the following user-defined environment initiates either the itemize environment or the enumerate environment, depending on the optional argument. But if the argument variable cannot ...
1
vote
1answer
85 views

Remove whitespace around own environment

Does anyone know how to remove the whitespace which is created by TeX everytime I use my own created environment? I tried the tricks with \ignorespaces and \ignorespacesafterend but that doesn't seem ...
1
vote
1answer
38 views

Problems using hooks

I am trying to duplicate a document using hooks at the beginning and the end. Here is a minimal example of my problem : \documentclass{minimal} \usepackage{environ} \usepackage{forloop} %Repeat ...
3
votes
1answer
104 views

What to use for itemize/enumerate/description type question

I have a lemma in which I want to say something like this: Let f be a function which satisfies either (A) f=0 and f is continuous, or (B) f=1 and f is well-defined. Then f is good. ...
4
votes
1answer
122 views

Blank left and right delimiters produce an unknown symbol

I recently compiled one of my files after updating my TeX distribution (including the unicode-math package, as I use the MinionMath font set) and noticed a strange error. In my file I used a cases ...
4
votes
1answer
68 views

How to condense environments and options to one environment?

In order to make grey boxes around code in my document I am using: \usepackage{listings} \usepackage{xcolor} %custom colours \usepackage{mdframed} %nice frames \definecolor{light-gray}{gray}{0.95} ...
0
votes
1answer
74 views

how to create a list for mdframed example boxs

So i found the question Make an Example and shaded box like in the book which fitted to my desires. I modified the box and counter so it fits to my whishes. (first number is the chapter second number ...
2
votes
1answer
34 views

Misplaced frametitle in new environment

In beamer, I defined a new environment for frame. My problem is, the frame title now comes along the text, instead of appearing at the top. See the working example. \documentclass[]{beamer} ...
0
votes
0answers
21 views

Call environment lstlisting without begin-end [duplicate]

I want to create a command for calling the lstlisting environment without the use of \begin{lstlisting}...\end{lstlisting}, i.e. I want to write something like \lst{text in enviromnent}. I have tried ...
1
vote
1answer
258 views

Enumerate with \noindent

I am creating a custom macro for enumerated lists, but with this attempt, I haven't been able to eliminate the indentation of the item numbers. Every time I use \myitemize, the lists still indents. ...
1
vote
1answer
38 views

Wrap single command as environment [duplicate]

I am trying to define a note environment, currently it is just a wrapper of \marginpar function like this: \newenvironment{note}{\marginpar}{} but \begin{note} Important Notes \end{note} will ...
3
votes
1answer
87 views

How to make a new figure environment that does additional stuff?

Currently I have a document in which most caption of figures and tables is placed in the margin, using mcaption. But for some figures and tables I need the full width (textwidth and margin). Both ...
15
votes
3answers
351 views

Environment to stack a word and a number

There is a requirement to write a list of words, underline each word and place a number centered below the line. Using the stackengine package I have prepared the following MWE. ...
4
votes
1answer
64 views

How to define a new left-aligned environment?

I am working on preparing a document in latex, and I need to define an new environment as follow: When the code is: \begin{IF} the sum of $a$, $b$, and $c$ is 10,\\ the product of $a$, ...
1
vote
1answer
48 views

Redefining an environment and summary box using grid and gridleno

This question is inspired by Gonzalo's great answer here concerning his creation of gridleno.sty to enhance the functionality of grid.sty. Ultimately I have two seemingly simple questions (please ...
3
votes
1answer
198 views

Shaded theoremstyle

I'm trying to create a theoremstyle whith a shaded background. As I already have a working preamble I'd like to change as less as possible. Previously I defined an own theoremstyle 'selfdefined' which ...
4
votes
2answers
94 views

Move tag next to equation in align environment

It's my first time asking here but I have got so much help from this site :D My particular case is that I need order and tag Maxwell's equations but I need set the tag in a particular location, just ...
1
vote
1answer
54 views

How to automatically escape special characters in your own environment?

I need to create my environment for examples of source codes. I want it to look like this: Code example: ------------------------------------------------ # This is the code example echo 'Hello' ...
33
votes
3answers
795 views

Do fontsize environments exist?

Without any doubt there are fontsize switches in the form of control sequences (described here for instance.) But, from time to time I ran into code examples where environment versions of those were ...
2
votes
0answers
34 views

(Is it wrong to) Use commands to begin and end equations (?) [duplicate]

I'm helping a professor write the second edition of his book, so I'm working with a lot of "old" code and bad practices. Something I've found is that he has defined macros for beginning and ending ...
2
votes
0answers
47 views

How do I make unruled footnotes within an environment?

I have a single environment, fancyfoot, in which I would like footnotes to have no rules. \documentclass{memoir} \usepackage{lipsum} \newenvironment{fancyfoot}{ \renewcommand{\footnoterule}{} ...
2
votes
2answers
91 views

Definition of a macro with multiple arguments and usage of \csname

Why does the following code not work ? \Requirepackage{amsthm} \renewcommand\newtheorem[2]{% \NewEnviron{\csname #1\endcsname}[1]{% ##1 : \BODY } } I have seen examples of the use ...
3
votes
2answers
43 views

How can I print beginning and end values of a counter within an environment?

I'm working on a formatting system for standardized tests. Within each section of a test, there are groups of consecutive questions that I might choose to contain inside an environment. ...
1
vote
1answer
42 views

Use macro as totcount counter name

In the top level of the document environment, a macro defined (using \def) can be expanded into the name of a totcount counter. This, for some reason, does not work inside an environment definition. I ...
8
votes
4answers
1k views

Making an anti-clockwise circled arrow around a + sign in a math environment

\makeatletter \newlength\@SizeOfCirc% \newcommand{\CricArrowRight}[1]{% \setlength{\@SizeOfCirc}{\maxof{\widthof{#1}}{\heightof{#1}}}% \tikz [x=1.0ex,y=1.0ex,line width=.15ex, draw=black]% \draw ...
2
votes
1answer
97 views

NewEnviron, \BODY and lstlisting [duplicate]

I was trying to understand egreg's answer to Hide content to show later, and I noticed that there were some problems when using lstlisting or tcblisting environments inside the solution environment ...
2
votes
1answer
140 views

Legrand Orange Book template Example colorbox from black to ocre

In the Legrand Orange Book template, I would like to change the begin and end of the Example Box color from black to ocre: and Here is the code from the structure.tex file where the example ...
4
votes
2answers
171 views

Is it possible to “scan” the text within an environment?

Say I have an environment env which is used like this: \begin{env} *Text* \end{env} Is it possible to "use" *Text* in the definition of the environment (top or bottom part) - similar as a ...
2
votes
2answers
134 views

“Problem definition” environment

Is there such a thing as an environment for defining problems? See this picture for an example of what I want to achieve: Thanks!
1
vote
0answers
14 views

Is it possible to include a lstlisting code block inside an lstlisting? [duplicate]

I am trying to include a LaTeX code within an lstlisting. But the problem is that the LaTeX code includes an lstlisting, so the \end{lstlisting} within the included code is terminating the actual ...
4
votes
2answers
104 views

Compilable custom environment when in the body text becomes uncompilable when defined as a new environment

I attempted to make a table which has gray backgound cells except for the first column and the first row colored blue. The following code successfully generates the desired output (although I do not ...
10
votes
2answers
245 views

Strikeout all text, including enumerated lists

Is it possible to define an environment that strikes out all text, even in enumerated lists? I am basically trying automate what is currently being done manually in Microsoft Word. I have a body of ...
0
votes
0answers
65 views

Predefining placement of figures and tables in custom package

I am trying to define figures in a new custom package using \newenvironment{name}{begin defs}{end defs} and minipage command (code is given below). if i create a \newcommand{\name}{defs} (named as ...
3
votes
0answers
44 views

Extensions to the standard environment, what is out there?

\NewDocumentEnvironment from the xparse package allows accessing environment arguments also in the code that is supposed to go after the content. environ and newenviron allow referring to the ...
2
votes
0answers
44 views

Can the hygiene problem of environ and newenviron be eliminated completely?

The packages environ and newenviron both provide an alternative to the standard environment macros included with LaTeX. The main difference is that they make it possible to refer to the environment ...
5
votes
1answer
175 views

What are the uses of being able to refer to an environment body by a macro?

The packages environ and newenviron both provide an alternative to the standard environment macros included with LaTeX. The main difference is that they make it possible to refer to the environment ...
3
votes
0answers
59 views

wrap around task environment not working

I am trying to create an environment wrapping a task environment (from the tasks package). To build the new environment I am using the xparse package. \documentclass{article} \usepackage{xparse} ...