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

9
votes
2answers
82 views

Can I redefine an environment to generate an error?

I know how to use \renewenvironment to redefine an environment, but instead of changing formatting, I'd like to have any use of the environment generate an error (log and abort). Is there a way to do ...
4
votes
2answers
844 views

Environment in \NewEnviron style, with key-value parameters

I want to define an environment that read its content before processing (like \newEnviron from the package environ) but also that allows key-value parameters (like \newkeyenvironment from the package ...
8
votes
3answers
2k views

Defining an Environment that Takes an Argument

I want to define a new environment that will take a text argument, and use it as a title. \documentclass{article} \usepackage{amsthm} \newenvironment{titleproof} {\begin{proof} \textbf{Title of the ...
9
votes
2answers
708 views

\newtoks token seems to have local scope

I want to collect the first line of a quotation to use later. I have used \newtoks for a similar purpose so tried it here, this way: \documentclass[12pt] {article} \newtoks{\qfirstlineinternal} ...
6
votes
1answer
500 views

Framed answer environment

I am trying to write a simple environment for the solutions of assessments I give. The code below defines such an environment: \newenvironment{answerenv}[1][Answer]{% Sets the default "Answer" but ...
4
votes
2answers
2k views

Replacing itemize by mdwlist's itemize* throughout?

Most of my documents start with a couple of quick hacks that save me literally a couple of keystrokes a month: \let\cite\texcite \let\epsilon\varepsilon and so on. Now, I'd like to do a similar ...
4
votes
1answer
731 views

Dynamically use RTF-Code in latex-document

I'm looking for a way to dynamically use Rich-Text-Format code in a latex document. The background is this: I want to paste formatted programming-source from visual studio into my latex code because ...
5
votes
1answer
696 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 ...
8
votes
1answer
679 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 ...
6
votes
3answers
1k views

Number mhchem reactions and create a \listofreactions

Is there a way to create an environment for reactions defined with mhchem that behaves similarly to equation in terms of numbering the reactions (including a \nonumber command)? Can I get a list of ...
2
votes
1answer
561 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}{% ...
8
votes
2answers
2k views

What are alternatives to block?

I use \begin{block} ... \end{block} to describe formalization of some notions, and I want to write some examples under it. I still would like to stick to the structure of a block (one part for title ...
3
votes
3answers
336 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. ...
2
votes
1answer
63 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 ...
7
votes
1answer
288 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 ...
3
votes
3answers
3k 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
296 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
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 ...
5
votes
1answer
252 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 ...
9
votes
1answer
543 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
164 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 ...
5
votes
1answer
720 views

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

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 ...
4
votes
1answer
627 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 ...
7
votes
1answer
1k 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
573 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
297 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
187 views

Combine listings package with my own enviroment [duplicate]

Possible Duplicate: How to use different lstset settings for listings? I have defined my own enviroment as: \newenvironment{codegui}[3]{% \def\tmplanguage{#1}\relax ...
10
votes
3answers
420 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
428 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
1k 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 ...
7
votes
2answers
2k 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
383 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 ...
1
vote
2answers
571 views

\newenvironment text exceeds the text width

I set up a \newenvironment, some texts in this environment exceed the text width, but this doesn't happen always. The following is the \newenvironment setup % is used for parameters within a detailed ...
2
votes
1answer
240 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
185 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.
5
votes
1answer
231 views

Changing the font for a custom environment

I can't figure out how to embed a command like \textbf or something in a newly created environment, I have: \newenvironment{definition} {\begin{quote}} {\end{quote}} I want to customize my ...
7
votes
1answer
271 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 ...
1
vote
2answers
316 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]{% ...
10
votes
2answers
3k views

tabularx inside a \newenvironment

There's something wrong with this code: \newenvironment{Tbl} {\begin{tabularx}{\textwidth}{|l|X|} \hline} {\end{tabularx}} but this is fine: \newenvironment{Tbl} {\begin{tabular}{|l|l|} \hline} ...
3
votes
1answer
231 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
142 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
329 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 ...
12
votes
3answers
8k 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 ...
4
votes
1answer
4k 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
455 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 ...
16
votes
1answer
506 views

What exactly does \@doendpe do?

Quoting from the LaTeX2e sources: [\@endparenv, \@doendpe] To suppress the paragraph indentation in text immediately following a paragraph-making environment, \everypar is changed to remove ...
18
votes
2answers
634 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 ...
4
votes
1answer
774 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} ...
4
votes
2answers
202 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" ...
2
votes
1answer
501 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 ...