{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
358 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: ...
4
votes
1answer
56 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} ...
4
votes
1answer
148 views

Class Design: Environment vs. Macro

I have seen What are the consideration when choosing either newcommand or newenvironment? but I think this is a little more specific. If it's a duplicate, then so be it. If the second part of the ...
4
votes
2answers
138 views

Nesting custom `xparse` environments

I've defined two simple environments with xparse. Problem is when I try to nest todominute environment inside minutes environment: \documentclass[a4paper, 10pt]{article} \usepackage{polski} ...
4
votes
1answer
613 views

Onecolumn till end of page in twocolumn mode

I know about using the widetext environment for setting text in onecolumn mode and the multicols package for effortless switching between one- and twocolumn mode, but I think this is not too great if ...
4
votes
2answers
634 views

Is there an “identity” (or “no-op”) environment that simply uses its contents unaltered?

In the functional programming paradigm, it is common to have functions accept other functions as parameters. This paradigm can be followed in LaTeX, too: A macro can accept parameters which themselves ...
4
votes
1answer
489 views

String parsing macro fails within a minipage environment? [closed]

I am trying to work with a string parsing macro, found in the answer of TeX capacity exceeded while parsing a date string - TeX - LaTeX. Basically, I have strings num01, num02... num09 - from these, ...
4
votes
1answer
627 views

Using TikZ along with picture environment

Please see my examples: picture After TikZ \documentclass{article} \usepackage{color} \usepackage{tikz} \usepackage[english]{babel} \begin{document} \begin{tikzpicture} \path ...
4
votes
2answers
142 views

Errors passing the contents of a LaTeX environment to a macro

First of all, I'm sorry if this is a bit of an obvious newbie question, I've tried reading as many of the posts on here about doing this sort of thing, but was unable to get any of them to work. I'm ...
4
votes
2answers
457 views

Paragraph indenting in an mdframed environment

I'm using the mdframed package and I've defined my own environment. But it seems that paragraph indentation doesn't work inside a mdframed environment. I've used the settings option of mdframed to ...
4
votes
2answers
2k views

\bgroup and \egroup?

So I've been looking to expand on the following bit of code (a hack to not screw up the margins when using oversized figures): \noindent\makebox[\textwidth]{% \begin{tabularx}{1.5\textwidth}{XX} ...
4
votes
1answer
425 views

Creating an environment able to span over multiple pages or columns

I'm trying to create an environment able to understand when it's on a single/two columns layout and to span over multiple pages or columns having different style for the two cases. I would want to ...
3
votes
1answer
127 views

Xparse macro not working when \obeylines is in effect

This is the most strange and hard-to-debug situation I have encountered in latex. When \obeylines is in effect, it seems that macros with optional argument defined by xparse will have some trouble. ...
3
votes
3answers
124 views

Horizontal space in a new environment after \label{}

Why is the horizontal space inserted in the following mwe? \documentclass{scrartcl} \usepackage[american]{babel} \usepackage{environ} \usepackage{amsthm} % proof environment \makeatletter ...
3
votes
1answer
81 views

How to prevent page break in the last three lines of an environment?

I want to create an environment, thats content should not allowed a page break in the last three lines of the last paragraph. If the last three lines of the text inside the environment reach the ...
3
votes
1answer
103 views

How to expandafter an environment?

I have the following problem: I want to create a beamer presentation and introduced a new environment using xparse. The environment has one optional argument (+ two mandatory). Now I want to create an ...
3
votes
1answer
85 views

Nomenclature not being assigned proper page number

The following is my MWE: \documentclass[12pt,twoside]{report} \usepackage[intoc]{nomencl} \newenvironment{preliminary}% {\pagestyle{plain}\pagenumbering{roman}}% {\pagenumbering{arabic}} ...
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 ...
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
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 ...
3
votes
1answer
159 views

Using tabu/tabularx inside xparse NewDocumentEnvironment

My question seems very similar to this, but with tabu instead of tabular*. In fact, switching the options in that example causes the failure I see here. \NewDocumentEnvironment {trace} {} {% ...
3
votes
2answers
179 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, ...
3
votes
0answers
81 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 : ...
3
votes
1answer
76 views

Remove the automatic generation of number?

I looked for my past thread which can be found here: Create a two column static small box the solution i accepted was the truefalse environment. My question is, how will i remove the automatic ...
3
votes
1answer
82 views

How to indent part of line to certain amount?

I apologize if this is a basic question, but I'm new to LaTeX and typography in general, and I'm not sure how to articulate my question properly. I have a document which looks like this: ...
3
votes
1answer
158 views

Defining macros based on environment

Right now, I have two macros, \intersects and \union, that simply point back to \cap and \cup respectively. Unfortunately, to have nice typesetting in display-like environments, I need to use \bigcap ...
3
votes
1answer
383 views

Difference in behaviour between tabular and flushleft environments

In response to my earlier question the following working code has been provided: \documentclass{article} \usepackage{showframe} \begin{document} \hfill \begin{tabular}{l@{}} some text\\ some other ...
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. ...
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 ...
3
votes
3answers
428 views

Problem with expansion of \BODY

In the following MWE, the command \testStringNotEmpty tests if the argument is empty. This test is robust in the sense that the argument can contain a command or an environment... The environment ...
3
votes
3answers
1k views

Problem with nesting environments

I have a problem with nesting environments. I have created a MWE for this. I have environment {env1} which I want to contain environments {env2} and {env3} in the following way. What's wrong with the ...
2
votes
2answers
93 views

Counters for Chapter and Section environments when using tcolorbox for listings

This is a followup question of this question. With my MWE I'm getting wrong Listing numbers, wrong toc (including Chapter and Section environments from listings) and wrong bookmarks in pdf toc. Any ...
2
votes
1answer
72 views

Semantic table markup with environments inside {tabular}

I run into issues trying to markup tables semantically in LaTeX. Background Either standard \hline together with \firsthline and \lasthline from array.sty (I think) or \midrule, \toprule and ...
2
votes
1answer
143 views

How to change the behavior of user-defined environments using overlays?

first I have to give a link to a related question+answer. I am trying to create a beamer presentation and defined an environment. The environment has an optional parameter and I want that beamer sets ...
2
votes
0answers
211 views

TikZ externalize causing problems with template

I have a large document (I'm using pdflatex with Eclispe and TeXlipse) with many (many) TikZ graphics (math function plots, most of them). In order to reduce (drastically I hope) compilation time I ...
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
197 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 ...
2
votes
0answers
49 views

Is it possible to check if I am inside a float environment? [duplicate]

I have a class file that I am writing (it's my first one and I am new to LaTeX). I have a situation where I'd like to know if I am inside a float so that I can prevent attempting to create a nested ...
2
votes
1answer
760 views

Homework template

I've been using this homework template I found online that is pretty light. I am very new to using LaTeX, and although I find writing basic mathematical expressions easy, some of the cooler more ...
2
votes
1answer
502 views

Unbalanced braces with newenvironment / NewEnviron

I am trying to define an Environment myEnv s.t. \begin{myEnv} text1 \end{myEnv} text2} expands to \renewcommand{\myCommand}{ text1 } { text2} The reason for the obviously unbalanced expression ...
2
votes
2answers
740 views

Environment for text to run into margins

After posting this closed question, I found a good solution for memoir on this page. However, my margins settings are different then the ones he uses, and as a result, the widematter environment only ...
2
votes
1answer
305 views

Insert text before end of page, and at the begining of the next page

I'm putting a template together and I have created a custom command which I'm going to use to set specific margins on the text passed to its argument and a few more formatting things, like this: ...
2
votes
2answers
295 views

Custom list of environments (per section)

I'd like to have a list of my custom environments at the start of each section. I read this post, but wasn't able to get the titletoc to help me. The given response worked for floats, but I couldn't ...
2
votes
1answer
728 views

Framebox and minipage causes white space and is not float

I have a \framebox (I don't insist on using this command) and a minipage that causes whitespace, because the drawn box is not allowing any text before or after and it itself does not break over pages. ...
1
vote
0answers
44 views

How to define a proof environment which can be displayed/hidden? [combining two TeX solutions] [duplicate]

I once asked for a solution to suppress vertical space right after the beginning of a proof environment; see the link (1) below. I use this quite heavily, it works very well. I recently asked how to ...
1
vote
0answers
37 views

How to store the definition of an environment? Or, how to disable locally an environment?

what? I would like to "store" the definition of the environment figure into \something so that the following logics will work: % the following line is what I am looking for store(figure, \something) ...
1
vote
1answer
79 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 ...
1
vote
1answer
183 views

new quote-based environment end spacing [closed]

In order to insert quotations, the document uses a quote-based \newenvironmentx \newenvironmentx{QUOTE}[1][1=.]{% \begin{quote}% \tiny\noindent% \gdef\parQ{#1}``% }{\parQ''% \normalsize% ...
1
vote
1answer
82 views

How do I embed a gather environment within a custom environment?

I've tried defining the following custom environment, but I get errors: \begin{gather} ended by \end{solution} etc... Here's a MWE showing my problem: \documentclass{article} ...