{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)

0
votes
0answers
28 views

include A3 into A4 document troubles

I know there is lot of topic about including A3 into A4 documents. But I decided to make my own environment to try to understand how it can work. I create one new environment to include A3 landscape ...
4
votes
3answers
45 views

How can I implement this environment? (Title - Margin - Item)

I want to make this environment or macro in LaTeX. This picture is made by ms-word. Suppose that 'Title' and 'How' is 3cm of width and there is a 1cm margin between 'Title' and 'Title 1'. and ...
1
vote
2answers
46 views

nested environment with a star

I want to redefine an environment that include the environment alignat*. I discovered that I can't do that : \newenvironment{variables} { \paragraph{Variables :} \begin{alignat*}{2} } { ...
4
votes
1answer
23 views

Tagging and new environment

I am using the tagging package in my document to "customize it. To include/exclude some parts of my document using a taglist, I could use the following : \begin{taggedblock}{<taglist>} and ...
5
votes
1answer
141 views

close all environments?

Is it possible to create a macro that would close all current open environments? Or even an explicit subset of all current open environments (where the subset would be standard user environments)? ...
3
votes
1answer
65 views

Smaller vertical space between repeated environments

I have a new environment that is defined with addvspace at the beginning and end. This works fine if it is surrounded by text. Now, I want this space to be smaller (smallskipamount) between these ...
5
votes
1answer
54 views

End mark for unnumbered and continued examples

Consider the following MWE \documentclass{article} \usepackage{amsthm} \usepackage{hyperref} \theoremstyle{plain} \newtheorem{theorem}{Theorem}[section] \theoremstyle{definition} ...
2
votes
2answers
43 views

customize description environment

I would like to define an environment induction which is like the description environment. I have in mind that the output of \begin{induction}{A} \item[a1] Part $a1$ of the induction proof. \item[a2] ...
3
votes
2answers
68 views

Conditionals used in defining of new environment

I want to produce two versions of one document with different content. The idea is to comment out certain sections if a logical variable is false. This logical variable will be inputted eventually ...
18
votes
6answers
9k views

Customizing theorem name

Suppose I have a series of theorems that I would like displayed as Jim's Theorem. Bob's Theorem. Will's Theorem. rather than as “Theorem (Jim).”, “Theorem (Bob).”, and “Theorem ...
0
votes
0answers
50 views

How do I hide page numbers when overlapped?

I'm trying to add an environment for code listings to stay on one page as described in "How to prevent lstlisting from splitting code between pages?". When my listing is at the bottom of the page, ...
1
vote
0answers
46 views

Define environment with two sections and verbatim

I'am writing a class for the standardization of some documents and I want the interface to be smoothly as possible. One of the things I need is define an environment that produces something like this. ...
3
votes
2answers
44 views

Compiler Error when Creating a Macro/Environment

I'm trying to create a new command or environment or something to format what is essentially a section, but it needs to have it's own counter. I would like to not use any of the \section \subsection ...
2
votes
1answer
2k 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) { ...
3
votes
2answers
124 views

Automatically copy items from the last list

In crypto, proof involves a sequence of games. Each game contains a list of lines. Adjacent games are almost the same except for a small number of lines (usually 1). I used to copy the old game to the ...
10
votes
3answers
737 views

How to start itemize on same line as text?

I've created a new environment called 'Example' like this: \newenvironment{example} {\textbf{Example:} \begin{itemize}} {\end{itemize}} The environment works fine, but the items are ...
5
votes
1answer
127 views

Display Mode without Math Mode

First I want to apologize if the answer to this question is well known. But after some searching, I couldn't uncover any similar questions. In my document, I would like to feature a regular sentence ...
2
votes
1answer
35 views

How can I apply a custom-defined theorem environment to nested theorems *only*?

In a previous thread, I asked about the possibility of defining a custom theorem environment whose QED symbol would be a boxed version of the theorem's name/number/label. There, I was graciously ...
4
votes
0answers
52 views

how to define a label in a new environment?

I would like to define a new environment for writing exercices. Moreover, I would like to use \ref and \nameref (with hyperref package) to build a table of exercise numbers and names. I wrote the ...
0
votes
0answers
33 views

Let \ref show “Section” or “Appendix”

I want my \ref{} command to include "Section" or "Appendix" depending on what it references to. To include "Section" I did the following: \makeatletter \renewcommand{\p@section}{Section ...
2
votes
2answers
82 views

Defining New Environments using a Command

I would be able to do something like the following: Instead of having the following, where I repeat the same code many many times: \documentclass{article} \usepackage{enumerate} ...
15
votes
4answers
568 views

How do I use the boxed theorem name as a QED symbol

I'm wondering if there's a relatively simple way to achieve a result similar to the following: In particular, I'd like to be able to assign names and/or numbers to theorems/lemmas/propositions and ...
1
vote
1answer
31 views

How to not miss lines using equation enviroment

How can I stop the empty lines being put on - first between the itemization letter and the equation, and then between the two different equation \item \begin{equation} \begin{split} ...
3
votes
1answer
77 views

How to make the section and theorems with different colour

How to write the section and examples in different colour, such as the title with blue colour \documentclass[20pt,a4paper]{extarticle} \usepackage[a4paper,margin=6mm]{geometry} \usepackage{amsmath} ...
27
votes
2answers
2k views

How to automatically add text immediately after \begin{document}

I attempted to redefine the document environment as follows, but get a complaint that: LaTeX Error: \begin{MYdocument} on input line 13 ended by \end{document}. \documentclass[12pt]{article} ...
22
votes
5answers
735 views

Typesetting hashtags with natural syntax

I'm using an online conversation in my document and I've made an environment to use for it. The thing is, there are many #hashtags in each post (that I'd like to color appropriately). To make it ...
1
vote
0answers
60 views

Trouble creating custom algorithm environment with separate counter

I am trying to create a custom algorithm environment for CUDA kernel code that runs on the GPU, but have little experience with custom LaTeX. It should have a separate counter, be referenced as Kernel ...
2
votes
1answer
61 views

\newenvironment behaviour with \begin{landscape}

I would like to use landscape mode for a \newenvironment{lessonPlanner} in which I have a table. but I get an error when I embed \begin{landscape} and \end{landscape} in the begin and end statments of ...
3
votes
1answer
83 views

\usepackage for \newenvironment

I am trying to create a package called lessonPlanner in which I declare some new environments via \newenvironment So I have something like ... mwe.tex \usepackage{lessonPlanner} \begin{document} ...
4
votes
1answer
60 views

Compilation fails in beamer class with newenvironment defining nested blocks

I'm failing to understand why this code compiles : \documentclass{beamer} \newenvironment{yyy}{\begin{frame} \begin{block}{youpi} }{\end{block} \end{frame}} \begin{document} { \begin{frame} ...
4
votes
2answers
177 views

“The LaTeX Companion” example environment

I'm a new LaTeX learner. Is there anybody who knows "Example environment" in "The LaTeX Companion" book? Thanks in advance.
3
votes
1answer
91 views

Use the counter value as an argument

Do you know a simple way to use the current counter value to call the argument in a macro? In myPackage I have this Note: I have the for loop defined as % ...
0
votes
0answers
16 views

forcing certain figure environments to be on top of page globally? [duplicate]

There are certain environments, such as the figure environment and environments that I defined myself that I want to force to appear (by default) on the top of a page, in a global way (instead of ...
0
votes
0answers
19 views

renewing \citeauthor while using natbib to remotely access .bib.file

My institute provides its own bibliography style .bst-file. Since the latest bibtex versions don't support \bibliographystyle anymore, I changed to natbib. The provided .bst-file is not a author-year ...
0
votes
0answers
17 views

Renewenvironment with optional parameter [duplicate]

I want to renew an environment with an optional parameter. The way I do this is: \documentclass[10pt,a4paper]{article} \newenvironment{myEnvironment}[1][]{#1}{} % save old environment \let ...
7
votes
2answers
115 views

Defining new split environment with reduced spacing

this is my first stackexchange question so apologies for any bad etiquette. I'm writing a document in double spacing. I don't wants the gaps between the lines of a multi-line equation to be that ...
21
votes
2answers
1k views

Reliable code for automatic \noindent after specific environments?

This question led to a new package: noindentafter There are a number of environments which I never want to follow up with an indented paragraph. itemize, enumerate, theorem, definition, etc. I ...
0
votes
1answer
58 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 ...
3
votes
1answer
78 views

New environment based on two existing environments (mdframed, spverbatim)

I would like to define an environment that puts verbatim text using the spverbatim package into a frame defined by the mdframed package. Here's my (naive) approach: \documentclass{scrreprt} ...
8
votes
3answers
329 views

Macro to close all open environments, groups and argument delimiters

Initial Request I am in search for a macro that would close all curly brackets and all open environments. Ideally, I could write something of the following sort: ...
2
votes
0answers
34 views

Use of environ package with knitr

I'm working on a knitr document and trying to place knitr output inside of a new environment defined using the environ package. The example below illustrates the problem. With a traditional LaTeX ...
6
votes
1answer
84 views

Dynamically calculated Row height in Tables

I am trying to dynamically allocate the height of rows in a table based upon a number, specifically the number of minutes that are devoted to a specific activity in a class lesson. The table ...
4
votes
2answers
53 views

How to keep an environment with the last line of the previous environment?

I quite often include attributed quotes in my documents, using something like: \begin{quote} Now I am become Death, the destroyer of worlds. Also, I like bananas! I like bananas so much ...
3
votes
2answers
56 views

How to avoid a spurious space when combining frame, centering and another environment?

I want to create a special environment in beamer, which combines several environments, one of which is center. However, when using my newly created environment, I get an additional space in comparison ...
0
votes
0answers
49 views

LTXtable does not work in an environment

I'm trying to write an environment that gathers the content of an LTXtable writes it to an file (with predefined header/footer) and then txpesets this table. Gathering the content is no Problem and I ...
0
votes
1answer
73 views

Chapter No. in Theorem style

I'm using \documentclass{book}. I'm also using the code below to create a theorem style, however, it only puts the title on top. I want to modify the code so that I get => Theorem ch. no. theorem no. ...
2
votes
2answers
62 views

Defining an environment that leaves the surrounding environment

I'd like to define an environment like this: \newenvironment{antiitemize}{\end{itemize}}{\begin{itemize}} I call it antiitemize because I intend to use it inside an itemize environment to break out ...
2
votes
2answers
90 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 ...
1
vote
1answer
53 views

how to decrease spacing after item (using mbox)

In the following example I am facing some issues regarding enumerate: Firstly, in order to make sure the items start in separate line, I used \mbox{}\, however the items have shifted a bit more ...
4
votes
2answers
51 views

ltablex inside environment throws \end -error

I wanted to use a tabularx (ltablex package) inside an environment, but there is an error (but it still builds okay). I'm using ltablex, because I want a longtable spanning several pages with the ...