{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
4k 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
1answer
109 views

Environment for two columns with lstlistings

In order to reduce copy-pasting, I want to create an environment that will produce a two-column table with headers and two listings in different languages, like below: \begin{tabular}{l l} Python ...
3
votes
3answers
7k views

Footnote in tabular environment

It seems as if footnotes would have only a problem with the table environment but in my minimal example non of those answers Footnotes in Tabulars? Footnote in table seem to work for the tabular ...
3
votes
2answers
395 views

Can this command be converted to environment?

I have a command as follows: \newcommand{\Comment}[1]{&&&#1\tabularnewline\hline} And now I want to convert it to be an environment as follows: \newsavebox{\tempDescription} ...
1
vote
1answer
215 views

minted Environment Inside minipage Environment

I am having to use the minted environment inside a minipage environment quite often in my document. I wanted to write a new environment for doing this, but since minted isn't designed to be included ...
1
vote
1answer
4k views

LaTeX Error: Environment table undefined

When I try to compile a latex file, I get the following error: LaTeX Error: Environment table undefined. I think the line that is causing the problem is: \begin{table} Does anybody know how I can ...
1
vote
1answer
358 views

How to create a new counter for an a new environment that is in sync with subsections

I want to create an example environment with a counter which will be in sync with my subsections. So I'll have: subsection 3.2 lemma 3.2 example 3.2 example 3.3 lemma 3.3 subsection ...
1
vote
1answer
347 views

Why does pdfLaTeX fail when I try to use `begin{lstlisting}` inside a user-defined environment?

I'm having trouble with the listings package. I can't compile the following minimal example through pdfLaTeX: \documentclass[a4paper, 11pt, twoside, openright, english]{memoir} \usepackage{listings} ...
15
votes
5answers
751 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 ...
12
votes
1answer
236 views

Theorem with separate tikz environments for header and body

My initial question: I'm writing my lecture notes in LaTeX and used some customized theorem environments with amsthm so far. Now I wanted to redesign those theorems with help of tikzpicture. That's ...
16
votes
5answers
25k views

Beamer block environment without title

Is it possible to create a customised beamer block environment that only has a body and not a title? For example, I wish to typeset the following quote within a coloured block so that it stands out ...
12
votes
2answers
399 views

Combine minted and tcolorbox

I have the idea to combine minted with tcolorbox. At first, I have created my own minted environments: \newminted[mycsharp]{csharp}{tabsize=2,fontsize=\footnotesize} ...
13
votes
2answers
17k 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?
8
votes
2answers
292 views

How to make a wrapper for the figure and table environments.

I am familiar with the newenvironment command, but I was wondering, how do I carry on the parameters that are used between [ ], i.e [bht!]? I want to make a newfig and a newtab environment that will ...
6
votes
2answers
2k views

Create a \lstnewenvironment that creates named listings

I am using the \lstnewenvironment to format a set of code listings in my document. \lstnewenvironment{code} {\lstset{language=haskell, basicstyle=\small\ttfamily, numbers=left, ...
20
votes
2answers
711 views

Reliable code for automatic \noindent after specific environments?

This question led to a new package: noindentafter There are a number of environments which I never want to follow up with an indented paragraph. itemize, enumerate, theorem, definition, etc. I ...
11
votes
2answers
218 views

How can I define a new minted environment with optional arguments?

I have the following mwe: % arara: pdflatex: { shell: true } % arara: pdflatex: { shell: true } \documentclass{article} \usepackage{minted} \usepackage{listings} \usepackage{caption} ...
10
votes
3answers
5k views

Creating a new environment with one optional argument

I want to create a new environment with one optional argument in LaTeX. Here is what I used: \newenvironment{argument}[1][]{% \par \noindent \textbf{Argument#1:} \noindent} {} When there is no ...
8
votes
2answers
441 views

Combining `tikzpicture` and `lstlisting`

I'm working on a custom lstlisting environment, in which I use TikZ to add a frame and a title. Because of the widespread curly braces of node I cannot use newenvironment, so I have to resort to ...
8
votes
3answers
564 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: ...
8
votes
3answers
660 views

How to make an environment star Exercise?

I want to create an environment star Exercise, but I can not. Please help me. \documentclass{book} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsmath} ...
8
votes
3answers
216 views

How to use named variables with one environment

Just after there is one code which has been proposed to me in this site. Instead of using \begin{MyFrame}[1.5cm][2pt][1.3cm][blue][2][8ex], I would like to use something more friendly like ...
7
votes
3answers
3k views

Change the font of the block quote?

Sorry if this is a duplicate, but I can't find the right way of doing this. I want to redefine my quote and quotation commands to use a different font. My main font is Linux Libertine O (I am using ...
7
votes
1answer
841 views

Vertical space before and after custom environment

I've created custom environment with these commands: \usepackage{relsize} \newcounter{annotation} \def\theannotation{\arabic{annotation}} \newenvironment{annotation} ...
6
votes
3answers
1k views

Number mhchem reactions and create a \listofreactions

Is there a way to create an environment for reactions defined with mhchem that behaves similarly to equation in terms of numbering the reactions (including a \nonumber command)? Can I get a list of ...
26
votes
1answer
201 views

Why is there no \provideenvironment?

LaTeX2e provides a \providecommand but there is no \provideenvironment which defines an environment only if it (or a macro with the same name) was not defined before. Is there a specific reason why it ...
11
votes
1answer
261 views

New list environment: automatic enumeration with “a posteriori” format

This is a follow-up question to Nested enumerate labels with parent label appended plus a single set of enclosing parentheses First and foremost, sorry for my English, I'm learning it currently. ...
11
votes
3answers
4k views

How do I generate a check-list?

Similar to the itemize or description environments I would like to have a check-list environment, with neat boxes on the right side, that I may check or uncheck. I guess I'm not the first having this ...
10
votes
2answers
975 views

How do I define new environments, and why would I want to?

I've read about defining new, custom environments that can be used like \begin{thisismyown} % do some funky stuff \end{thisismyown} How do I define thisismyown, and why would I want to?
9
votes
1answer
207 views

how to redefine \begin{align*} … \end{align*} to \begin{eqnarray*} … \end{eqnarray*}

Scientific word insists in generating displayed math using \begin{align*} ... \end{align*} and htlatex has a bug in that it does not generate bit mapped images in this case. The fix that I found ...
8
votes
1answer
83 views

Why is this lettrine being bumped into the margin?

Consider the MWE from an earlier question: \documentclass{article} \usepackage{lettrine} %\usepackage{fontspec} %\defaultfontfeatures{Ligatures={Historical}} ...
8
votes
2answers
602 views

Using an environ environment with \newenvironment

I want to use an environment defined with NewEnviron from environ in another environment definition: \documentclass{article} \usepackage{environ} \NewEnviron{inner}[1]{% \textbf{#1:} \BODY } ...
8
votes
1answer
2k views

Defining my own description environment

I need help writing my own description environment. The only thing I want to change is the appearance of description label. I can achieve what I want universally just fine with the following bit in ...
7
votes
2answers
423 views

Environment to allow line breaks at `,` in math mode

I find the question and accepted answer to Allowing line break at ',' in inline math mode? very useful, BUT I would like to make an environment (e.g. "allowbreaks"} out of it. The problem is that I'm ...
7
votes
1answer
453 views

Adding something automatically to every paragraph in an environment

I'd like to know if it's possible to have something added automatically to any paragraph in a given environment. I use LaTeX mostly for doing fill-in-the-blank worksheets at the school where I work. ...
7
votes
1answer
2k views

How to define a new environment with a fancy box (tikz) around sample source-code (listings)?

This is what I want to do: \documentclass{beamer} \begin{document} \begin{frame}[fragile]{Frame 1} Some \structure{Python} code here: % I want to define a new "pythoncode" environment, so ...
5
votes
2answers
334 views

Processing the body of an environment multiple times

Dear all, I am new to package writing (LaTeX2e) and to this forum, and I probably read to much of the TeXBook and not enough on LaTeX. My package works, except that verbatim is verboten. Given a user ...
4
votes
0answers
82 views

Using a package only for certain tables

I am using the tabularx environment since it the X component of the columns is very useful and necessary for the tables I want to produce. However, a single one of my tables is longer that a page, and ...
4
votes
3answers
1k views

Defining a new LaTeX environment for numbered two-column proofs

I'm trying to write up problem sets for my programming languages class, and I want to create an environment for a certain style of proof. Proofs in this style will have two columns, with numbering on ...
4
votes
2answers
2k views

Replacing itemize by mdwlist's itemize* throughout?

Most of my documents start with a couple of quick hacks that save me literally a couple of keystrokes a month: \let\cite\texcite \let\epsilon\varepsilon and so on. Now, I'd like to do a similar ...
3
votes
1answer
354 views

Create an environment like the `checkboxes` in exam.cls

I am having trouble on how will i create something like the checkboxesor oneparcheckboxes environment in exam.cls. The only difference is that since the checkboxes gives circle, i'd like to create ...
2
votes
1answer
201 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 ...
1
vote
1answer
383 views

Listings: new environments with arguments

I have this basic question. How can use arguments with listings? I tried this and it doesn't work: \lstnewenvironment{cor}[2][] {\linerange{#1-#2},\lstset{language=[Sharp]C,,basicstyle=\scriptsize, ...
27
votes
6answers
1k 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 ...
17
votes
2answers
8k views

Block comments with *% and %*

I know the package comment which allows to use : \begin{comment} Lines to comment \end{comment} This is not very friendly to use. I would like to have the following possibility: *% Lines to ...
16
votes
2answers
327 views

Why do I have to put the center environment in a group for \@afterindentfalse\@afterheading to suppress indentation?

Consider the following two macros, the only difference being that one has the environment inside a group: \documentclass{article} \makeatletter \newcommand\thisworks{% {\begin{center} $\ast$ ...
13
votes
2answers
442 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 ...
11
votes
2answers
275 views

What is the problem with nested environments using \BODY (environ package)?

This question led to a new package: newenviron I want to define some environments, which place their content into multiple different other environments. To access the contents I used the ...
10
votes
1answer
161 views

Inserting document compiled from LaTex code inside a .tex file

Is there a way to insert a document within a document? The inserted code is fully .tex compliant and could be compiled as a document on its own. I envision an article document, where inside the ...
10
votes
1answer
911 views

Environment to underline/strikeout for comparing versions

I have a TeX file that I'm editing with several collaborators and we use environments to highlight and discuss proposed changes like the following: Some text. \begin{old} Text that I propose to ...