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

4
votes
1answer
546 views

Creating an environment able to span over multiple pages or columns

I'm trying to create an environment able to understand when it's on a single/two columns layout and to span over multiple pages or columns having different style for the two cases. I would want to ...
35
votes
3answers
44k views

Example environment?

I was wondering if there is any formal environment for specifying 'examples' through out the text. If not, which environments do you recommend?
9
votes
4answers
2k views

How to use a \write command inside a \newenvironment ?

I'd like to make a new environment which would store its content in a file, so that I can read that file at another part of the document. More specifically, I want to have an environment {proof} such ...
6
votes
2answers
463 views

Splitting an argument of a custom macro into a list

Introduction I created a simple bus timetable with TikZ: Currently, the node placing is done manually. The problem I would like to create an environment which would look approximately like this: ...
15
votes
2answers
3k views

Define an “escape underscore” environment

I am writing a text document in LaTeX where I need a lot a words with underscores: foo_bar_1, more_bar_2_long_expression_3. I know about the underscore package, but for some reason the [strings] ...
6
votes
1answer
8k views

Autocomplete current environment

Is there a keyboard shortcut in TeXnicCenter to complete the current environment? In other words, it should add the appropriate \end{....}.
13
votes
2answers
613 views

Centering text on a page

I'll try to illustrate what I want to accomplish. I want an enviroment/page style for poems that works like this -- the title (if present) is placed in the title placeholder (purple). The body of the ...
3
votes
2answers
321 views

“Problem description” to look like abstract

I would like to have my "Problem Description" to have the same look/layout as abstract. Any way I can "clone" the the abstract command? preamble: \documentclass[pdftex,10pt,b5paper,twoside]{report} \...
25
votes
3answers
802 views

Does \newenvironment have a \provideenvironment cousin, as \newcommand has \providecommand?

To avoid the problem of having to decide whether to use \newcommand or \renewcommand, LaTeX has the option of \providecommand. Is there something corresponding to this for environments? I'd like to ...
5
votes
2answers
814 views

line break aware custom environment

I have a use-case where I would like to specify some special formatting for the text being input via the \input command. This text is customer's address being printed in some sort of a form. Ideally ...
20
votes
1answer
3k views

Passing \newenvironment parameters to the end block?

I am attempting to construct a new environment which will allow me to format arbitrary list types (itemize, enumerate, description etc.) with the new environment. As such I am passing it as a ...
2
votes
1answer
153 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} \end{...
7
votes
1answer
4k views

How to highlight paragraph (linebreak preserving) as well as itemize, tabular etc.?

I want to highlight changes which are introduced by myself in the pdf document. So far the soul package is very neat but it does throw errors when I want to highlight not only paragraphs but also some ...
2
votes
2answers
373 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} \...
1
vote
0answers
1k views

What does this error mean?: begin document ended by end proof [closed]

I'm typing up an article in Latex and after opening the proof environment with \begin{proof} and concluding it with \end{proof} I get the error message ! LaTeX Error: \begin{document} ended by \...
2
votes
1answer
858 views

Framebox and minipage causes white space and is not float

I have a \framebox (I don't insist on using this command) and a minipage that causes whitespace, because the drawn box is not allowing any text before or after and it itself does not break over pages. ...
15
votes
2answers
1k views

How can I check if the current code is inside a certain environment?

I would like to define a command which checks if it is executed inside a certain environment. Like this: \documentclass{article} \newenvironment{myenv}[0]{at start}{ at end} \newcommand{\inner}[0]{%...
6
votes
2answers
360 views

How can I ignore everything except a specified environment?

In other words, I'd like to have the comment environment of the verbatim package "inverted". I am pretty sure I read about some package allowing this some time ago, but I can't recall its name (nor ...
7
votes
1answer
5k views

Environment for greyed-out (or otherwise color) text

Sorry for being as clueless as the last times I asked but also having done no research because I have to finish this overhead presentation for tomorrow... Is there a good way to create an environment ...
7
votes
1answer
3k 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 single-...
3
votes
2answers
1k views

Macro that inserts arguments into an environment

I'm having a bit of an issue trying to get a piece of code up and running. I'm working on extending python.sty file for embedding python into a LaTex document (adding persistent data and the ability ...
10
votes
1answer
1k views

Using minted to define a new environment

Can I define a newenvironment that has inside it a minted environment? eg and environment that would be a quickhand for the following code: \begin{figure}[htp] \centering \begin{minipage}{...
4
votes
1answer
159 views

Code inside an equation environment is executed 4 times (or isn't it?).

I created a small example: \documentclass[a4paper,12pt]{article} \usepackage{amsmath} \usepackage[pdfstartview=FitH]{hyperref} \usepackage{bookmark} \begin{document} one line \newcounter{test} \[\...
59
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 ...
12
votes
2answers
684 views

Restrict macro to an environment

I am quite a noob when it comes to customising LaTeX/XeLaTeX. I would like to know if there's a way to limit the usage of a macro to a specific environment. Consider the following macro and ...
1
vote
2answers
653 views

Defining a new environment without spreading over two pages

I've definied an environment with \newenvironment{definiere}{\begin{leftbar} \textbf{Definition:}\newline }{\end{leftbar}} Unfortunately sometimes this environment is spread over two pages, where ...
4
votes
2answers
2k views

newenvironment/newcommand for existing environment in LaTeX-Beamer

I would like to have the solution of highlighting a line in listings-package as a command or environment. To bad I cannot get it working. I tried: a simple newenvironment: compile errors \...
6
votes
1answer
2k views

Redefining figure* for Beamer

I have a single figure* graphic in a separate file (let's just call this x.tex). This file is shared across several latex documents and is inserted with input for each document. Unfortunately, when I ...
11
votes
3answers
1k views

Generating lists of custom environment.

I've created my own environment example, similar to theorem. Now I want to generate a list of examples, similar to list of tables or list of figures. How can I achieve this?
6
votes
1answer
6k views

Removing vertical space before and after tabbing environment

When I write \begin{tabbing} \hspace{4in}\= \kill % set up two tab positions {\bf University }, {\it City, NW} \> PhD, Physics (2007-2011)\\ \end{tabbing} Methodology and numerical ...
3
votes
4answers
193 views

Define a new evironment by an existed environment, with its optional argument

Suppose there is an existed environment say, existedenv, with an optional argument, that is, \begin{existedenv}[argument] .... \end{existedenv} I want to define a new environment, say, myenv, ...
3
votes
1answer
122 views

Changing the entries of a list environment

If I have a new list environment like so: \newenvironment{textblockX} { \begin{list} {Question} {} } { \end{list} } How would I refer to an item of the list within the environment? ...
2
votes
1answer
271 views

Use the same brackets or parenthesis as equations in an empty style environment

I have the following in my preamble: \usepackage[overload, ntheorem]{empheq} \usepackage[amsmath, thmmarks]{ntheorem} \usepackage{mathtools} \mathtoolsset{showonlyrefs,showmanualtags} \newtagform{...
12
votes
1answer
1k views

Problem with environment expansion and the Tikz external library.

I've created my own environment mytikz, which basically looks like this (full MWE): \documentclass[a4paper]{article} \usepackage{tikz} \usetikzlibrary{external} \newenvironment{mytikz}{%begin code ...
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 ...
16
votes
3answers
3k views

Hide custom environment content based on boolean

I have a custom environment which adds some text around its content, but I also want it to be able to show or hide its contents depending on a boolean. I have tried doing the following: \newif\...
0
votes
1answer
1k views

Layout for certificate

This is my environment for the certificate: \newenvironment{alwayssingle}{% \@restonecolfalse \if@twocolumn\@restonecoltrue\onecolumn \else\if@openright\cleardoublepage\else\...
10
votes
3answers
2k views

Showing Solutions of the Questions “separately”

There is a class for LaTeX called exam. Using this class, one can write questions and answers for exams. The answers are displayed under (after) each question. My goal is to have all answers in the ...
5
votes
1answer
967 views

Wrap latex environment

I'm a beginning latex user. I have some programming code in my document which I format using the lstlisting environment from the package listings. However this still allows the code segments to be ...
1
vote
0answers
133 views

Environment for NOT compiling things [duplicate]

Possible Duplicate: 'Dummy' LaTeX environment Since the explanation why on earth I need this is longer than the actual question, I begin with the latter. I would like to define an ...
50
votes
1answer
3k views

Defining environments based on other ones: What's the right way?

Assume that I want to define a new environment that is a variant of an existing one. For example, I seek an italicquote environment that acts like the quote environment but displays its contents in ...
16
votes
2answers
2k views

Environments with conditionals in: why doesn't this work?

In response to this question I thought the obvious thing to do was the following: \documentclass{article} \newif\iffoo \newenvironment{foobar}{\iffoo}{\fi} \begin{document} \begin{foobar} Here is ...
1
vote
2answers
2k views

In Lyx turn greyed out text into comments

In Lyx I would like to convert greyed out text into comments. The Lyx environment is lyxgreyedout. I have considered switching to another IDE already and it is not an acceptable solution. The ...
4
votes
2answers
826 views

Making \footnote work in leftbar environment

Sorry, it's me again. Gonzalo has hinted me to the very nice leftbar environment in the framed package, which I now use for definitions, theorems and similar environment. Now I've got a new problem: ...
4
votes
1answer
663 views

Theorems and Definitions as quotes

Most standard styles highlight theorems and definitions using italics. Now this is something I really would like to avoid in my thesis (and generally). Unfortunately, if I just remove this "feature", ...
9
votes
1answer
2k views

How can one pass the contents of a LaTeX environment to a macro?

I'm working on an exam document class where the user enters in questions something like this: \multiplechoice{Question} {Answer #1} {Answer #2} {Answer #3} {Answer #4} {Correct answer} {Explanation} ...
5
votes
1answer
996 views

Create environment inside another environment?

Why can't I define an environment, that encloses another tabularx environment inside it? For example, why can't I do this: \newenvironment{customTabular}{ % This is the begin code \begin{...
30
votes
2answers
4k views

How to automatically add text immediately after \begin{document}

I attempted to redefine the document environment as follows, but get a complaint that: LaTeX Error: \begin{MYdocument} on input line 13 ended by \end{document}. \documentclass[12pt]{article} \...
6
votes
1answer
943 views

Starred equivalent in newenvironment

Let's say I want to use the align-environment in a newenvironment like this: \newenvironment{mequation}{\align}{\endalign} This works fine. However, what if I want to use the starred version of ...
25
votes
3answers
11k views

Quote environment with reference at the end right

I want to define a quote environment such that after the quote on the right occurs the author with page number. My solution is yet the redefinition of the quote environment \usepackage{amsthm} % ...