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

1
vote
0answers
37 views

What is a good environment for writing problems and solutions? [on hold]

I'm writing a book where I record interesting problems and their solutions. However, there does not seem to be an organized list, or other reference to these types of latex packages and tex macros. ...
8
votes
1answer
72 views

Irregular spacing around a user-defined environment

I have defined an environment for consistently typesetting a pair of alternative assumptions being made. The idea is that wherever I make an assumption, the assumptions are indented and on the left ...
1
vote
2answers
37 views

Abstract page of babel[magyar] undefined

I am working on a document that uses a custom class. I want to change the class so that it would use the babel[magyar] instead of the english version. However, when I try to do so, I get the ...
4
votes
1answer
1k views

Reduce space before and after an environment

A simple(?) question, how do I reduce the space before and after a environment? I suppose I'm after a redefine environment command that I can put at the top of my document. Example I'm using ...
5
votes
2answers
83 views

Display environment differently for one use vs. two

My issue can be boiled down to this: \documentclass[10pt,oneside]{article} \usepackage{enumitem} \newenvironment{mygroup}{ \vspace{.15in} \textbf{\large MyGroup Heading} }{ } ...
3
votes
1answer
90 views

lilypond environment inside a table

While making a song book I came to a point in which I wanted to insert lilypond code inside a table (tried also a box); this was due to some placing notes around texts and similarly things. But this ...
3
votes
1answer
39 views

edit an environment to add to a new extra parameter

I'm trying to define a new \newenvironment but I'm having some problems. I need an environment that uses a counter and uses an extra parameter to write some text. I'm working with this environment: ...
0
votes
3answers
70 views

Problem with lstlisting environment

I'm writing \documentclass{beamer} \usepackage{listings} \begin{frame} \begin{lstlisting}[language=bash] #!/bin/bash echo "Hello,world!" \end{lstlisting} \end{frame} But the output ...
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 ...
1
vote
1answer
20 views

Compatibility issue with \renewenvironment{figure} and [H] placement

This is related to Shift all floats on page horizontally. While trying to redefine the standard figure environment I've run into compatibility issues with the [H] placement specifier from the float ...
4
votes
2answers
33 views

Checking if a subenvironment is unique inside an enviroment

I would like to define a environment inside another environment, but I need to make sure the new environment is unique, so there can only be of them. The unique environment should also be able to be ...
4
votes
1answer
53 views

Defining a null environment

I am writing a mathematical document and I want to make a overview document, in which I only present the theorems and definitions and not the proofs, so I thought that I can change the environment ...
0
votes
1answer
110 views

Longtable integration Stata

As far as I am aware, the available commands that produce LaTeX-formatted tables of stored estimates using Stata, will only produce tables using either the table or tabular environments. Do any other ...
0
votes
0answers
29 views

Insert portion of code before every line break in gather environment

This is a follow-up question to Redefine equation environment: auto labeling. I want to have something like \AtEndEnvironment{gather}{\label{equ:\theequation}}(at the end) plus ...
3
votes
1answer
12 views

Reference to \lstnewenvironment

\documentclass{scrreprt} \usepackage{regexpatch}% http://ctan.org/pkg/regexpatch \usepackage{color} \definecolor{codecolor}{rgb}{0.8,0.9,0.9} \definecolor{chatcolor}{rgb}{0.9,0.9,0.8} ...
2
votes
1answer
59 views

How to delete the contents of the current paragraph and “re-start” from the beginning?

I want to use an environment defined in a 3rd-party package which I cannot modify. Stripped down, the definition looks like this: \newenvironment{myenv}[1]{ % some stuff here \textbf{#1} }{% some ...
4
votes
1answer
89 views

newenvironment using pgfplotstable

I want to have a newenvironment body as an inline input argument for pgfplotstable. Is it possible to do this without using braces in the body itself? \documentclass{article} ...
2
votes
1answer
408 views

Insert text before end of page, and at the beginning of the next page

I'm putting a template together and I have created a custom command which I'm going to use to set specific margins on the text passed to its argument and a few more formatting things, like this: ...
5
votes
2answers
82 views

Suppressing whitespace at end of environment

This must have been answered before, but I'm afraid I can't find it. I'm defining an environment and I want the end block to be formatted immediately after the end of the contents, without ...
3
votes
1answer
40 views

Can a scope environment behave like a node?

The following flowchart was made in PowerPoint, and it describes the input and output of a function. As you can see, the diagram is quite intuitive: a set of files are piped into "Function", and it ...
1
vote
1answer
31 views

Redefine equation environment: auto labeling

Hi i want to auto label every equation with its number (\theequation), i found a simple solution (to avoid manual environment redfinition) but i cant figured out what i am missing. Why it doesnt ...
1
vote
2answers
69 views

Combine minted and tcolorbox for code from file (inputminted?)

Thanks to Thomas F. Sturm and Gonzalo Medina I have a nice looking environment for code listings with appropriate ref functionalities. However, I just cannot figure out a way to make the defined ...
2
votes
1answer
29 views

enclosing a lstlisting environment inside my own environment using matlab-prettifier

I've just started using matlab-prettifier. Since the line \begin{lstlisting}[style=Matlab-editor] is a lot to type, I created my own environment: \newenvironment{myMP} ...
1
vote
1answer
88 views

macro: call parameter of level above - double pound ##1 doesn't work

Once again, I have a macro problem. It works almost. I spend a lot of time googling about \expandafter, \noexpand, \unexpanded and others. I used some of them, but nothing lead to the desired result. ...
56
votes
8answers
4k views

Why can't the end code of an environment contain an argument?

Environments are allowed to have arguments, but reference to those arguments can only appear in the opening code of the environment, and not the closing code. What is the reason for this, and are ...
7
votes
1answer
178 views

Have a command acting on the environment body

I need to turn this \begin{FOO} my little pony \end{FOO} into this \bar{my little pony} I have tried this: \newenvironment{FOO}{\bar}{} But this seems to only make \bar apply on the first ...
3
votes
2answers
67 views

How to implement a verbatim or null environment using a boolean within \newcommand

I am trying to use a boolean environment within a \newcommand statement to selectively implement a verbatim environment. When I set the boolean to true it should put the "Answer" within the verbatim ...
5
votes
0answers
89 views

Using cprotect and environments with multiple arguments

Is there a way to use the cprotect package's \cprotEnv command to use verbatim inside environments that have optional or multiple arguments? My motivation for this question: I am working with ...
2
votes
2answers
34 views

Use \newtheoremstyle to define a custom example environment

I am trying to define a custom example environment for my thesis, but with my limited knowledge of LaTeX I am not able to figure this out from the amsthm documentation. Here is a minimum working ...
0
votes
1answer
26 views

Footnotes in multipage environments

I'm in conflict with how mdframed handles footnotes inside environments that span multiple pages. Consider this MWE \documentclass{article} \usepackage{lipsum} ...
8
votes
2answers
9k views

pdfTeX warning: destination with same identifier has been already used, duplicate ignored (weird behavior)

Here is a minimal example: \documentclass{amsart} \usepackage{amsthm} \usepackage[pdftex]{hyperref} \newtheoremstyle{myexercise}{\baselineskip}{\baselineskip}{}{}{\bfseries}{.}{ ...
5
votes
4answers
143 views

Use \newcommand in \newenvironment - content of environment is argument of \newcommand

I want to create an environment, that generates a new command. There are some similar examples on google, but nothing fits exactly. The minimal (not) working example shows best, what I want: ...
3
votes
1answer
28 views

Defining an environment using the collect package

I want to define an environment aufgabe which uses the collect* environment from the collect package. If I built a file like this (without a custom environment), everything is fine: ...
19
votes
1answer
232 views

How can I make a custom environment that wraps listings?

Thanks to this answer, I know it is possible to float and wrap text around a listing. I would like to setup an environment for mini-code snippets that always floats and wraps the same way. I can ...
2
votes
1answer
44 views

\renewenvironment{document}

I would like to use \usepackage{filecontents} to write another version of my document to a file later with \write18 and compile it. My question is: How do I create a custom \begin{document} to ...
0
votes
0answers
43 views

NewEnvironment not working?

I'm not sure what I'm doing wrong here. I'm new to LaTeX so I'm clearly committing some obvious mistake. To my understanding the syntax of \newenvironment is \newenvironment{name}[paramaters]{code ...
3
votes
1answer
58 views

Using newcommand inside newenvironment to print a table

I have the following self defined counter and command: \documentclass{article} \newcounter{usecase}[section] \newcommand{\usecasenumber}{\arabic{usecase} \stepcounter{usecase} ...
1
vote
0answers
23 views

Using newcommand and newenvironment to print a labled tabular [duplicate]

I posted this question as guest with some issues that should be fixed in this version so here it goes. I have the following self defined counter and command: \documentclass{article} ...
1
vote
0answers
15 views

Small wrapper for easylist using \item like syntax and a new environment

I'm trying to create a new environment for using the package easylist so that some users that are not used to LaTeX can easily make use of it. Right now the environment and its custom commands are ...
2
votes
2answers
84 views

How to not typeset LaTeX content? Or how to leave out LaTeX content?

Consider the following minimal example: \documentclass{article} \begin{document} foo \setbox0=\vbox\bgroup \label{baz} \ref{baz} \egroup bar \end{document} Whenever you run LaTeX you get a warning ...
5
votes
0answers
57 views

How to tell LaTeX to throw a warning if argument is not being used?

In this question the given argument wasn't used, because #1 was missing.. One would actually assume an error or a warning be thrown. A little MWE based on 1: \documentclass{article} ...
1
vote
1answer
22 views

change caption of multiple listing styles

I want to have different listing environments, each with an own caption. My try was this (vorlage.tex): \documentclass{scrreprt} \usepackage{regexpatch}% http://ctan.org/pkg/regexpatch ...
1
vote
0answers
13 views

How to let table stay in example environment? [duplicate]

My table is choosing not to stay in the example environment I created for it, however the text I placed in there are included. I notice that when I remove the table environment and let tabular remain, ...
1
vote
1answer
24 views

Supressing indent on the following paragraph

I have made a environment that formats some example text in a box that sets it apart from the main text of the book. It becomes a sort of a figure that the other text refers to. There is plenty of ...
2
votes
1answer
27 views

How can I apply a custom-defined theorem environment to nested theorems WITHOUT using a proof environment?

I'd like to combine a couple of constructions I've found on this site to create a custom-defined cases environment so that each case will: be nested within a larger theorem environment; end with a ...
1
vote
1answer
32 views

Tie two environments together

I have a rather large document with the following structure \newenvironment{A}{sth.}{sth.} \newenvironment{B}{sth.}{sth.} \newenvironment{C}{sth.}{sth.} \begin{A} \begin{B} \end{B} \begin{C} \end{C} ...
1
vote
1answer
48 views

Environment inside \newcommand [duplicate]

This is my first question so feel free to correct it in any way. I am struggling with the following problem: using an environment in a \newcommand. I want to define the command \describe this way: ...
4
votes
2answers
76 views

Multiple Environment Options

How does the tikzpicture environment support multiple options, e.g. \begin{tikzpicture}[red, thick] ... \end{tikzpicture}? According to some LaTeX documentation, multiple options are not permissible ...
6
votes
1answer
51 views

Create custom note environment with tcolorbox

I just stumbled upon the tcolorbox package but can't seem to find my way through its extensive manual. What I'm trying to achieve is to create a custom environment to add short notes into a body of ...
3
votes
2answers
31 views

Avoid recursion in \renewenvironment

I'm trying to redefine an environment in order to add a command after the \begin without having to add this command in manually everywhere. For example, I'd like to replace every instance of ...