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

16
votes
5answers
1k views

How to put a star (or other symbol) in sections that are “special” (difficult, optional, etc)?

I'm currently writing a book, and I'd like some of the sections to be clearly marked as "difficult" or "optional". Not only sections, but also exercises (I'm using the exercise package) and theorems ...
10
votes
4answers
13k views

\overline outside of math mode

If I want to draw an overline over some text, not an equation, how can I do it? \overline seems to only work in math mode, and when used outside of math mode, it automatically says "Missing $ inserted"...
0
votes
3answers
524 views

I failed to use \newenvironment and \newcommand

The following code snippet does not work. \documentclass{article} \usepackage{pstricks} \newcommand\Left{-1} \newcommand\Right{1} \newcommand\Bottom{-1} \newcommand\Top{1} \newenvironment{\...
9
votes
3answers
24k views

LaTeX enumerate - bold item with non-bold text

I'm trying to customize the environment enumerate where the \item is bold but the text is not bold. What I've tried is (at the suggestion of one of the google-results): \let\origitem\item \...
15
votes
2answers
2k views

mdframed and wrapfig

Before starting the question, I apologize for the large pictures. I had to use some long text to demonstrate the problem. To generate something like: I used the following command: \setlength{\...
3
votes
1answer
852 views

Tabular environment within the \newenvironment

I'm writing a book, in which we refer the reader to the CD-ROM for the source code, and tell him the compiler and the result of running the program. Here's an example: Since this "template" is ...
10
votes
1answer
343 views

Suppressing indentation of the next paragraph

I'm trying to define an environment/command, with the following property: The immediate paragraph after the environment must not be indented. The following shows my attempt at defining such ...
2
votes
2answers
322 views

Custom list of environments (per section)

I'd like to have a list of my custom environments at the start of each section. I read this post, but wasn't able to get the titletoc to help me. The given response worked for floats, but I couldn't ...
4
votes
1answer
177 views

How to avoid duplication of longtable setup code

I have many longtable's in my document. Everything is the same across all the tables, except for the caption and the content (of course). How can I avoid duplicating the stuff required to set up ...
1
vote
2answers
311 views

Problem with the answers package.

I am using the answers package to build a series of exercises. The problem i have encountered is when going from \item $ 5x^2-x \geq 0 $ \begin{sol} $x \geq 1, x \leq 0$ \end{sol} to \uppg{$x<-...
5
votes
1answer
6k views

Removing extra vertical space in \maketitle with titling package

Consider the following two LaTeX source files: First, manually producing a title using a new environment (eww): \documentclass[a4paper,10pt]{article} \parindent0cm% \newenvironment*{mytitle}{\begin{...
1
vote
1answer
406 views

Problems using \def commands inside an environment

In trying to build the commands \sol and \solutions to use them inside the exercises environment. The commands must work in this way: \begin{exercises} \exer text for exercise 1\sol{solutionA} \...
9
votes
1answer
4k 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 ...
3
votes
3answers
4k views

Set width of a custom environment

I'm trying to make a letter template (I don't want to use the existing one) and I am trying to make an environment for the adress at the top. I want it to be a certain width and located to the right ...
5
votes
1answer
1k views

textpos for all pages - environment usage

I'm trying to put some text on topleft for every page of my appendix. I use textpos but it adds the text only one page. I thought I might use an environment and put the appendix between this ...
13
votes
4answers
420 views

\let and sneaky redefinitions that are wrappers for the original macro: is there a similar thing for environments?

Let's say I am using some macro \foo that almost does what I want, but I actually want to add space either side of the output of \foo. I can do the following: \let\tempfoo\foo \renewcommand\foo{\...
2
votes
2answers
283 views

Looking for a numbered List, with parameter, custom label and custom reference text

I will give an example of what I need exactly. The output should look like the default description list, with numbered labels. REQ-ABC-001 Lorem Ipsum ... if the text is longer than a line, ...
8
votes
2answers
3k views

In LyX, how to have itemize inside a proof?

LyX is great. I use it to write everyday documents. But it seems that its environment can only have one type; different types of environments can't be mixed. For example, you can't have itemize inside ...
3
votes
1answer
3k views

Implementing “aside” environment for explaining details of calculation

I would like to have parts of the text set in smaller time with different indentation, and separated from the rest of the text visually (e.g. by horizontal rules). I would like to use this to set off ...
4
votes
1answer
549 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 ...
36
votes
3answers
45k 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
464 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
811 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
818 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 ...
21
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
860 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
4k 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
698 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
658 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?
7
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
194 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, ...