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

27
votes
2answers
5k views

Definitive guide to trivlists

I create a lot of theorem-like environments, and I'm usually happy to employ a package (such as ntheorem, amsthm, etc) to do the work for me. After studying the ntheorem documentation, and reading ...
2
votes
1answer
73 views

Auto including the section into an (pre-defined) environment

There is a coherency problem in the following text (its typesetting). The last paragraph must not be considered as a part of subsect02. For instance it is a kind of conclusion of two approaches ...
15
votes
2answers
4k views

How to create new table environment

I am working on a book that has many many such tables. Is there a way to create shortcut for the code shown below. I want to make table caption a variable, because in the MWE shown below except ...
7
votes
1answer
325 views

Environment for step by step modification of graphics

I would like to have one environment that produces the following two examples where the pictures are not animations. I would like that the environment takes care automatically of the numbers of ...
4
votes
3answers
5k views

Redefine \arraycolsep for particular environments

How do I change \arraycolsep for a single environment? E.g., I have \arraycolsep set so that the white spacing on either side of "=" in the equation array environment is not excessive. However, this ...
2
votes
1answer
340 views

Custom environment to accept \item

How can I create an environment that takes items in a way similar to lists? Example: \begin{myEnv} \item{AAA}{BBB} \item{CCC}{DDD} \end{myEnv} I'd like the above do something like ...
3
votes
3answers
440 views

Making an environment that stores stuff in a box

Im trying to make make an environment that both: displays text and stores stuff in a box for later use. For this I need to use the input argument of the enviroment to manufacture a command name, i.e. ...
5
votes
1answer
287 views

Spacing between environments

I am trying to define a dialog environment while using the lettrine package. My problem are the spaces between the dialogs. There is no problem when a dialog consists of more than two lines. But ...
5
votes
1answer
345 views

Suppressing remarks when not needed

I have written some remarks in some of my works that are somewhat informal and repetitive in nature (mainly for my own clarification). I was wondering if there is a way of suppressing them when I ...
9
votes
1answer
1k views

hide proof environment for restructuring

I am writing my thesis, and i am in restructuring phase - sorting theorems where they should belong thematically. And it would be helpful to have all the proofs hidden so i am not laden with the ...
3
votes
1answer
2k views

How to define environment in LaTeX which replaces its content?

I'd like to define an environment that would display a graphviz image. The code should look like this: \begin{graph}{name}[optionalArgs] a -> b; /* graphviz code*/ \end{graph} I've ...
9
votes
1answer
772 views

Use the s (star) argument with \NewDocumentEnvironment

Would it be possible to use the s argument specifier of xparse in \NewDocumentEnvironment so that we get an environment an a starred version of it? Actually it works, but the star goes to the wrong ...
9
votes
1answer
192 views

Is there a way to replace an environment with a command?

Under certain conditions (triggered by selection of a package option) I would like to change specific environments into margin notes. However marginnote is not itself an environment, but a command ...
8
votes
1answer
1k views

LyX: how to make two “examples” not separated by a different environment? [duplicate]

I use LyX for some time now, but have not figured out how to put two "examples" (or exercises or theorems etc.) one after the other without having to separate them by a different environment. What ...
10
votes
1answer
2k views

Vertical space before and after custom environment

I've created custom environment with these commands: \usepackage{relsize} \newcounter{annotation} \def\theannotation{\arabic{annotation}} \newenvironment{annotation} ...
2
votes
1answer
695 views

New environment question

I am trying to create a new environment that works similar to the {\bfseries } command. For example: \documentclass{report} \usepackage{rotating} \newenvironment{stext} {\begin{sideways} \bfseries ...
1
vote
0answers
336 views

beamer: How to make an outline document with modified frame environment [closed]

In LaTeX Beamer there is the frame environment that can be used to put certain information on a slide. I want to create an outline document where the frame environment is replaced by something else. ...
1
vote
1answer
218 views

Combine listings package with my own environment [duplicate]

Possible Duplicate: How to use different lstset settings for listings? I have defined my own environment as: \newenvironment{codegui}[3]{% \def\tmplanguage{#1}\relax ...
4
votes
1answer
818 views

Using TikZ along with picture environment

Please see my examples: picture After TikZ \documentclass{article} \usepackage{color} \usepackage{tikz} \usepackage[english]{babel} \begin{document} \begin{tikzpicture} \path ...
10
votes
3answers
510 views

Adjust environments's behaviour when nested

I would like to define an environment which behaves differently when it is nested. This environment should ignore spaces at the begin and end of the environment. I have this working as I desire when ...
3
votes
3answers
541 views

Problem with expansion of \BODY

In the following MWE, the command \testStringNotEmpty tests if the argument is empty. This test is robust in the sense that the argument can contain a command or an environment... The environment ...
9
votes
2answers
4k views

Defining a custom environment with per-section numbering

I have an enumerate environment that I want to refer to later in my document using \ref and \label, but enumerate doesn't get numbered by section (the way, say, figure would). How can I add section ...
5
votes
1answer
479 views

Equivalent of \@afterheading for LaTeX3

I want to define an environment with LaTeX3 where I can supress the indention in the first line. For LaTeX2e you can use \@afterindentfalse\@afterheading. The example use this combination. But I want ...
10
votes
2answers
2k views

How to change color of some particular environment for entire document

I want to change color of particular environment in document. For example wherever I found verbatim environment or equation environment appears in my tex file. With some global settings, I want to ...
2
votes
1answer
266 views

Definining a new enviroment depending on a parameter

I want to create a new environment which depend if a parameter exists or not. The basic definition, which works fine, is: \newrgbcolor{bcolor}{1. 1. 1.}% \newenvironment{pbox} ...
10
votes
3answers
193 views

Ensure `description` or `itemize`

Is there a way to make sure that a macro can only be used inside a specific environment, say description? I am looking for something like the \ensuremath macro.
7
votes
1answer
314 views

Looking for a better code for my \newcommand

While preparing my lecture notes, I decide to create a command, possibly a new environment, that highlights when I am presenting a worked example. I came up with the following code. The code does ...
7
votes
1answer
1k views

New environment with minted

I want to create a new environment to transform this: \begin{listing} \caption{some caption} \label{code:label} \begin{minted}[options]{language} My code here \end{minted} \end{listing} ...
1
vote
2answers
377 views

Need help to construct an environment

I am typesetting a document, and I am trying to convert a command into a environment. Here is the original code and the first environment (which actually works). \newcommand{\crub}[1]{% ...
3
votes
1answer
274 views

float package: get list of all floats defined with \newfloat?

I develop a new package and as one functionality, I would need to get the list of all floats defined using the \newfloat command of the float package. I could of course modify this command in ...
4
votes
2answers
157 views

Errors passing the contents of a LaTeX environment to a macro

First of all, I'm sorry if this is a bit of an obvious newbie question, I've tried reading as many of the posts on here about doing this sort of thing, but was unable to get any of them to work. I'm ...
11
votes
3answers
390 views

How to \enddocument inside an environment

I have a document of the form \begin{document} some text \begin{myenv} .... \end{myenv} some other stuff \end\document I would like to set a boolean \newif\if@test in the header to control the ...
13
votes
3answers
13k views

Curly brace behind equations

I have the following question: I like to have a big curly brace behind the equations to show that they belong together and have only one equation number. An example without the brace would be ...
5
votes
1answer
7k views

How to change the font size during the new defined environment?

I want to change the font size of the new environment defined as below: \newsavebox{\ieeealgbox} \newenvironment{boxedalgorithmic} {\begin{lrbox}{\ieeealgbox} ...
4
votes
2answers
653 views

Paragraph indenting in an mdframed environment

I'm using the mdframed package and I've defined my own environment. But it seems that paragraph indentation doesn't work inside a mdframed environment. I've used the settings option of mdframed to ...
4
votes
1answer
927 views

Create a verbatim mdframed environment

I'd like to use and mdframed environment with verbatim in it. I've read the both documentations, googled but I've found nothing regarding this matter. MWE below: \documentclass[10pt]{article} ...
19
votes
2answers
775 views

Graph of dependencies from LaTeX file

This is inspired by the MO question here. Suppose I'm writing a math paper, with theorem and proofs, etc. At the end of writing, I want to design a graph of dependencies, that is, a graph containing ...
2
votes
1answer
818 views

Unbalanced braces with newenvironment / NewEnviron + Command

This is a follow-up question of my Unbalanced braces with newenvironment / NewEnviron post. The gist is that by using \NewEnviron{myEnv}{% ...
2
votes
1answer
638 views

Unbalanced braces with newenvironment / NewEnviron

I am trying to define an Environment myEnv s.t. \begin{myEnv} text1 \end{myEnv} text2} expands to \renewcommand{\myCommand}{ text1 } { text2} The reason for the obviously unbalanced expression ...
4
votes
2answers
223 views

Creating an Environment to Mimic News Websites

Sometimes literature and linguistic papers deal with journalistic texts. Therefore researchers need an environment that creates something looking like the beginning of this link (from the line "Japan" ...
16
votes
5answers
2k views

Command behavior depending on current environment

I would like to write a LaTeX macro whose code depends on the parent environment such as: \newcommand\test{ %if current_environment=env1 test1 %elseif current_environment=env2 test2 %else } ...
6
votes
3answers
961 views

Optional argument to an environment inside align

I have lots of matrices so I want to define a mat environment. I sometimes need the matrix to have right-aligned columns so I am using mathtools and I want to have an optional argument that is ...
18
votes
2answers
9k views

Block comments with *% and %*

I know the package comment which allows to use : \begin{comment} Lines to comment \end{comment} This is not very friendly to use. I would like to have the following possibility: *% Lines to ...
5
votes
1answer
1k views

Easy-to-use reference-able environment for restating theorem-like environments?

This question is a development of the same issue as this one; following my own answer and later comment there, I decided it deserves a spin-off. I would like to define an environment for restating ...
3
votes
2answers
2k views

Lyx nested environments

I would like to put an enumerated list into the body of a Lemma environment, in Lyx. This is what I would have: Lemma 1. First line of the statement i) condition 1 ii) condition 2 last ...
34
votes
4answers
8k views

Numbers outside Math environment

Should numbers inside the text be placed inside a math environment? For example, if I am writing ...indent code by 4 spaces..., should I write it this way or ...indent code by $4$ spaces...? ...
4
votes
1answer
434 views

Using LaTeX listings throughout the document

I've got a LaTeX document with a main file and many sub-files. Because we're writing a documentation we use code snippets everywhere. How can I define a listing and use it throughout the documents? ...
4
votes
2answers
1k views

Environment for text to run into margins

After posting this closed question, I found a good solution for memoir on this page. However, my margins settings are different then the ones he uses, and as a result, the widematter environment only ...
5
votes
1answer
1k views

Problems with quoting package and renewing quotation environment

Following this How to modify spacing around quotation environment? ...I have tried to use both given solutions (using quoting package and renewing quotation environment). I cannot use quoting package ...
1
vote
1answer
3k views

Why am I getting this “Missing $ inserted” error in an algorithm figure just like all my other algorithm figures?

I'm writing a paper in LaTeX, and I'm getting a strange "Missing $ inserted" error when I try to compile the paper using pdflatex, but only if it contains the following code. \begin{algorithm*}[tbh] ...