Tagged Questions

{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
156 views

Why am I getting a “perhaps a missing \item” error in my custom epigraph environment?

I have tried to customised a new environment for epigraphs in a book. This page should have no fancy headers or anything alike. It should only have a list of one or more epigraphs. To that end I am ...
0
votes
0answers
21 views

tabularx in newenvironment: Illegal pream-token [duplicate]

The following example gives: ! Package array Error: Illegal pream-token (\AtEndOfPackage): `c' used. What is wrong? \documentclass{article} \usepackage{tabularx} \newenvironment{mytab}{ ...
7
votes
2answers
120 views

Wrap text to quote it later in the same document

I was wondering if there's a way to do the following: to wrap an excerpt of text in an environment and to label it; to quote it (entirely) later in the same document, via a \ref command or similar. ...
1
vote
2answers
89 views

Simple minted \newenvironment

I'm trying to do a minted \newenvironment I looked at this post new-environment-with-minted, but I would like to know if there's a more simple way to do that, like \newenvironment{matlabcode} ...
3
votes
2answers
211 views

Closing Environments in TeXstudio

Is there any command and/or hotkey in TeXstudio to close open environments? I know this feature from HTML or programming editors. For the editor almost no language knowledge is necessary for this. ...
2
votes
0answers
30 views

Dynamically set if environment should be printed [duplicate]

Is it possible to tell LaTeX whether or not some environments should be printed in the output PDF file? I want to create one version of my document with "extended" examples and another with fewer ...
3
votes
2answers
372 views

How to change font in description environment?

How to change font in description environment, for term word (First, Second...) and for its definition (The first item, The second item...)? How to restore paragraph indentation after environment in ...
3
votes
1answer
83 views

Double bookmark in pdf file

I got a small problem with my LaTeX document. I generate a list of listings like this: \renewcommand\lstlistlistingname{Quellenverzeichnis} \lstlistoflistings ...
3
votes
1answer
832 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
359 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
247 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
74 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 ...
9
votes
1answer
190 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
289 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
88 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
301 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
91 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
81 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
239 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
241 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
149 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
118 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
440 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
178 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
31 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
214 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
226 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
172 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
458 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
389 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
142 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
1k 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: ...
3
votes
1answer
138 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
1k 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} ...
5
votes
1answer
177 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
75 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
51 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
112 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 ...
13
votes
2answers
170 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
87 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
190 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
117 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
380 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
517 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
128 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 ...
5
votes
1answer
986 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
188 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
337 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
94 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
58 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 ...