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

5
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 ...
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 ...
12
votes
4answers
6k 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 ...
11
votes
1answer
324 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. ...
10
votes
1answer
3k views

How can I write multi line equations with alignment in inline math mode?

Is there any way to override the fact that certain environments in LaTeX are automatically "displayed"? One such example is the align* environment. I want to keep my aligned equations inline. So ...
9
votes
1answer
175 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
244 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
115 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}} ...
7
votes
1answer
271 views

Looking for a better code for my \newcommand

While preparing my lecture notes, I decide to create a command, possibly a new environment, that highlights when I am presenting a worked example. I came up with the following code. The code does ...
7
votes
1answer
549 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. ...
6
votes
2answers
356 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 ...
5
votes
2answers
89 views

Collecting contents of LaTeX environment

I have the following for collecting contents of an environment and printing them later, it works but for my real task i want to use the environ package because i need to be able to have access to ...
4
votes
1answer
90 views

listings using tcolorbox package without Chapter and Section environment effects

I want to get listings using tcolorbox package but without counting Chapter and Section environments. See in MWE, I used section environment withing listings which effects the counter for following ...
4
votes
1answer
850 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 ...
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 ...
2
votes
1answer
280 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
439 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, ...
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 ...
17
votes
2answers
361 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$ ...
16
votes
3answers
1k views

Why does LaTeX make a distinction between commands and environments?

Why does LaTeX make a distinction between commands and environments? Or also: why do we need environments? I ask this because I am defining a number of custom commands (like \question{} and ...
13
votes
2answers
525 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 ...
12
votes
2answers
315 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
2answers
502 views

Get emacs to automatically insert \end{} commands after a \begin{} command

I've recently switched from Kile to Emacs/AUCTeX for LaTeX editing. I like AUCTeX a lot more in general, in part because I've put a lot of effort into learning Emacs really well. One feature I really ...
10
votes
1answer
178 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
1k 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 ...
10
votes
2answers
2k views

Listings: different counters for different listing environments

How do I create two lstlisting environments that each have its own counter? If I use for example \lstnewenvironment{algorithm}[2]{ \renewcommand\lstlistingname{Algorithm} \lstset{ ... } } ...
9
votes
2answers
126 views

Creating a new environment containing a tikz environment

I would like to create a new environment in order to ease the process of making plots. It should be able to something like this: \begin{graph} \addplot [domain=-10:10, samples=1000]{x)}; \end{graph} ...
9
votes
1answer
542 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 ...
9
votes
1answer
163 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 ...
9
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
2answers
235 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. ...
7
votes
2answers
497 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
516 views

defining a centered shadowboxed listings environment

I'm trying to define a environment for code listings wrapped in a shadowbox and centered in the line. Using this code, I can generate the kind of output that I want: ...
7
votes
2answers
603 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} ...
6
votes
2answers
137 views

Seemingly trivial: verbatim, newenvironment, and colorbox

I am, once again, trying to achieve what seems like a trivial goal. I want to use \newenvironment to define a verbatim environment with a background color. I need to define my own environment because ...
6
votes
2answers
634 views

How can I change the whitespace above and below center?

Is it possible to control the space above and below center, e.g. the way it can be controlled above and below math display? In other words, is there an equivalent to, say, ...
5
votes
2answers
484 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
4answers
730 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}% }{% ...
5
votes
3answers
923 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 ...
5
votes
1answer
648 views

How to expand several arguments in an environment?

I have an environment that I've defined as follows: \newenvironment{regularEnumerateEx}[2][0em] {begin{listSkeleton}[#1]{enumerate}{#2}} {\end{listSkeleton}} The problem is that I need to ...
4
votes
0answers
155 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
1answer
155 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} ...
4
votes
2answers
423 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
892 views

Creating a custom environment

I'm using the following syntax for my code snippets \begin{minipage}{\textwidth} \begin{lstlisting}[caption=<something>, label=<something>] The REST Endpoint URL is ...
4
votes
1answer
1k 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, ...
4
votes
1answer
3k 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 ...
3
votes
4answers
176 views

How to print the value of the last \refstepcounter in the first page in the memoir class?

I made an environment named sol, that has a \refstepcounter command. I want to print on the first page of my document how many sol environments I have made in my document. ...
3
votes
1answer
3k 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
218 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
379 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 ...