{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
2answers
205 views

How to use an environment defined by the versions-package inside another environment

When I use the versions package to conditionally exclude content like this: \documentclass{article} \usepackage{color}% just as example \usepackage[tracing]{versions} \excludeversion{vers}% opposite ...
4
votes
1answer
244 views

Text environment with vertical header and border

I have no experience with creating latex environments, so I hope that someone would be so kind helping me trying to create a new text environment with a border and a vertical header to the right of ...
4
votes
1answer
392 views

<F5> in vim-latex doesn't expand environment

I'm new to vim-latex and have been reading some tutorials. I've noticed that the behaviour of the F5 on my machine is rather different from what the tutorials tell me. I'm supposed to expect F5 to ...
3
votes
2answers
179 views

Sharing parameters between a command and an environment

(This question is related to Using \total of totcount package in section title) I'd like to keep track of the papers I review, and I have written a code (MWE shown below). The code keeps the count of ...
10
votes
3answers
394 views

Environment that obeys spaces

I need to build one environment that obeys spaces, but not new lines, and also change tabulation into four spaces. I can't use verbatim because I would also like to use macros in my environment.
3
votes
1answer
184 views

Define an align environment that always aligns to the first equal sign

I noticed that 98% of the times I use align or aligned I place the & just before the first = of each line. Is there a way to define a new environment that automatically aligns equations to the ...
4
votes
2answers
465 views

Problems When Escaping from Listings

I would like to use LaTeX to document my C++ code, since I am able to typeset mathematics easily, as well as create diagrams using TikZ. I made a minimal LaTeX template for testing, but I have already ...
0
votes
1answer
109 views

Is there a package with standard theorem environments and math functions

I would like a package that defines nice things by default like: Theorem environments like definition, property, example etc. Standard includes like subfloats, the amsmath family Reference functions ...
7
votes
2answers
523 views

How to put environment text inside node?

Consider a simple environment in the documentclass as \newenvironment{abstract}{ \node (tbl) { }; } The content of \begin{abstract} Content \end{abstract} will goes ...
2
votes
2answers
2k views

Problems with environments in TeXStudio

This document \documentclass{article} \usepackage{amsthm} \newtheorem{lemma}{Lemma} \newcommand{\mycommand}{Here is the command} \begin{document} \begin{lemma} Here is the lemma \end{lemma} ...
15
votes
2answers
2k views

How to create new table environment

I am working on a book that has many many such tables. Is there a way to create shortcut for the code shown below. I want to make table caption a variable, because in the MWE shown below except ...
24
votes
4answers
4k views

Numbers outside Math environment

Should numbers inside the text be placed inside a math environment? For example, if I am writing ...indent code by 4 spaces..., should I write it this way or ...indent code by $4$ spaces...? ...
5
votes
3answers
615 views

How to extract parts of (La)TeX document?

I want to run queries against LaTeX documents like these: get list of all equations, even if one declares \def\be{\begin{equation}} and uses it; get list of all arguments of some command (e. g. ...
8
votes
3answers
382 views

Verbatim in environ’s \BODY

I’d like to print a TeX install guide for different OS, but the most text is the same for all OS. So I build the following \documentclass{article} \usepackage{environ} \newcommand{\mlw}[3]{} ...
3
votes
1answer
182 views

afterpage + list = missing \item

I'm trying to use the afterpage package to automatically insert text at the top of each page (please see my other question Section reminders at the top of each page?) but I'm having trouble. ...
14
votes
1answer
3k views

Avoiding “\Url Error ->\url used in a moving argument.” in a custom environment

I have a document I'm trying to render using two classes -- my university's dissertation .cls, and tufte-latex (my uni's styleguide is ugly, and I want to make a pretty-print version for my own ...
9
votes
2answers
231 views

Not display the content of one environment when its content contains one special macro

I need to build one environment for proofs in my lessons. \begin{proof} ... \end{proof} This environment could have one content containing one macro named \lines like in the following example. ...
3
votes
1answer
373 views

Getting errors when using the grammar environment before \chapter{} and \begin{description}

I hope you can help me. I am using an empty grammar environment, included in the syntax package, within a file called appendix_c.tex, whose contents are as follows: \chapter{Modified version of the ...
6
votes
1answer
406 views

Plain enumeration of theorems definitions etc

In my TeX document Theorems, Definitions, Lemmas are enumerated in the following way: Definition 1.1 Lemma 1.1 Theorem 1.1 Definition 1.2 Lemma 1.2 Theorem 1.2 But I would like to have ...
17
votes
2answers
361 views

Why do I have to put the center environment in a group for \@afterindentfalse\@afterheading to suppress indentation?

Consider the following two macros, the only difference being that one has the environment inside a group: \documentclass{article} \makeatletter \newcommand\thisworks{% {\begin{center} $\ast$ ...
5
votes
0answers
431 views

Synctex and Environments [closed]

Synctex makes it possible to jump between your LaTeX code and the compiled PDF, which is absolutely great, if you have larger documents. However it is my impression that when you use environments, ...
1
vote
2answers
167 views

How to modify side margins in front pages (declared in subenvironment)?

I'm about to submit my thesis and I just noticed the first pages have different sidemargins to the rest of the text :(. They are supposed to be 2.5cm and they apper of ~ 1in. I tracked the problem ...
5
votes
1answer
426 views

Setup a newenviroment for figure with includegraphics and caption

Here is my MWE, I want to 'refactor' the code so that I do not need to write so much when I import source code into my document: \documentclass[12pt,a4paper]{article} \usepackage[demo]{graphicx} ...
7
votes
3answers
3k views

lrbox in \newenvironment

I cannot make lrbox work if put within a \newenvironment. I'll explain with an example. If I write: \documentclass{article} \newsavebox{\mybox} \begin{lrbox}{\mybox} ...
1
vote
0answers
341 views

lyx change environment level with keyboard [closed]

Much in the way that the tab key iterates over section levels: Part -> Chapter -> Section -> Subsection -> Subsubsection -> Paragraph -> Subparagraph I would like to do the same ...
3
votes
2answers
333 views

algorithmic + babel with Hebrew conflict: Numbering missing

If I use algorithmic with babel, having both Hebrew and English, the line numbers go missing. Using MikTeX 2.9. \documentclass{article} \usepackage[hebrew,english]{babel} \usepackage{algorithm} ...
24
votes
2answers
3k views

Definitive guide to trivlists

I create a lot of theorem-like environments, and I'm usually happy to employ a package (such as ntheorem, amsthm, etc) to do the work for me. After studying the ntheorem documentation, and reading ...
16
votes
3answers
1k views

Defining commands that are scoped to a particular environment

Is it possible to define commands in a separate namespace so that they only work within a particular environment? For example, can I create a package named foo that defines a foo environment and a ...
9
votes
2answers
83 views

Can I redefine an environment to generate an error?

I know how to use \renewenvironment to redefine an environment, but instead of changing formatting, I'd like to have any use of the environment generate an error (log and abort). Is there a way to do ...
4
votes
2answers
884 views

Environment in \NewEnviron style, with key-value parameters

I want to define an environment that read its content before processing (like \newEnviron from the package environ) but also that allows key-value parameters (like \newkeyenvironment from the package ...
8
votes
3answers
2k views

Defining an Environment that Takes an Argument

I want to define a new environment that will take a text argument, and use it as a title. \documentclass{article} \usepackage{amsthm} \newenvironment{titleproof} {\begin{proof} \textbf{Title of the ...
10
votes
2answers
724 views

\newtoks token seems to have local scope

I want to collect the first line of a quotation to use later. I have used \newtoks for a similar purpose so tried it here, this way: \documentclass[12pt] {article} \newtoks{\qfirstlineinternal} ...
6
votes
1answer
516 views

Framed answer environment

I am trying to write a simple environment for the solutions of assessments I give. The code below defines such an environment: \newenvironment{answerenv}[1][Answer]{% Sets the default "Answer" but ...
4
votes
2answers
2k views

Replacing itemize by mdwlist's itemize* throughout?

Most of my documents start with a couple of quick hacks that save me literally a couple of keystrokes a month: \let\cite\texcite \let\epsilon\varepsilon and so on. Now, I'd like to do a similar ...
4
votes
1answer
748 views

Dynamically use RTF-Code in latex-document

I'm looking for a way to dynamically use Rich-Text-Format code in a latex document. The background is this: I want to paste formatted programming-source from visual studio into my latex code because ...
5
votes
1answer
713 views

Problems with quoting package and renewing quotation environment

Following this How to modify spacing around quotation environment? ...I have tried to use both given solutions (using quoting package and renewing quotation environment). I cannot use quoting package ...
8
votes
1answer
702 views

hide proof environment for restructuring

I am writing my thesis, and i am in restructuring phase - sorting theorems where they should belong thematically. And it would be helpful to have all the proofs hidden so i am not laden with the ...
6
votes
3answers
1k views

Number mhchem reactions and create a \listofreactions

Is there a way to create an environment for reactions defined with mhchem that behaves similarly to equation in terms of numbering the reactions (including a \nonumber command)? Can I get a list of ...
2
votes
1answer
572 views

Unbalanced braces with newenvironment / NewEnviron + Command

This is a follow-up question of my Unbalanced braces with newenvironment / NewEnviron post. The gist is that by using \NewEnviron{myEnv}{% ...
8
votes
2answers
2k views

What are alternatives to block?

I use \begin{block} ... \end{block} to describe formalization of some notions, and I want to write some examples under it. I still would like to stick to the structure of a block (one part for title ...
3
votes
3answers
339 views

Making an environment that stores stuff in a box

Im trying to make make an environment that both: displays text and stores stuff in a box for later use. For this I need to use the input argument of the enviroment to manufacture a command name, i.e. ...
2
votes
1answer
64 views

Auto including the section into an (pre-defined) environment

There is a coherency problem in the following text (its typesetting). The last paragraph must not be considered as a part of subsect02. For instance it is a kind of conclusion of two approaches ...
7
votes
1answer
291 views

Environment for step by step modification of graphics

I would like to have one environment that produces the following two examples where the pictures are not animations. I would like that the environment takes care automatically of the numbers of ...
3
votes
3answers
3k views

Redefine \arraycolsep for particular environments

How do I change \arraycolsep for a single environment? E.g., I have \arraycolsep set so that the white spacing on either side of "=" in the equation array environment is not excessive. However, this ...
2
votes
1answer
301 views

Custom environment to accept \item

How can I create an environment that takes items in a way similar to lists? Example: \begin{myEnv} \item{AAA}{BBB} \item{CCC}{DDD} \end{myEnv} I'd like the above do something like ...
3
votes
1answer
2k views

How to define environment in LaTeX which replaces its content?

I'd like to define an environment that would display a graphviz image. The code should look like this: \begin{graph}{name}[optionalArgs] a -> b; /* graphviz code*/ \end{graph} I've ...
5
votes
1answer
254 views

Spacing between environments

I am trying to define a dialog environment while using the lettrine package. My problem are the spaces between the dialogs. There is no problem when a dialog consists of more than two lines. But ...
9
votes
1answer
551 views

Use the s (star) argument with \NewDocumentEnvironment

Would it be possible to use the s argument specifier of xparse in \NewDocumentEnvironment so that we get an environment an a starred version of it? Actually it works, but the star goes to the wrong ...
9
votes
1answer
166 views

Is there a way to replace an environment with a command?

Under certain conditions (triggered by selection of a package option) I would like to change specific environments into margin notes. However marginnote is not itself an environment, but a command ...
5
votes
1answer
746 views

LyX: how to make two “examples” not separated by a different environment?

I use LyX for some time now, but have not figured out how to put two "examples" (or exercises or theorems etc.) one after the other without having to separate them by a different environment. What ...