{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
1answer
130 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
112 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
91 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
121 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
85 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
127 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
96 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
266 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
275 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
278 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
380 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
81 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
114 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
504 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
147 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
242 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
296 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
174 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
177 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
128 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
236 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
283 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
443 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
228 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
172 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
149 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
28 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
944 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 ...
1
vote
1answer
73 views

How to ignore proofs? [duplicate]

I'd like to print a shorter version of my paper without all the proofs, I'm thinking about something like \renewenvironment{proof}{\begin{comment}}{\end{comment}} but that activates the comment ...
5
votes
1answer
202 views

flush bottom an environment

Suppose, I have defined an environment called myenvironment which typesets multiple lines of text using various formats. So, the height of the environment depends on the text that it has which is ...
4
votes
1answer
54 views

Bad interaction between keycommand and environ?

I suspect the keycommand and environ packages are not playing nicely together, because the following code gives an error. Can anybody explain what's going on? \documentclass{article} ...
13
votes
2answers
720 views

Format a verbatim paragraph

How can I format a verbatim paragraph? I.e. break, fill and join input lines to produce globally balanced output with the lengths of each line approaching the target \textwidth as closely as possible. ...
12
votes
4answers
313 views

Opaque error messages given by common environments

This is a public-interest question. The title of the question Why does this error keep popping up even though I clearly fixed it? poignantly expresses a fundamental truth of LaTeX usage: sometimes ...
2
votes
1answer
141 views

using a restatable before it is stated

This question is related to the question at Recalling a theorem, which uses the thmtools and thm-restate packages and the restatable environment to define a theorem that can be re-stated later on. Is ...
5
votes
1answer
121 views

How to set lengths only for a specific environment (parindent for paracol in this case)?

Is it possible to set a length specifically for an environment? I know it is possible to change lengths for parts of the document only, by placing the \setlength command between {}, but when using an ...