{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
1answer
46 views

Spurious horizontal space after \mbox{}\vskip0pt\noindent

How can one avoid the horizontal space (text indentation) created by the new line in the environment defined below? \documentclass{scrartcl} \usepackage[T1]{fontenc} \usepackage[american]{babel} ...
13
votes
2answers
232 views

Automatically replace environment align by equation+aligned combination

I would like to automatically replace the align environment by an equation + aligned combination. Specifically, whenever \begin{align} occurs, it should automatically read it as ...
3
votes
1answer
60 views

Thmtools example & solution environments share numbering with other environments

Following the answer to this question, I defined example and solution environments using the thmtools package, which I want to share numbering with the other environments in my document. Here is my ...
2
votes
1answer
75 views

Typeset math mode environments in scriptstyle

I need to typeset aligned environment in script style. Setting \scriptsize outside of the environment works, but the compiler complains: Command \scriptsize invalid in math mode ... Using ...
6
votes
2answers
187 views

Pass a command as optional argument of environment

Sorry for the beginner question, but I'd like to know if there is a robust way to do what the title says. The following MWE \documentclass{book} \usepackage[demo]{graphicx} ...
4
votes
3answers
123 views

Custom enumerate environment inside Fancybox

I would like to put a enumerate environment (customized with the enumitem package) inside of a shadowbox created from the Fancybox package. Here's my MWE: ...
1
vote
0answers
57 views

How to strike out over an environment and formulas and using local variables in latex?

While I am revising my papers, for the sake of easier tracking and saving the time of the reviewers, and hence shortening the review process (I hope!), I use the following commands \usepackage{ulem} ...
3
votes
2answers
61 views

Why is this environment giving me trouble? (enumitem package)

the next environment definition is giving me some trouble: \newenvironment{properties}{\textbf{\underline{Properties:}}\begin{enumerate}[style=(P_{\arabic*}]}{\end{enumerate}} When I try to use it, I ...
5
votes
1answer
59 views

How do I make text raggedright inside all miniboxes?

I have been looking at re-defining minipage so that it is always raggedright but that looks problematic because of the optional arguments. I have a long document which uses lots of minipages. I ...
3
votes
1answer
84 views

Odd behaviour without whitespace for \newenvironment

I'm very new to latex and am just learning things and want to understand why some code is behaving the way it is. I can't seem to find documentation regarding this specific behaviour. Essentially I'm ...
2
votes
2answers
169 views

How do environments work?

As far as I understand, when I specify \newenvironment{env}{ start }{ end } what LaTeX actually does is to define two macros \env -> start \endenv -> end so that \begin{env} middle ...
3
votes
1answer
98 views

Starting environment with \begin{env} or with \env{}

I have noticed that I can start some LaTex environment in two ways. For the frame environment in Beamer, for example, \begin{frame} % .. frame content .. \end{frame} is equivalent to \frame { % ...
3
votes
1answer
75 views

A new environment for the lower part of a tcolorbox

I would like to use an environment for the lower part of a tcolorbox instead of just tcblower command. I've tried with following code but it fails. \documentclass{article} \usepackage{tcolorbox} ...
0
votes
1answer
47 views

Dedication at the first page of a chapter

Is there already an environment to insert a dedication statement at the first page of a chapter? (Like in the below image) \documentclass{book} \begin{document} \chapter{one} \end{document}
1
vote
1answer
69 views

Can I eliminate the dot after Theorem in amsthm?

Instead of 1 Theorem. I want to write 1 Theorem in front of the first theorem and analogously in front of succeeding theorems. How can I get rid of the dot? Here is a MWE: \documentclass{article} ...
2
votes
2answers
145 views

Can I change the dot to a colon after Proof in amsthm?

I want to write Proof: in front of a proof instead of Proof. How may I achieve this? Here is a MWE for the set up I have now: \documentclass{article} \usepackage{amsthm} \begin{document} ...
0
votes
1answer
32 views

outer boxedminipage environment cancelling inner environment

I am using boxedminipage2e to create a framed box with some text in it. I am also using polyglossia, since sometimes this text is in Arabic, sometimes in English. The language environment within ...
1
vote
0answers
24 views

Why do I get an “extra }” error when using a default argument in a theorem name? [duplicate]

Consider the following latex code: \documentclass{article} \usepackage{amssymb} \usepackage{amsthm} \newtheorem{thm}{Theorem} \newcommand{\Zn}[1][n]{\mathbb{Z}_{#1}} \begin{document} $\Zn[p]$ ...
7
votes
1answer
56 views

Precise placement of picture possible?

To try to learn the picture environment, I decided to experiment with the placement of points on the page to see if I could really tell \LaTeX where to put stuff. What I found was that I can put stuff ...
4
votes
1answer
66 views

Define newenvironment using mdframed and align

I would like my math equations to have a gray background. My initial attempt at this was to simply "sandwich" my align environment by a mdframed environment. It would seem far easier to me though if I ...
1
vote
0answers
45 views

What is an environment, really? [duplicate]

I consider myself a moderately proficient LaTeX user. Occasionally, I want to do something that is similar enough to an implementation found in a package that duplicating it seems pointless, but ...
1
vote
1answer
39 views

How to create multi-pass command in a .cls

I have a command that creates some canned text at the top of a file that requires information about the location of an environment I've created. I've got the code for this all put together, and it ...
1
vote
2answers
35 views

Cannot wrap `\setchapterpreamble` in `\NewEnviron`

I am trying to include chapter quotes in a uniform way with scrartcl as well as scrbook. My final document will use scrbook however I am compiling individual chapters with scrartcl during the writing ...
2
votes
2answers
85 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
35 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
70 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
168 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
148 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
65 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
55 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
32 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
61 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
152 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
62 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
156 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
36 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 ...
5
votes
1answer
52 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
72 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
83 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
94 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
66 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
53 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
32 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
191 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
36 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 ...
1
vote
0answers
53 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
2answers
331 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$, ...