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

10
votes
3answers
749 views

How to start itemize on same line as text?

I've created a new environment called 'Example' like this: \newenvironment{example} {\textbf{Example:} \begin{itemize}} {\end{itemize}} The environment works fine, but the items are ...
5
votes
1answer
91 views

Bottom hline in a tabularx wrapper environment

I want to define a wrapper environment for a table where one of the columns stretches to fill the available width. I'm using the tabularx package and its X column for that. As mentioned here and in ...
5
votes
1answer
164 views

Forcing the first choice of an newtcblisting environment

I have created a new environment based on "tcblisting" from package "tcolorbox" is code (MWE) is as follows: \documentclass[10pt]{article} \usepackage{tcolorbox} ...
7
votes
1answer
106 views

Two block commands in \newenvironment [duplicate]

What is wrong with following document? \documentclass{article} \usepackage{xepersian} \usepackage{verbatim} \newenvironment{code} {\begin{latin}\begin{verbatim}} {\end{verbatim}\end{latin}} ...
4
votes
3answers
152 views

How to replace \\ with \\& in math mode?

I am having the following isssue: I have to write a mathematical paper/book with many different optimization problems formulated. To be consistent all over I'd like to create an environment to ...
4
votes
1answer
87 views

In standard, interpret characters as vectors

I need to write many equations with way more matrices and vectors than scalars and I would like to have LaTeX interpret "normal" characters as vectors and matrices. Consequently I need to mark the ...
3
votes
1answer
142 views

Indicator at end of theorem

I'm writing a text with some very long theorem-environments in it and I find the italicised theorems visually not pleasing when they are rather longish. So I'm using the definition theorem style most ...
4
votes
1answer
620 views

using fbox in a newenvironment [duplicate]

I am trying to write a new enviroment to add text into a \fbox, when I use \fbox on its own, it works quite nicely \fbox{\begin{minipage}{0.9\textwidth} does this work, I would love if it did ...
5
votes
0answers
47 views

What are the differences between creating a new macro command vs. a new environment? [duplicate]

For the purposes of collaboration, I want to create a number of short commands or environments that will color the text within its scope so as to identify the author. My first thought was to simply ...
2
votes
2answers
612 views

\begin{problem} analogue to \begin{proof}

I recently learned about \begin{proof} ... \end{proof}, which is a good environment to work in. My question is whether there exists a similar environment to state a problem, or whether I can write ...
1
vote
0answers
26 views

Different outputs with/ without \newenvironment [duplicate]

I'm trying to setup my own CV without Curve. To do so, I intend to separate sections the same way with a \newenvironment. %[...] \newlength{\margin} \setlength{\margin}{.3\textwidth} ...
1
vote
0answers
123 views

frame in NewDocumentEnvironment

With beamer frames, this does not work. \newenvironment{itemframe}[1]{ \begin{frame}{#1} \begin{itemize} }{ \end{itemize} \end{frame} } Adding fragile, environment=itemframe as an ...
3
votes
1answer
550 views

Diary in Latex with additional notes on side

I am trying to make a diary that will have the following format Each entry will be inside a colored box Each entry will have a title with the date and an optional title I want the possibility to add ...
0
votes
0answers
194 views

File ended while scanning the use of \@newenv

I am trying to create a diary in LaTeX. I have found a relevant question using latex to keep a diary. I believe that ferahfeza gave a prety answer however there are some points that are not working. ...
4
votes
2answers
174 views

Two kinds of equation labels within one paper

I have looked high and low for an answer to the following (including on this site, Google, etc.) without success, and I hope someone may be able to answer it (and if it is a repeat of something ...
8
votes
3answers
776 views

Insert text into a fixed size box

Is there a way to create a box which has fixed width and height? I tried \parbox and some similar things, but sometimes the text overflows. If the text inserted would overflow: it should be resized ...
3
votes
1answer
91 views

Using savebox around the BODY of environ

I tried to use a \savebox around the \BODY macro of \NewEnviron. Can I keep the linebreaks somehow (they are gone, in the MWE)? \documentclass{article} \usepackage{environ} \newsavebox{\mybox} ...
3
votes
1answer
101 views

How to make a new environment behave like an existing environment? (Part 2: endnotes and comments)

In a previous post i mentioned my attempt to create an environment that behaves alternately like a footnote, an endnote or a comment (i.e. hidden). Thanks to the help of those who answered the above ...
8
votes
2answers
194 views

How to make a new environment behave like an existing environment?

I wish to create an environment that behaves alternately like a footnote, an endnote or a comment (i.e. hidden). For starters i've defined an environment "note" thus: \newenvironment{note} { ...
2
votes
2answers
140 views

Difficulty modifying an array environment

I have an array that I had past help on and now I am attempting to modify that array. However, when doing so, parts of my "theorem" keep getting shifted to the next line. Here is a MWE: ...
2
votes
1answer
72 views

Hide all but one instances of a custom environment

I have a file containing a number of custom environments numbered by a counter "exercisesheetnumber". I would like to use a second counter "printonly" to hide all instances of the environment but the ...
2
votes
1answer
182 views

Aligning multiple equation environments with cases

I have some code that works but I wish to align the environments according to the descriptions. I've tried various combinations of align, equation and cases, but can't seem to find a functional ...
4
votes
1answer
225 views

How to wrap floated minted listing in my own environment?

Here's what I'd like to do: \begin{code}{c}{Hello World in C}% I would prefer the caption to be optional #include <stdio.h> int main(void) { printf("Hello, world!\n"); return 0; } ...
4
votes
1answer
81 views

Preventing argument expansion

TikZ is able to define parametrized styles using arguments like #1. If used in \newcommand or \newenvironment, they mix up with the arguments of the command. The effect is so severe that the following ...
5
votes
2answers
92 views

How to redeclare $$ or the \[, \] pair

There might be probably many reasons not to do it, but what would be the proper way to redeclare the $$ sequence or the \[,\] pair to open by default some special display math environment, such as ...
4
votes
1answer
65 views

Personal remark environment after an equation

I have the following remark environment: \newenvironment{rem}[1][]{% \vspace{8pt}\small% \begin{list}{}{% \setlength{\leftmargin}{\parindent}% \setlength{\rightmargin}{\parindent}}% ...
3
votes
1answer
133 views

Define new align environment based on the old one

I am aware that there are plentiful similar questions, but since (even after several reading) I don't understand the the answers, I am unable to apply them to my problem. I simply want to define a ...
4
votes
1answer
118 views

Adding margin to a custom environment

Is there a way to define a custom environment (for example Propositions) in such a way that the content of that environment will automatically have a given margin at the top and the bottom? I mean ...
0
votes
2answers
80 views

Environment inside a command

My code \documentclass[a4paper,12pt,twoside]{article} \usepackage[english]{babel} \usepackage{amssymb} \usepackage{amsmath} \newcommand{\QUE}[1]{% {\bf Question\# 1 }: #1 }%end QUE \raggedbottom ...
5
votes
2answers
232 views

Example environment

I want an example environement that put Example 1.2 in the margin (bold) Text of example in the textwidth, Solution in the margin (italics) and the text of solution in the text width.
4
votes
1answer
167 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
22 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
125 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
99 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
247 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
442 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
94 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
953 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
403 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
266 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
75 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
199 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
330 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
97 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
324 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
94 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
82 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
255 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
261 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). ...