{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.
2
votes
1answer
29 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
2answers
125 views
+50
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 ...
7
votes
3answers
3k views
Defining my own proof environment?
How would I define a proof environment that is basically used with
\begin{proof}
some proof here
\end{proof}
and it would be equivalent to:
\paragraph{Proof:} some proof here
\hfill \box
?
2
votes
1answer
41 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, ...
1
vote
1answer
92 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 ...
3
votes
1answer
36 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 ...
2
votes
0answers
34 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:
...
2
votes
1answer
76 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 ...
2
votes
1answer
34 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
52 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 ...
11
votes
2answers
262 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. ...
5
votes
1answer
41 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 ...
1
vote
0answers
26 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
86 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}}
...
10
votes
1answer
59 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 ...
12
votes
2answers
735 views
How do you define your environment such as to use […] for some parameter(s)?
In an environment, say
\newenvironment{whatever}[3]{...}{...}
you instantiante it (if that's the word for it in LaTeX) by
\begin{whatever}{first}{second}{third}
...
\end{whatever}
But how do ...
8
votes
4answers
122 views
How to redefine an environment to produce no output?
I am using the verbatim environment with
\begin{verbatim}
XXXX
\end{verbatim}
I would like the option of redefining the verbatim environment so that nothing between \begin{verbatim} and ...
1
vote
1answer
55 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 ...
4
votes
1answer
34 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}
...
6
votes
3answers
85 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 ...
6
votes
1answer
319 views
Create environment within my own latex class?
How can I automate multiple choice question type in my own class in LaTeX?
2
votes
1answer
26 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 ...
4
votes
1answer
25 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 ...
34
votes
3answers
11k views
What's the difference between the environments quote and quotation?
On meta, I've found the disscussion {quotation} and {quote}, but it doesn't answer my question.
When should I use the environment quote? When quotation?
2
votes
0answers
57 views
Reliable code for automatic \noindent after specific environments?
There are a number of environments which I never want to follow up with an indented paragraph. itemize, enumerate, theorem, definition, etc. I know there are people who think this is bad style. But ...
5
votes
3answers
702 views
Change color and background behind text of all 'description' environments
I'm new with LaTeX and like to change some parameters of the description environment throughout the document.
As minimum, I like to have two arguments: color of text of item and background-color ...
9
votes
2answers
100 views
How can I define a new minted environment with optional arguments?
I have the following mwe:
% arara: pdflatex: { shell: true }
% arara: pdflatex: { shell: true }
\documentclass{article}
\usepackage{minted}
\usepackage{listings}
\usepackage{caption}
...
9
votes
2answers
188 views
How to turn off an environment (e.g. tikzpicture) for faster draft compiling
I'm currently writing my thesis and have been looking for ways to speed up compile time. I can shave off a lot of time by using draft mode so that images aren't processed, but I have several TikZ ...
4
votes
1answer
229 views
Using tabularx in a custom environment - “misplaced \noalign”
Question
Currently, I'm trying to shorten the creation of small tabularx-tables with pre-defined headers, but somehow, trying to use the tabularx-environment, even though I used the \tabularx and ...
2
votes
1answer
61 views
Environment lstlisting undefined
Hi I have installed the listings package in order to display my code. I am running the following code within my document:
\begin{lstlisting}
public static void main(String[] args) {
...
12
votes
2answers
85 views
How to make AUCTeX ignore syntax highlighting within environment
I have a problem with syntax highlighting in the Emacs editor using AUCTeX. The problem occurs in particular with the Verbatim environment from the fancyvrb package. Consider the following code:
...
3
votes
0answers
80 views
Macro to create new .tex files
I borrowed from Extracting the contents of text in a specified environment into a new file some code that extracts lines from a .tex file and puts it into a new file. The code works well, but I would ...
4
votes
3answers
146 views
How to embed a letter?
Suppose I am writing a novel using the book class, in which a correspondence from the hero to the heroine needs to be embeded, like this:
Dear Marie,
I miss you very much, I'll come home in a ...
-1
votes
1answer
446 views
restating a theorem using theomac.sty
I am trying to restate a theorem environment using theomac.sty which floats around, following a suggestion I received here:
how do I refer back to counters?
The package I downloaded loads well, but ...
3
votes
2answers
90 views
Word count in LyX which does not include Figure captions
Is they a way of obtaining a word count in LyX that does not include text inside captions (Figures, tables etc.)?
3
votes
1answer
115 views
typesetting a physical law
How should one type set one of Newton's law?
\begin{definition} environment doesn't seem right since it should say the law's name in bold not definition (some number) and \begin{theorem} doesn't fit ...
3
votes
1answer
2k views
Autocomplete current environment
Is there a keyboard shortcut in TeXnicCenter to complete the current environment? In other words, it should add the appropriate \end{....}.
2
votes
2answers
69 views
Create a new environment that uses a verbatim environment
Consider the following:
\documentclass{article}
\usepackage{environ}
\usepackage{verbatim}
\usepackage{color}
\NewEnviron{vred}{%
\color{red}
\begin{verbatim}
\BODY
\end{verbatim}
}
...
3
votes
2answers
39 views
Centering a wide table that is defined inside a NewEnviron
I am trying to centre a table with a lot of content whose width is larger than the text width. The problem is that I am defining the table environment in the preamble so I can reuse it, and this seems ...
2
votes
1answer
31 views
Get rid of numbering in “remark” environment
I use renewcommand for changing the remark into my native language, more precise, I used :
\renewcommand\remarkname{Chú ý}
It goes with a counter, i.e each time I start a remark
\begin{remark}
...
1
vote
0answers
29 views
catchfile(betweentags) and obeylines
I'm writing two large documents, both containing much of the same text.
To ease the maintenance, I'd like no redundant paragraphs, but rather to use catchfilebetweentags.
Everything works well, ...
2
votes
1answer
58 views
Custom caption text
How do you set the caption name to say foo instead of figure? I have tried using a custom environment but am encountering several issues.
3
votes
1answer
58 views
LaTeX2rtf with pdftooltip
I'm using LaTeX2rtf to convert LaTeX article or report documents into rich text format. I also compile the PDF using pdfLaTeX. In my document, I use the pdfcomment package to create tooltips.
...
1
vote
3answers
68 views
Footnote in tabular environment
It seems as if footnotes would have only a problem with the table environment but in my minimal example non of those answers
Footnotes in Tabulars?
Footnote in table
seem to work for the tabular ...
14
votes
2answers
588 views
A special example environment
How can I define an environment named "example" so that:
can be broken over pages
has a horizontal line above "Example \chap.\no" (e.g. Example 4.10),
and vertical line that is spread to the whole ...
3
votes
1answer
584 views
Easy-to-use reference-able environment for restating theorem-like environments?
This question is a development of the same issue as this one; following my own answer and later comment there, I decided it deserves a spin-off.
I would like to define an environment for restating ...
11
votes
3answers
793 views
How to pass an optional argument to an environment with verbatim content?
This is an attempt to make clear what happened in this question of xport (now deleted, sorry). The now deleted question included code that tried to make my answer to this question of xport work for ...
4
votes
1answer
82 views
How to change an environment into newcommand?
Suppose that I want to create a new command named step, which functionally add Step 1., Step 2., and so on in the proof. This can be done by:
\newcounter{stepnum}
...
6
votes
3answers
76 views
How to adjust a counter depending on whether or not we are inside a section or subsection
I want to create an exercise environment that can be used in either section, subsection, etc. As an illustration, consider the following:
when in section 1, the third example should be titled as ...
8
votes
2answers
149 views
Combining `tikzpicture` and `lstlisting`
I'm working on a custom lstlisting environment, in which I use TikZ to add a frame and a title. Because of the widespread curly braces of node I cannot use newenvironment, so I have to resort to ...
