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

Suggestions for an automatic taxonomy environment

Background In this site there are excellent examples of How to draw up a hierarchical tree diagram for taxonomic classification of several groups but often you must show only the position of a ...
9
votes
1answer
152 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
2answers
207 views

Ignore first parskip inside a save box

I have the following definition (MWE below) of a lrbox. If I use the normal setting parskip=off the interaction \mdf@restoreparams works as expected. Inside the lrbox I can use parskip and parindent. ...
8
votes
3answers
3k views

How to make LaTeX ignore the contents of an environment?

I would like to make a \todo command and environment whose behavior changes depending whether I define a command \showtodos. A basic \todo command is simple to write: ...
7
votes
2answers
350 views

Modify locally the “array” environment for Equation Systems

When I started to use LyX 2.0.6 I noticed that when an Equation System is needed, there are two options available to typeset it: using the appropriate command on the Math Line cases, or ...
7
votes
1answer
446 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 ...
5
votes
2answers
294 views

Multiple split equations

I find myself again and again using a combination of the gather and aligned environments. So it would be nice to not have to write so much. In particular, it is often only clear after writing the ...
5
votes
1answer
2k views

Extra intervals before and after flushright environment

I am preparing questionnaire template in LaTeX. I have the following code (simplified): \documentclass{article} \begin{document} \framebox{\parbox{4cm}{ \textbf{3. How often do you have a ...
5
votes
3answers
743 views

Change line spacing for normal text, but not in tabular or verse

\usepackage{setspace} \doublespacing I used above two lines to change the spacing in my document. This changes the spacing of the entire document. My requirement is to change the line spacing in ...
4
votes
2answers
273 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 ...
4
votes
1answer
582 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 ...
4
votes
1answer
729 views

Redefining the quote environment

Can somebody tell me what is wrong with this: %%Tweaked quote environment \let\origquote\quote \renewenvironment{\quote}{% \vspace{-0.5\parskip} \origquote }% {\endorigquote} My goal is to ...
3
votes
1answer
853 views

Beamer: Custom styles for environments

In beamer, there are some predefined (colour) styles like plain, theorem, definition and remark. My first question is where can I find the list of these styles? and the second one is how can I create ...
3
votes
1answer
186 views

typesetting a physical law

How should one type set one of Newton's law? \begin{definition} environment doesn't seem right since it should say the law's name in bold not definition (some number) and \begin{theorem} doesn't fit ...
3
votes
1answer
121 views

How can I define a new environment which limits the scope of \newtheorem commands?

I am attempting to make an environment out of the command given in one of the answers to this question: Customizing theorem name. \documentclass{article} \usepackage{amsmath} \usepackage{amsthm} ...
3
votes
1answer
252 views

prooftree from bussproofs package inside “cases” environment

I am using bussproofs package to provide some type proofs. According to bussproofs manual, it is impossible to use prooftree inside math mode. However, I would like to insert prooftree in the cases ...
3
votes
1answer
97 views

Is it possible to get the current item number and perform arithmetic on it in enumerate environment?

That is, suppose that I am at item n and I want to make a reference to item n - 3 without explicitly specifying it.
3
votes
4answers
605 views

Environment definition separates matching braces

Suppose I want to define an environment which is essentially a modification of an existing one. I tried something like that: \newenvironment{newenv}{% \formatcommand{\begin{oldenv}% }{% ...
3
votes
1answer
793 views

Defining a command for a minted environment

How can I define a newcommand macro or an environment for minted? What is causing the problem that the following does not work? \newcommand{\CppSourceCode}{ \begin{minted}[linenos=true, mathescape, ...
3
votes
2answers
312 views

algorithmic + babel with Hebrew conflict: Numbering missing

If I use algorithmic with babel, having both Hebrew and English, the line numbers go missing. Using MikTeX 2.9. \documentclass{article} \usepackage[hebrew,english]{babel} \usepackage{algorithm} ...
2
votes
1answer
28 views

Can't define environment whose macro code contains dot2tex environment

I try to define a new environment whose macro code contains the dot2tex environment from the dot2texi package (look at the appended MWE). Unfortunately the compilation ends with the following error ...
2
votes
1answer
142 views

Storing environment arguments

Consider this example: \documentclass{article} \newcommand{\baz}{} \newenvironment{foo}[1]{#1}{\makeatletter\g@addto@macro\baz{#1}\makeatother} \begin{document} \begin{foo}{bar} \end{foo} ...
2
votes
2answers
310 views

Time calculation for task reports

Consider this MWE: \documentclass{article} \newenvironment{dayreport}{\begin{tabular}{ll}\hline Task & Time\\\hline}{\hline\end{tabular}} \newcommand{\task}[2]{#1 & #2\\} \begin{document} ...
2
votes
1answer
382 views

How to hide a verbatim-like environment in another environment?

I cannot find a good title to express my question. Therefore, please parse the following code first. Minimal Code \documentclass[dvips,dvipsnames,cmyk,table]{book} ...
16
votes
1answer
335 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 ...
16
votes
1answer
519 views

How to define a starred version of an environment in LaTeX

I am interested in defining a new environment in LaTeX that has a starred version. How is this done?
11
votes
2answers
143 views

Is it safe to abbreviate \begin{foo}…\end{foo} with something like \bfoo … \efoo

Can I safely do this: \newcommand\bfoo{\begin{foo}} \newcommand\efoo{\end{foo}} where foo is a standard LaTeX environment? Probably the verbatim environment breaks, but others as well? That way one ...
10
votes
3answers
3k views

Defining a shorthand for amsmath's align environment (as commands)

I'd like to define a shorthand command for \begin{align*} and \end{align*}. When I write \newcommand{\ba}{\begin{align*}} it works fine. But when I write \newcommand{\ea}{\end{align*}} ...
9
votes
4answers
1k views

Use column-separator & (ampersand) inside \newenvironment

I'd like to define a grammar environment which basically wraps a tabular environment. Inside the grammar environment I'd like to use an environment called production to insert rows. Example: ...
8
votes
2answers
163 views

How to make a new environment behave like an existing environment?

I wish to create an environment that behaves alternately like a footnote, an endnote or a comment (i.e. hidden). For starters i've defined an environment "note" thus: \newenvironment{note} { ...
8
votes
2answers
97 views

Define a command so that it is only active within the document environment

I would like to configure a custom command so that it only affects the document environment. Because the command changes a number of catcodes, it has to be included after the begin{document} tag in ...
8
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 ...
8
votes
3answers
361 views

Masking \end{lstlisting}

I am not sure if I am using the right wording in title. Basically what I need is to add the following source using the listing package. In preamble: \usepackage{listings} then and is here when I ...
8
votes
1answer
3k views

Footnote in block statement

I have a presentation to make, and in this I present a quote in a block, like this: \begin{block}{Quote headline} Some truly great words some man made before me. \end{block}\footnote{And this is ...
7
votes
2answers
548 views

Own command to create new environment

The following code isn't very minimal but I hope you will be able to understand the code. \setcounter{errorcontextlines}{999} \documentclass{scrartcl} \usepackage{lipsum,ntheorem} ...
7
votes
1answer
875 views

Twocolumn part in document

I'd like to stretch long lists into two or more columns. Like: Some single-column text. Lorem 4. Sit Ipsum 5. Amet Dolor Another single-column text. Or: Some ...
6
votes
2answers
119 views

Using an expanded macro for optional environment argument

I'd like to open an environment, passing the content of a macro to the optional arguments. Up to now I tried different approaches using \expandafter, however I could not get the expected behaviour. ...
6
votes
2answers
151 views

Getting the first line of an environment

as the title suggests, I'm looking for a way to get the first (printable) line in an environment. My first naive attempt (ignoring the printable requirement) was something like this: ...
6
votes
1answer
137 views

Environment makes unnecessary page break

I have a problem with user-defined environments in LaTeX. Even though the content of an environment seems to fit, sometimes LaTeX makes an unneccessary page break after all. Here is my MWE: ...
6
votes
3answers
141 views

String parsing macro fails within custom cite command of biblatex?

I am trying to use the same string parsing macro as in String parsing macro fails within a minipage environment?; but this time in context of biblatex - and I'm having similar problems, I guess. ...
6
votes
2answers
520 views

etoolbox: environment hooks in boolean switch

What did I wrong, that the following does not work here: (Edit: I mixed up the true and false parts, but I don't want to change the code, because the answers refer to this in a way confusing one.) ...
5
votes
2answers
69 views

An environment for fixed figures

I am trying to create an environment that I can use to include "figures" within a framed environment. Because floats aren't allowed inside framed environments, I want to create a new environment ...
5
votes
2answers
208 views

How to color certain commands/environments?

My goal is to achieve colorings in the output document, that are similar to the syntax highlighting I use in my editor, so switching between the editing and viewing the document becomes easier on the ...
5
votes
1answer
221 views

Savebox with \bgroup/\egroup doesn't work in beamer (for environment)

This works: \documentclass{article} \newsavebox{\mybox} \begin{document} \savebox{\mybox}\bgroup This is a test.\egroup\usebox{\mybox} \end{document} But this fails (Missing } inserted. at the ...
5
votes
1answer
213 views

How to prevent pagebreak for a custom environment?

I use the following custom environment emailHeader and macros to format an email header (credits belong to egreg). \definecolor{emailHeaderBackground}{RGB}{225,225,225} ...
5
votes
1answer
164 views

Newenvironment not cursive

I created a new envrionment and it looks good, but I want to distinguish between normalfont and cursive font, so here is my code: \newshadetheorem{beispiele}{Beispiel} ...
5
votes
2answers
294 views

Redefining \enumerate using \let - why does it behave this way and what can I do to bypass it?

The following code produces a result, that I find quite strange: \documentclass{article} \let\origenumerate\enumerate \renewenvironment{enumerate}{\begin{origenumerate}}{\end{origenumerate}} ...
5
votes
1answer
842 views

Using versions environment tags inside a new environment definition

I just found out about the versions package here and am interested in using it to hide solutions in a problem set document. Recall that, to create versions block, in the preamble, you need ...
4
votes
2answers
95 views

Two kinds of equation labels within one paper

I have looked high and low for an answer to the following (including on this site, Google, etc.) without success, and I hope someone may be able to answer it (and if it is a repeat of something ...
4
votes
1answer
214 views

Converting string to number

I am trying to write an environment which provides (some of) the functionality parallel environment through tabular syntax so that the following two code snippets would give equivalent results: ...