{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
331 views

Parameterised Enviroments in Lyx

Ok, I have a set of structured data that I want to format consistently. In this case a set of spells for a role-playing game. Now in Latex I vaguely remember I could do something using ...
19
votes
7answers
1k views

How to create a command that automatically escapes curly braces?

How could I create a command that will automatically escape all curly braces within the current environment? For instance, I would like a command (or environment, I suppose) that allows me to write ...
12
votes
2answers
2k views

A new environment based on enumerate

I have defined the following simple environment: \newenvironment{renumerate}{\begin{enumerate}\raggedright}{\end{enumerate}} I wonder how the above can be modified to use with, say, the following: ...
8
votes
1answer
119 views

newenvironment with displaymath causes strange extra space/indent on following line [duplicate]

Possible Duplicate: Spacing issue for newenvironment wrapper of equation environment I have \newenvironment{mymath}{\begin{displaymath}\begin{array}{l}}{\end{array}\end{displaymath}} ...
1
vote
1answer
69 views

Avoid skipping before environment

I'm having trouble handling vertical space with my custom environments. I noticed that using \unskip after the environment eliminates that space, but I have found now solution for the space before ...
4
votes
1answer
183 views

Using cleveref with newenvironment

I am trying to refer to a newenvironment using cref from the cleveref package. Here is a MWE that demonstrates what I am trying to do. \documentclass{article} \usepackage{cleveref} % define a ...
5
votes
1answer
89 views

Can I redefine \begin so that it does not complain about undefined environment

I'd like to be able to do the following kind of thing: \documentclass{standalone} \begin{document} Foo \begin{MyUndefinedEnv} Bar \end{MyUndefinedEnv} \end{document} without LaTeX complaining ...
14
votes
2answers
236 views

Repeating environment contents twice

I'm writing a document where I have many code blocks like so: \begin{align} d = \sqrt{ (x'-x)^2 } \end{align} \begin{minted}{latex} d = \sqrt{ (x'-x)^2 } \end{minted} So the first line renders ...
3
votes
1answer
83 views

Renewenvironement error

I'm using the epigraphs package, but try to redefine the epigraphs environment (to later on add something to it, e.g. a page break before). So I thought I do it like this: ...
3
votes
1answer
461 views

how to redefine \href to \htmladdnormallink when in \htmlonly?

I use Scientific word (SW), which generates Latex, then I process the Latex output using Latex2html (l2h) to generate HTML as the support for HTML is better with l2h than SW (table of contents, break ...
3
votes
3answers
1k views

newenvironment, label, indentation

I have a custom environment that I reference. It seems that the indentation changes if I do not include a space before \label (see MWE below). So, I have a few questions: Should it matter where ...
4
votes
1answer
295 views

Multiple caption names for listings code (lstinputlisting) based on type of code

In my document I have used: \renewcommand\lstlistingname{Algorithm} \renewcommand\lstlistlistingname{Algorithms} to rename my lstlistings titles. The problem is that now I want to add a different ...
9
votes
2answers
939 views

Defining shared counters for theorem environments *after* environments are defined

I am trying to use the same numbering for theorems, propositions, definitions, etc. This is normally easily be solved by using amsmath and defining these environments and using the same counter: ...
8
votes
1answer
366 views

Custom environment with fancy text indentation

I am trying to typeset text by breaking it into smaller cameos, numbering each cameo, and putting a heading. See below for an example of how I want the typeset text to look. The code with which I ...
11
votes
2answers
198 views

How to define an environment that begins with a node?

Please see the following definition: \tikzstyle{boxStyle} = [draw=blue!80, fill=blue!9, very thick, rectangle, rounded corners=3mm, inner sep=10pt, inner ysep=15pt] ...
4
votes
1answer
6k views

passing options to the newenvironment

I have a GrayBox environment defined as follows. It is used \begin{GrayBox}...\end{GrayBox} or \begin{GrayBox}[\textwidth]...\end{GrayBox}, that is, it can pass optional parameter to the environment. ...
7
votes
1answer
114 views

Lists, counters, and refs

I'm trying to create an environment containing a single-instance, numbered list (so that I can easily control the spacing, etc.). The problem is that I cannot used \ref to cross-ref to the enumerated ...
7
votes
2answers
235 views

How to add an environment in the table of contents?

For example, if I use amsbook document class and have the section Problems, how to include problem environments created like: \documentclass[a4paper,12pt, reqno, oneside]{amsbook} ...
4
votes
2answers
561 views

Turning parts of text on and off

Is there a way to turn certain parts of the text on and off in LyX/Latex ? I'm thinking of having something like an environment (lets call it "TL" for "traffic light") and a parameter t such that if ...
28
votes
6answers
2k views

Is it possible to automatically enumerate sentences in LaTeX?

1.0.1 Is it possible to automatically enumerate sentences in LaTeX? 2.0.1 I want to thoroughly work through and criticize a longer text. 2.0.2 To facilitate quoting, I would like to typeset the text ...
8
votes
1answer
1k views

define a new Example environment

how can i define a new Example environment like the image shown in the following? this environment should have the following attributes: endmarks must be positioned at the last line, whether it ...
4
votes
2answers
158 views

Nesting custom `xparse` environments

I've defined two simple environments with xparse. Problem is when I try to nest todominute environment inside minutes environment: \documentclass[a4paper, 10pt]{article} \usepackage{polski} ...
8
votes
1answer
2k views

lstlisting in a newenvironment

I have a problem with the lstlisting package. I want to define an \newenvironment with one obligatory parameter, which will be the caption name for the lstlisting. I will also have other lstlisting ...
16
votes
1answer
554 views

What is the difference between \newenvironment and \newenvironment*?

I vaguely seem to recall reading that \newenvironment* gives better spacing than \newenvironment, but I don't recall any details and I can't seem to find a reference by searching. What is the ...
0
votes
0answers
78 views

Is there a way I can get the LaTeX environment? [duplicate]

Possible Duplicate: Where do I find out how a command/environment is defined? Is there a way I can get LaTeX environment for a given set-up? For example I want to get the value of some ...
3
votes
0answers
51 views

Two consecutive remarks on LyX [duplicate]

Possible Duplicate: Two math sections of the same type in a row? I am new to lyx, and I am searching for a way to create two remarks one after the other. When I create a remark, the only ...
10
votes
1answer
155 views

Environment with delayed expansion

I'm trying to define an environment test that stores its contents unexpanded in a macro \testcontents. For example, the code \newcommand{\cmd}{bad} \begin{test} \cmd \end{test} ...
1
vote
0answers
46 views

How to hold all lines in a defined environment? [duplicate]

\def\Grammercaption{\textbf{Grammer}} \def\grammer{\bgroup\ignorespaces\Grammercaption\fontsize{10}{13pt}\selectfont} \def\grammer{\egroup} I want all lines of text within this environment stick ...
2
votes
1answer
559 views

Left aligned multi line equations and \newenvironment

I'm building a table of integrals, for my own use. I need simple things: equations must be left aligned, sometimes I need alignment on the equal symbol and to save space sometimes I need 2 equations ...
4
votes
1answer
1k views

Creating a custom environment

I'm using the following syntax for my code snippets \begin{minipage}{\textwidth} \begin{lstlisting}[caption=<something>, label=<something>] The REST Endpoint URL is ...
6
votes
2answers
390 views

renewcommand for description

I have a document with many \description environments. All of them are defined like this: \begin{description}[leftmargin=2.5cm,style=sameline] \item[\texttt{foo}] bar ...
4
votes
1answer
622 views

Issue with \newenvironment and framed and quotation

\documentclass[a4paper,10pt]{article} \usepackage{framed} \usepackage{lipsum} \newenvironment{nb} {\begin{framed}\begin{quotation}} {\end{framed}\end{quotation}} \begin{document} \begin{nb} ...
7
votes
1answer
117 views

Feature Page

Lets say that I want to create a feature environment, which has two columns, in one column there is a picture (with a caption), in the second there is text. For the odd pages, I want the picture on ...
2
votes
1answer
84 views

Cross referencing in numbered environment

I picked up a template to write exams a while ago only. Each problem is written between \begin{problem} and \end{problem}. In the preamble I have \documentclass[12pt]{article} \usepackage{amsmath} ...
2
votes
2answers
123 views

Using environment argument in new macro definition

I'd like to be able to define an environment that takes a single argument and be able to use that argument to redefine an existing macro such that the argument of the environment gets used ...
6
votes
1answer
70 views

`advise` Environment in listings package

I was reading the documentation for the latex listings package and there are advises in it which look like so: I had a quick look in the source code for the documentation and it turns out that ...
8
votes
3answers
1k views

An environment for setting \emergencystretch locally

The following environment, copied from this website about dealing with overfull hboxes, allows one to change the \tolerance parameter for just the paragraph(s) it encloses: ...
14
votes
9answers
841 views

Looking for a more appropriate version of \cases

Often-times I find myself wanting to write something like, That is, a vertical brace followed by a table consisting of three columns, the first and the last are math, aligned where-ever I like, and ...
5
votes
1answer
4k views

How do I left and right justify text within an align environment

I want to simultaneously have text left and right justified around an align environment. I'm able to do this, but my solution seems like a dreadful hack. I really don't want to prepend every line ...
0
votes
1answer
89 views

Creating custom tabularx

I am trying to create a new environment in order to change the layout for tabularx, since the original is not looking like it should. I want the picture to be on the right side wrapped by the text. My ...
2
votes
2answers
869 views

Problem using \textblock with \newenvironment

I want to redefine the frame environment in beamer so that the contents are inside a box in the center of the frame, but when I try defining the new environment like: \newenvironment{hframe}[1] ...
5
votes
2answers
198 views

How to write an environment wrapping document environment

I'm working on wrapping up some patterns used in my research group for creating posters. Since we're using beamer and beamerposter to make these, all documents go essentially like this: ...
7
votes
2answers
2k views

Nested Environ's give “! Argument of … has an extra }” error

I tried using two Environ's in a nested fashion, but I get the ! Argument of \marray has an extra } error. Any idea why this happens? \documentclass{minimal} \usepackage{amsmath,environ} ...
6
votes
2answers
2k views

Redefine environment to be a synonym for another

I have a document with many description environments. I would like to change all these description environments to LaTeXdescription environments, without manually changing all the occurrences of ...
13
votes
2answers
5k views

Split-like environment inside cases environment

I'd like to have a cases environment with some cases that are too long to fit on one line. I tried this: \begin{cases} \begin{split} long expression \\ second line of long expression ...
7
votes
1answer
175 views

How to allow correct environment nesting when the environment definition involves labels?

The code below shows an improved version of the code provided in this answer to Mark (highlight) a paragraph (\item{...}) with a squiggly line for later attention. The environment tikzborder uses a ...
13
votes
1answer
1k views

Creating a new environment with referencing

I'm trying to create a referenceable "system" environment that basically displays an equation with a custom counter. Then I want to reference the environment with autoref, so as to have "System (S1)" ...
10
votes
1answer
108 views

Creating Command with environments

So I repeatedly use this format for embedding a picture and some text beside it, \begin{tabular}{l l} \begin{minipage}{0.3\textwidth} \includegraphics[SCALE]{NAME} \end{minipage} & ...
2
votes
1answer
352 views

Interrupt environment with command

At the moment I'm trying to figure out how I could interrupt an environment. What I did so far... \documentclass{article} \usepackage{amsmath} \newenvironment{envnew} { \begingroup \csname ...
8
votes
3answers
407 views

Indirectly defining two active characters within an \AtBeginDocument command

I'm trying to define a macro that uses two active characters inside an \AtBeginDocument command. I can write a macro such as the following using only one active character: \catcode`\_=13 \begingroup ...