{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
1k 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 ...
9
votes
2answers
116 views

How to improve maintenance of starred/non starred versions of commands or environments

All documentations I've read about starred/non starred versions of commands recommend more or less the following way of doing (following for instance the UK List of TeX FAQ): ...
9
votes
1answer
117 views

Spacing in list with math environment

Check out the following example. I would like to write the code as in the second list, but get output equivalent to the other two. However, there is a lot of extra vertical space after the third item ...
7
votes
1answer
468 views

Duplicating the amsthm proof environment

I am currently writing up some lecture notes and would like to have therefore a "\solution" environment which should work basically as the amsthm \proof environment, just writing "Solution." instead ...
2
votes
2answers
452 views

Undefined control sequence: \undefinedpagestyle at \end{macrocode}

The full source can be found here (static link), but here is the relevant bit: ... % \begin{macrocode} %<*package> % \end{macrocode} % \begin{macro}{\BCSet} % And stuff % ...
3
votes
2answers
217 views

Using more \newcommand's into a single \newenvironment and \newenvironment instances counting

I am trying to write a class (it is my first class) in LaTeX to manage some teams in a tournament, but I am incurring some problems related to \newenvironment and \newcommand. For instance, I wish to ...
5
votes
3answers
665 views

Continuing example Counters in Beamer

I wonder how to get automated continuing example counters in Beamer. Below is my MWE. Thanks for your help. \documentclass{beamer} \usetheme{Warsaw} \setbeamertemplate{theorem}[ams style] ...
5
votes
1answer
132 views

compilation error in creation of new command

I'm trying to manipulate a bit an environment that I've found in internet, in GUIT forum. This is the minimal example ...
3
votes
2answers
114 views

Conditional to \begin and \end some environment

The conditional structure of the macro of the MWE allow print two text strings as "true" and "false" alternatively. So you can print something like "false true false true false true" calling six times ...
4
votes
0answers
94 views

Indentation of Lists in Environments

Based on the answer of Markus Scharrer, I am using the custom lstnewenvironment to get code and Section with my environment. Since I use an environment in an environment (I know it may not be the best ...
1
vote
1answer
124 views

Use Listing in newenvironment

I am trying to do a new environment or command (i tried both) where i can put in the name, description and code of a Method in c++ and it gives me a new section with the MethodName, the code listed ...
0
votes
0answers
32 views

How can I keep an environment all on one page? [duplicate]

In other words, how can I forbid pagination between \myenv and \endmyenv? I thought at first to make the whole thing a box; if I'm not mistaken---this would prevent TeX from breaking it up---but I ...
3
votes
1answer
86 views

Prevent environments from breaking in two pages

I am making my own environments for a mathematical document (environments such as Theorem, Definition, Lemma... which often consists of a title corresponding to the environment and possible things at ...
5
votes
1answer
129 views

environment and newcommands

I am writing a summary of my methods in c++ where the outputstyle is always the same like that: TestFunc (Title as subsection) Method Boolean TestFunc(Integer MyPar) (this should be in a Lstlisting ...
4
votes
3answers
1k views

DeclareDocumentEnvironment: missing control sequence inserted — \inaccessible

I'm setting up a skeleton CV package for a friend for him to customize, and I'd like to make it as user-friendly as possible. To effect this, I'm using keyval and xparse. ...
3
votes
1answer
97 views

How to make star Exercise and its environment answer?

At here How to make an environment star Exercise?, I posted make star Exercise. How to make star Exercise and its environmet answer? Example, with Exercise 1.1, we have Answer 1.1, with Exercise ...
5
votes
3answers
237 views

Problem with newenvironment

I'm defining new environment and I'm trying to pass to it two arguments: \newenvironment{ctable}[2]% {% \begin{center}% \begin{tabular}{#1}% }% {% \end{tabular}% \captionof{table}{#2}% ...
6
votes
0answers
268 views

How to create a framed proof attached to a theorem?

I am trying to create a customized "proof" environment attached to a theorem. It looks like this: So there is first the theorem, and then a gray bar starts on the inner margin. It ends, when the ...
14
votes
1answer
277 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 ...
2
votes
1answer
130 views

Using data from tabulary to typeset columns

While trying to write a better answer to this question, I've made several (probably quite bad) attempts to use the tabulary environment to typeset paragraphs to try to in some way be able to split a ...
4
votes
1answer
279 views

Converting string to number

I am trying to write an environment which provides (some of) the functionality parallel environment through tabular syntax so that the following two code snippets would give equivalent results: ...
5
votes
1answer
383 views

Splitting a command syntax across a \newenvironment definition

This question is a direct follow-up to the question Can a \newcommand Definition Contain Braces as Substitution Text? I asked yesterday. The following example is once again a counter-intuitive one, ...
2
votes
0answers
82 views

Custom environment splitting between pages [closed]

I created a custom environment for theorems using mdframed package: \newtheorem{theorem}{Theorem} \newtheorem{twierdz}[theorem]{Twierdzenie} \newenvironment{twierdzenie} ...
7
votes
2answers
115 views

An environment for two-way rules in category theory

I want to typeset some category-theoretic calculations involving adjunctions (sometimes called two-way rules). In short, they look approximately like this (MWE): \documentclass[a4paper]{article} ...
3
votes
2answers
510 views

New environment using mdframed

I'm trying to write a collection of problems and their solutions for my course's textbook. I've created an exercise environment. I'm currently using the mdframed package to create a leftbar that spans ...
3
votes
2answers
151 views

Checking in LaTeX for a specific character?

I have a LaTeX problem that I cannot solve by myself. I have a repeating arrangement of characters which I want to format automatically in LaTeX. 1H-NMR (400 MHz; DMSO-d6): \textdelta 12.41 (s, ...
0
votes
1answer
88 views

Strange white line with \lstnewenvironment

I'm trying to write a \lstnewenvironment for my LaTeX class but I have a strange behaviour. Here's my code : \lstnewenvironment{console} { \lstset { ...
6
votes
1answer
84 views

How to output environment content to a file while enclosing content by a box?

This is the source: \documentclass{article} \begin{document} \begin{obj}{name-of-obj} This is a test code. \begin{equation} a < b \end{equation} \end{obj} \end{document} I want to enclose the ...
3
votes
1answer
65 views

I made a `box' float environment, and now I would like to put the caption inside the box

I made a box float using the following: \usepackage{float} \newfloat{Box}{t}{bx}[chapter] and \begin{Box}[htp] \label{box:test} \fcolorbox{black}{boxgray}{\parbox[c]{\textwidth}{The text goes ...
12
votes
1answer
82 views

Replicating an environment to another and making changes to original

I would like to define a new environment with the name oldproof which is basically the proof environment and then make changes to the proof environment. I would still like to be able to access the ...
4
votes
0answers
288 views

Tikz Nodes in margin gets overwritten by page-wide tikz environments

I'm trying to improve the typesetting of openly licensed books created by my company. We do the typesetting of all our books with LaTeX. The design of these books requires coloured environments that ...
1
vote
1answer
245 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 ...
16
votes
2answers
303 views

Duplicating Environments

When I want to globally modify a command in my document, I will often use a duplicated version of the original in the stencil, with the help of the \let macro. For example, if I wanted to do ...
3
votes
1answer
178 views

How to combine framed and listings packages in new environment

I always use this LaTeX code to display a source code in my article. \begin{listingbox}{VB style} \begin{singlespace} \begin{lstlisting}[style=BASIC] Private Sub Form_Load() Dim tex As String ...
3
votes
0answers
69 views

Using catcode in conjunction with lstnewenvironment and lstinputlisting

(This is related to Injecting text contained in file into custom environment, but I was asked to put this in a separate post) From regular expression in listings the following code works fine : ...
2
votes
1answer
130 views

Injecting text contained in file into custom environment

how can I inject text contained in a file input.tex into a custom environment. Something like : \documentclass{report} \usepackage{listings} \lstdefinelanguage{text}{} ...
1
vote
1answer
180 views

Custom Numbering in Derivation / Proof Environment

Just a quick background, I am writing a thesis, which has theorems (proofs and derivations) and possibly a few other 'theorem' type environments. The code in this question actually works fine, it is ...
9
votes
3answers
129 views

How can I collect the contents of a LaTeX environment in a macro without the grouping?

It's a bit of a long story as to why I need to do this, but please bear with me. I have a fairly complicated custom class which expects documents to begin with a command: \coverandabstract{Abstract ...
3
votes
1answer
92 views

Change \newcommand behaviour based on the environment

I'd like to define a command \Lm, such that if used in a maths environment it is replaced with \mathcal{L}, but when used outside of the maths environment it would be replaced with $\mathcal{L}$. This ...
2
votes
1answer
239 views

Setting memoir's \pagestyle within an environemnt

I am defining an environment with \newenvironment, and inside this environment, I want to change the memoir page style. For instance, I want to do \begin{myenvironment} and inside this environment, ...
3
votes
1answer
284 views

How to write a \newenvironment with a conditional structure and one optional parameter

I would like to define a new environment with an optional parameter. Currently, I have \theoremstyle{plain} \newtheorem{prop}{Proposition} \newenvironment{propExt}[1][]{\ifx!#1! \begin{prop} \else ...
8
votes
1answer
445 views

Vertical spaces above and below longtabu

This is, in a way, a follow-up-question to New table-environment, spaces and enclosing { } in a new environment, which has already been answered conveniently by @egreg. Please compile this MWE to ...
3
votes
2answers
230 views

Insert a character in the beginning of each line in a special verbatim environment

How can I insert a special character or a symbol in the beginning of each line in a verbatim environment? In particular, there is a constraint that applies to the verbatim environment: it must be of a ...
2
votes
1answer
173 views

New table-environment, spaces and enclosing { } in a new environment

It was hard for me to find a proper title (feel free to change it) for my question which I want to introduce with an example: Situation In my document I sometimes use tabus directly in the document ...
6
votes
2answers
150 views

phantom in environments

I want to show a box that's equivalent to the space needed by the text (or figure). I have already the code below, but I can't seem to find a way to use \phantom in the environment to make the ...
1
vote
1answer
404 views

Solutions in exam class

I'm trying to write up solutions to some exercises, using the exam class. In order to align equations correctly, I'm also using the aligned environment from amsmath. To avoid too much repetitious ...
1
vote
0answers
29 views

How to access name of environment in its own definition [duplicate]

How can I get access to the name of an environment from within its own definition? Consider, e.g.: \documentclass{article} \newenvironment{test}{This is som text from environment \printname :}{} ...
4
votes
4answers
967 views

Defining a new environment extending a verbatim environment

Why is it not possible to define a new environment that extends a verbatim environment? Consider, e.g.: \documentclass{article} \newenvironment{myverbatim}{\tiny\begin{verbatim}}{\end{verbatim}} ...
2
votes
1answer
181 views

Custom glossary environment improvement

This is a followup question about the code provided by Nicola Talbot in this question: Automated generation of equation key TL;DR: Defines new environment alignglos which can be used to wrap ...
10
votes
1answer
83 views

How can I detect if an environment is right after a sectioning command?

I'd like to build an environment that would detect if it is right after a sectioning command (\section, \subsection or \subsubsection) and smart enough to detect if a float-type environment (say ...