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

3
votes
1answer
411 views

Colour themes in beamer not working for lemma/theorem/definition environments

I'm currently trying to learn how to use beamer, and I have a presentation in a few days on red-black trees. For thematic reasons, I decided to go with the beaver colour scheme (as it gives me red and ...
10
votes
1answer
234 views

How to force lstlisting caption names and numbers to always appear, even when captions are empty?

I noticed lstlisting environment seems to supress the caption name and number when no caption is specified. See the code below: \documentclass{article} \usepackage{listings} \lstset{language=C} ...
4
votes
1answer
164 views

Combining newenvironment, quote and lstlisting (mcode)

I am trying to combine various packages and commands with PdfLaTeX (through MikTex on MS Windows), including newenvironment, quote, mcode and lstlisting, to create an environment to define multiple ...
5
votes
1answer
72 views

Allow only certain commands in own environment

I would like to define an environment myenv and allow only certain predefined commands to be executed betwwen \begin{myenv} and \end{myenv}. For example I want text typed there to be ignored and ...
8
votes
1answer
143 views

Bad page break with \newenvironment, \refstepcounter and hyperref

I tried to define some environment but came across bad page breaks sometimes. The minimal working example is as follows: \documentclass[b5paper]{article} \usepackage{hyperref} % page break is correct ...
4
votes
1answer
161 views

Change page margin inside own environment

I would like to define an environment, that inserts a page with different margins than defined in the preamble. I tried using the following LaTeX code. \documentclass[a4paper,10pt]{article} ...
3
votes
1answer
63 views

Environment that puts its body into a parbox [duplicate]

I want an environment that creates a tabular inside a \parbox. The problem is how to put delimiters so that the whole thing becomes the second argument to the \parbox command. ...
5
votes
2answers
212 views

How to color certain commands/environments?

My goal is to achieve colorings in the output document, that are similar to the syntax highlighting I use in my editor, so switching between the editing and viewing the document becomes easier on the ...
3
votes
2answers
71 views

Why linebreaks break the line height within certain environments with size-changing macros?

Why linebreaks break the line height within certain environments with size-changing macros? I'm trying to understand what's the difference between these three approaches: \newenvironment between {} ...
3
votes
1answer
77 views

How to create nested custom environment with different kind of frames?

So before I write ten pages describing what I'm looking to do, I made a small mock up: I had something like this in mind: \begin{mybox}[Name] \begin{syntax} here comes source code \end{syntax} ...
3
votes
2answers
108 views

newenviroment error: Extra }, or forgotten \endgroup \begin{gbox}

\noindent \colorbox{gray!25}{ \begin{minipage}{\textwidth} \vskip0.5cm \leftskip0.5cm \rightskip0.5cm Text Here! \\\end{minipage}} Code above works fine, but I don't ...
0
votes
0answers
150 views

Making boxed “problem” environment and a solution environment

I'm trying to make a template for my homework. I've been using a modification of the Harvey Mudd homework class, but there are some things I don't really like about it (functional and aesthetic). ...
3
votes
0answers
148 views

Vertical line in matrix in gauss package [duplicate]

I am currently using the gauss package since I need to write out operations between my matrices. However I am unable to add a vertical line to the far right in my augmented matrices. The gauss package ...
4
votes
1answer
75 views

Specify color of the first row in table (in “newenvironment”)

I am using an specific style for my tabulars and I am looking to specify automatically the color of the text in the first row. Currently I must specify manually the color of the text of each cell in ...
6
votes
1answer
227 views

How to scale a verbatim block in a user-defined environment?

In order to produce an ereader-friendly PDF with small page dimensions, I'd like to scale down some oversize verbatim blocks such as program output with lines too long for the small page. Then readers ...
11
votes
2answers
161 views

How to create a macro “environmentally-dependent”

Yesterday I was reading the etoolbox documentation where there are defined some new document commands such as: \Before<Begin/End>Environment{<envir>}{<code>} % ...
0
votes
0answers
30 views

Fixing LaTeX errors “Environment table undefined.” [duplicate]

I have written the following TeX program in KWrite editor to make a table. \begin{table}[t] \centering \caption{test table} \begin{tabular}{c c c} \hline one &\ two & \three\[0.5ex] hline 1 ...
3
votes
1answer
148 views

An in line Exercise environment

In my lecture notes I want to leave some work as exercises and plan to give solutions later in the text. For example, "The proof of this theorem is left as an exercise (Exercise 1.2)". It must also ...
3
votes
2answers
89 views

Centering an item in cases environment [duplicate]

I wish to center the 1 in the following LaTeX code: \begin{align*} v'(k,\CS)= \begin{cases} \displaystyle\frac{G_{max}(k){-}q_k'(CS)}{G_{max}(k){-}\Gmin(k)} & \text{if }G_{max}(k) {\neq} ...
5
votes
1answer
134 views

renewcommand cite with one or two arguments

I need to renewcommand \cite. I used the following: \let\citeOld\cite \renewcommand{\cite}[1]{{\mbox{\citeOld{#1}}}} and works correctly for citations like \cite{Taylor}. The problem is that if I ...
7
votes
2answers
354 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
4answers
243 views

How can I limit the scope of a \renewcommand instruction to “table” environments?

I want to use \renewcommand{\arraystretch}{1.2} to adjust the space between the lines in my table. Since I have used matrices all over my paper (and this command also affect the matrices) I want to ...
6
votes
2answers
121 views

Using an expanded macro for optional environment argument

I'd like to open an environment, passing the content of a macro to the optional arguments. Up to now I tried different approaches using \expandafter, however I could not get the expected behaviour. ...
4
votes
1answer
742 views

Not rounded beamer blocks

I want my blocks to be not rounded. I added this like to my style but without any success. \setbeamertemplate{blocks}[rounded=false, shadow=true] How to make not rounded boxes in beamer? Edit: ...
2
votes
1answer
101 views

Math-mode inception: creating a list environment for individually referenced equations

I'm trying to create a list-like environment properties that could be used as such: \begin{properties} \item[Lemonade Rule] \forall \text{lemons} \exists \text{lemonade} \item a^2 + b^2 = c^2 ...
3
votes
2answers
457 views

\vfill and vertical space

In a two-column document, I would like some text to be positioned at the bottom right of the right column. The text is inside tabular and flushright. An MWE is: \documentclass[twocolumn]{article} ...
4
votes
1answer
104 views

Color part of text and captions

is it possible to color in red part of a text and/or of a caption (let's say, just some words)? I tried to create the environment: \newenvironment{redtext}{\color{red}}{\ignorespacesafterend} ...
2
votes
1answer
68 views

How to remove \BODY defined in the algorithmic package?

The algorithmic package defines a command \BODY which evidently clashes when used in conjunction with the environ package. More specifically, LaTeX failes to compile when an algorithmic environment is ...
5
votes
1answer
44 views

How make \parshape declared inside an environment to apply the next paragraph outside the environment?

I'm trying to do something like the MWE below: \documentclass{article} \usepackage{lipsum} \newenvironment{myenv}{% \parshape = 4 0pt 0.5\textwidth 0pt 0.5\textwidth 0pt 0.5\textwidth ...
4
votes
3answers
103 views

Creating an environment that uses macros

I have a macro that requires some setup code before being called : \documentclass{minimal} \usepackage{color} \begin{document} % some setup code \colorbox{green}{This is green.} % some cleanup code ...
12
votes
2answers
138 views

Filecontents and newenvironment issue

I need to write some inlined code on an external file, then load it with listings. I would like to define a new environment, but if I do, filecontents does not save the first line of code (see MWE): ...
2
votes
1answer
75 views

Freely movable container

Is it possible to get an environment/container that is able to change the position of its content relative to the position where it would be normally. The content should be able to be anything like ...
4
votes
1answer
152 views

Create new environment on top of another

I'm trying to create a new environment on top of tcblisting (from tcolorbox package) using environ package. Getting weird error about Runaway argument. The MWE: \documentclass{book} ...
1
vote
1answer
105 views

Change heading style in latex environment

I am using the acronym environment to list some acronyms at the beginning of a thesis I am writing. However the default heading style that acronym places doesn't match the rest of my document. I don't ...
4
votes
1answer
243 views

How to make “claim” environments look like “theorem” environment?

I am using LyX 2.0.5 with document class article and 'Theorems (AMS)' in the modules. From what I understand, the claim environment copies its style from the remark environment. I'd like it to copy ...
0
votes
1answer
354 views

Custom environment using the answers package

I want to create a custom environment to be used with the answers package, something like ... \usepackage{answers} \Newassociation{solu}{Soln}{ans} \newtheorem{ex}{Ejercicio}[chapter] ...
2
votes
1answer
103 views

Peculiar pagebreak problem with nested environments

I have been trying to make custom theorem environments because the classical newtheorem command does not suit my needs. I have been stuck with a pagebreak problem which I explain below. Here is the ...
3
votes
1answer
469 views

\newenvironment where all text is typewriter (like \texttt)

I'd like to have an environment that encloses all its content into the typewriter font as \texttt{} does. However, I do not want to use \texttt{} but an own environment, e.g. \begin{allintypewriter} ...
4
votes
1answer
167 views

Making a class to generate colored tables with a predefined layout

This is a follow-up question in which I asked how to define classes with \newcommands into \newenvironments, and I had some good answers to this particular issue. However, the problem that I have ...
4
votes
2answers
242 views

Little indentation despite \noindent after tabu custom-environment

this question is about a (to me) mysterious little indent (looks like an ordinary blank...) after a custom-environment using the tabu-environment. Please compile this MWE: \documentclass[a4paper, ...
4
votes
1answer
86 views

Customized tabular environment

we've quite often have to write tables in our CI layout (colors, borders, fonts, etc). At the moment we use the standard tabular environment with lots of extra instructions (in the environment ...
4
votes
1answer
51 views

Sorted output inside a tabular

Currently I'm trying to create an environment with several different \item-like commands. I want the arguments of the different commands to be ordered by their type. Basically the usage of ...
3
votes
1answer
60 views

Maintain display of arguments for certain folded environments with AUCTeX

When working with some environments (function and friends from l3doc prompted this), it is desirable to have the environment's arguments visible at all times: Some text that, in reality, shouldn't be ...
18
votes
1answer
180 views

Is it bad style to have spaces in environment names?

I've recently realized that, due to how \newenvironment, \begin, and \end work, there is no reason you can't have environment names with spaces in them. As long as you stick with \begin and \end, this ...
4
votes
1answer
83 views

Undefining leftbar environment to eliminate multiple definitions in memoir class and thmbox package

Context : I am using the memoir class, and I was trying to use the thmbox package. But the environment leftbar is defined both in memoir and thmbox. So I was trying to undefine an environment but I ...
5
votes
2answers
85 views

Macro defining environment

How to write an environment such that \begin{comment} Bla, bla. \end{comment} produces no output, and instead defines a macro \@comment whose replacement text is everything that is inside the ...
4
votes
1answer
133 views

How to customize cross-reference numbering of custom environments?

Context: I have several environments with custom counters. As usual, I'm referencing them along to my document but I get only the corresponding counter value as reference. Example: ...
6
votes
2answers
91 views

How can I prevent breaks in a custom environment?

I have a custom example environment: \newcounter{examplecounter} \renewcommand{\theexamplecounter}{\arabic{examplecounter}} \newenvironment{Beispiel}[1][]{% \goodbreak% ...
3
votes
1answer
53 views

Error with nested environment and forced linebreak inside tabbing

I reduced the offending code to this: \documentclass[12pt,a4paper,notitlepage]{report} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \begin{document} \newenvironment{foo}{}{} ...
6
votes
1answer
189 views

The `wrapfigure` environment breaks when put inside another environment

I've tried using the wrapfigure environment (from the wrapfig) package, but it acts in such a way that I can't use it. Consider the following MWE: \documentclass{article} \usepackage{wrapfig,mwe} ...