0
votes
1answer
34 views

Showing/Hiding verbatim environment based on boolean condition

I would like to show and hide a verbatim or spverbatim environment based on a boolean condition (sth. like \showenv). I tried the solutions proposed at Hide custom environment content based on ...
4
votes
2answers
34 views

vspace mysteriously being inserted after nested custom environment

I have created my own environment that creates a table using tabu and then puts some vertical space after it, unless my environment is being nested, in which case I want it to skip the vertical space. ...
5
votes
1answer
56 views

how to use conditional to define different \begin and \end environment at compile time

I just need little help on the syntax for this. I am using tex4ht, and I get an error when I use empheq for the align environment. I want to build this TeX file both in pdflatex and htlatex. I ...
4
votes
1answer
74 views

Command to disable environments [duplicate]

I have defined an environment called answer that displays the answer of a question of a test I'm supposed to prepare. The idea is to compile a version where the answers are displays and one were they ...
4
votes
0answers
58 views

Checking environment in order to end it

I used to typeset verse with memoir package using some heavy \vspace trickery. The verse environment was too hard to control in terms of vertical space due to the immense amount of obscure glue. For ...
2
votes
2answers
43 views

Display first (sub) environment in an environment

I would like to make a bank of problems of similar type--however, I only want to display the first of each time. For example: \begin{bank} \begin{exercise} 2+2 \end{exercise} \begin{exercise} 4+3 ...
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 ...
11
votes
2answers
174 views

How to create a macro “environmentally-dependent”

Yesterday I was reading the etoolbox documentation where there are defined some new document commands such as: \Before<Begin/End>Environment{<envir>}{<code>} % ...
3
votes
2answers
118 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 ...
3
votes
2answers
158 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
1answer
303 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 ...
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 ...
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 ...
1
vote
0answers
42 views

Hidden environment [duplicate]

Possible Duplicate: Suppressing remarks when not needed Is there a way that I can define a new environment in my manuscript which will only be typeset when a flag is activated? Otherwise ...
5
votes
2answers
303 views

Boolean based environments

I know that this question is basically identical to that of Hide custom environment content based on boolean Except I want to avoid using the environ package, which, otherwise, would be the best ...
3
votes
1answer
153 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 ...
5
votes
1answer
278 views

Suppressing remarks when not needed

I have written some remarks in some of my works that are somewhat informal and repetitive in nature (mainly for my own clarification). I was wondering if there is a way of suppressing them when I ...
2
votes
1answer
233 views

Definining a new enviroment depending on a parameter

I want to create a new environment which depend if a parameter exists or not. The basic definition, which works fine, is: \newrgbcolor{bcolor}{1. 1. 1.}% \newenvironment{pbox} ...
11
votes
3answers
310 views

How to \enddocument inside an environment

I have a document of the form \begin{document} some text \begin{myenv} .... \end{myenv} some other stuff \end\document I would like to set a boolean \newif\if@test in the header to control the ...
14
votes
5answers
788 views

Command behavior depending on current environment

I would like to write a LaTeX macro whose code depends on the parent environment such as: \newcommand\test{ %if current_environment=env1 test1 %elseif current_environment=env2 test2 %else } ...
9
votes
3answers
4k views

How to make LaTeX ignore the contents of an environment?

I would like to make a \todo command and environment whose behavior changes depending whether I define a command \showtodos. A basic \todo command is simple to write: ...
6
votes
2answers
575 views

etoolbox: environment hooks in boolean switch

What did I wrong, that the following does not work here: (Edit: I mixed up the true and false parts, but I don't want to change the code, because the answers refer to this in a way confusing one.) ...
5
votes
1answer
158 views

Testing for a blank line (“paragraph”) immediately after \begin{document}

(With this question, I hope to resolve an edge case relevant for my quoting package.) Suppose I define a customized environment for displayed text. It resembles the standard LaTeX environment quote ...
16
votes
1answer
491 views

What exactly does \@doendpe do?

Quoting from the LaTeX2e sources: [\@endparenv, \@doendpe] To suppress the paragraph indentation in text immediately following a paragraph-making environment, \everypar is changed to remove ...
11
votes
2answers
607 views

How can I check if the current code is inside a certain environment?

I would like to define a command which checks if it is executed inside a certain environment. Like this: \documentclass{article} \newenvironment{myenv}[0]{at start}{ at end} ...
13
votes
3answers
2k views

Hide custom environment content based on boolean

I have a custom environment which adds some text around its content, but I also want it to be able to show or hide its contents depending on a boolean. I have tried doing the following: ...
12
votes
2answers
1k views

Environments with conditionals in: why doesn't this work?

In response to this question I thought the obvious thing to do was the following: \documentclass{article} \newif\iffoo \newenvironment{foobar}{\iffoo}{\fi} \begin{document} \begin{foobar} Here is ...
5
votes
1answer
867 views

Using versions environment tags inside a new environment definition

I just found out about the versions package here and am interested in using it to hide solutions in a problem set document. Recall that, to create versions block, in the preamble, you need ...