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

1
vote
0answers
13 views

Symbol at the end of an environment [duplicate]

I'm putting a diamond symbol at the of a remark by use of \usepackage{amsthm} ... \newenvironment{rem}{\begin{remark}}{\hfill$\diamond$\end{remark}} However when the rem environment is ...
4
votes
2answers
131 views

Need a Macro for Tables - independent of row and column size

I have created the following macro for Table: \newcommand{\createtable}[7]{ \begin{table}[htbp] \begin{tabular}{|p{8cm}||p{8cm}|} \hline \begin{center}\textbf{\cellcolor{Orchid!25}{#1}}\end{center} ...
3
votes
2answers
72 views

Environment which sends text conditionally to an appendix?

I am writing a paper and would like an environment that has the following property. If some flag is set to "true" in the preamble, all text wrapped in that environment is sent to the appendix. If the ...
3
votes
1answer
175 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 ...
3
votes
1answer
14 views

modification to comment environment

I'm using the comment package, in my preamble I have \specialcomment{notes}{\begingroup \color{Blue}}{\endgroup} so that when I want to comment my text I write \begin{notes}...\end{notes} to get a ...
4
votes
2answers
234 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, ...
6
votes
1answer
76 views

How to track a page change within an environment?

I'm trying to define an environment that can automatically detect when the material within it moves to a new page, reprint one of its arguments at the top of the new page, and change how it closes as ...
2
votes
2answers
28 views

How can I reduce the space around alltt environment blocks?

How can I reduce the space around all alltt environment blocks? \documentclass{article} \usepackage{alltt} \begin{document} Test1 \begin{alltt} some code \end{alltt} Test2 \end{document} This ...
2
votes
1answer
71 views

How can I get a count of the optional arguments with xparse?

Question Is it possible to get and store a count of the optional arguments actually passed to an xparse declare argument/environment? Purpose Regardless of the number of arguments provided ...
2
votes
1answer
71 views

LaTeX command or environment to selectively print one out of several given options

I'm currently wasting my time by trying to create a proof-of-concept class to show that writing our university's curricula with LaTeX instead of MS Word would have some benefits. Since these curricula ...
1
vote
1answer
23 views

Can I make an environment which treats the first paragraph differently to the rest?

I am trying to make a new environment which creates a hanging indent on the first paragraph only but leaves the other paragraphs indented: My code for the above image is: \begin{hang} ...
3
votes
1answer
31 views

Multiline Chain of Implications

I'm new in this forum. Is it possible to create the chain of implications as shown in the image attached, in latex ? Thanks in advance. Tatin
0
votes
3answers
27 views

Problem with lstlisting enviroment

I'm writing \documentclass{beamer} \usepackage{listings} \begin{frame} \begin{lstlisting}[language=bash] #!/bin/bash echo "Hello,world!" \end{lstlisting} \end{frame} But the output ...
5
votes
1answer
119 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 ...
5
votes
1answer
80 views

Tasks in custom Environment

I need to wrap a tasks environment inside a custom \NewEnviron. Apparently, tasks chokes on code besides its \task or \item due to the way it handles its own environment body, presumably causing it to ...
2
votes
1answer
217 views

New float environment in tufte-book with alternate caption placement for full width figures

I am trying to define a new environment for photographic plates in a tufte-book.cls book. The environment should: Work just as the existing figure / table environments do for non-starred uses, and ...
4
votes
1answer
32 views

How to set a newenvironment to skip words by flag?

I want to create a environment to include some words, but hide it when a flag is set up. However, I cannot put \begin{comment} \end{comment} into \newenvironment for some reason. How should I do this? ...
0
votes
1answer
29 views

Customizing enumerate list with item label as parameter of new environment

I want to define a new environment which would allow me to have a like-enumerate list, i.e. have the \items numbered like in an enumerate environment and change the item name by the one given as ...
4
votes
4answers
208 views

How can I typeset an environment and its literal equivalent in an environment?

This is a follow-up to the question: How can I typeset a command and its literal equivalent in an environment? It would obviously be useful to handle environments too. I imagine something like the ...
3
votes
2answers
24 views

Paragraph indentation after lstlisting environments

I tried to indent first paragraph after a customized lstlisting environment \documentclass{article} \usepackage{listings,lipsum} \lstnewenvironment{mycode}{}{\par} \begin{document} \lipsum[1] ...
9
votes
2answers
204 views

How can I make a command available inside another command's argument?

When I define an environment with \newenvironment, I can use newcommand inside the "before" part, to make commands available to the code inside the environment. Is this possible with simple commands? ...
7
votes
5answers
611 views

How can I limit the scope of a \renewcommand instruction to “table” environments?

I want to use \renewcommand{\arraystretch}{1.2} to adjust the space between the lines in my table. Since I have used matrices all over my paper (and this command also affect the matrices) I want to ...
3
votes
1answer
30 views

Custom environment with horizontal indentation

I am trying to create a simple environment that consists two parts: bold text followed by a rightarrow (multiple) lines of text with indentation, below the bold text What I have so far: ...
1
vote
1answer
31 views

Environment that eats up (ignores) text inside it [duplicate]

I want to replicate the environment comment from the comment package: \begin{comment} Hidden stuff. \end{comment} which prints just nothing, instead of using % to comment things out. I can do it ...
3
votes
1answer
24 views

newcommand based on what environment is active

I want to have command to insert different heading style based on what environment is currently active. I found that the environment should be accessible via macro \@currenvir, but for me, the "else" ...
2
votes
1answer
42 views

pgfplots fillbetween doesn't work with newenvironment

Here is a minimal nonworking example: % preamble \documentclass[class=minimal,border=0pt]{standalone} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.12} ...
1
vote
1answer
23 views

autoref on newtheorem

I want to be able to print the names of my own theorems with autoref. E.g. on \begin{lemma} \label{lemma_foo} Some lemma \end{lemma} \autoref{lemma_foo} I want something like "Lemma 3.2" being ...
2
votes
2answers
38 views

Keeping underscores in parameters even inside NewEnviron environments

I followed this answer to define a command such that underscores in its parameter can be kept. However, this does not work if the command is called inside an environment that has been defined with ...
0
votes
0answers
18 views

Longtable integration Stata

As far as I am aware, the available commands that produce LaTeX-formatted tables of stored estimates using Stata, will only produce tables using either the table or tabular environments. Do any other ...
10
votes
3answers
249 views

How can I typeset a command and its literal equivalent in an environment?

UPDATE: I've opened a follow-up question: How can I typeset an environment and its literal equivalent in an environment? I would like to pass a command and arguments to an environment. The output ...
6
votes
1answer
5k views

Using amsthm but still getting “Environment theorem undefined”

I'm trying to write up all my university theorems and I cant get the theorem environment to work. Here is a mini example of what I'm trying to do. \documentclass[a4paper,12pt]{article} ...
5
votes
2answers
123 views

What is the difference between align and equation environment when I only want to display one line of equation?

I am typesetting a physics document, and sometimes I need to type equations of several lines while in most cases I only need to type one-line formula. So is it OK if I always use align environment ...
7
votes
1answer
133 views

Automatic creation of lstlistings in AMC questions

Context I'm trying to get an automatic exam where I can generate random numbers (using pgfmathrandominteger) in the AMC package to create different questions using code (listings) and inputing these ...
4
votes
1answer
99 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 ...
4
votes
2answers
77 views

How to create a custom environment with a listing inside it?

Well consider the following code: \documentclass[a4, oneside,openleft]{book} \usepackage{listings} \begin{document} \begin{flushright}\begin{minipage}{0.9\textwidth}\begin{lstlisting} for (i) { ...
1
vote
1answer
90 views

New example environment, with symbol at the end

Is there a standard formatted environment specifically used for examples? I'm writing a document on linear algebra, with the usual definition-theorem-proposition-example structure. Right now when I ...
4
votes
1answer
49 views

Redefine Beamer Frame Environment

I would like to redefine Beamer's frame environment to provide different templates as part of a theme. However, I'm having some trouble accessing Beamer's variable from inside that code. ...
7
votes
1answer
88 views

Why \begin{flushleft}…\end{flushleft} doesn't behave as \flushleft…\endflushleft?

The following MWE points out that \begin{flushleft}...\end{flushleft} doesn't behave as its macros counterpart: \flushleft...\endflushleft: flushleft environment's effect stops after ...
2
votes
1answer
58 views

Change background color for text block

I want to change the style for \quote areas in my entire document. These three lines is what I came up with. Font and margins changes take effect but not the bg color. Only the first char's bg color ...
2
votes
1answer
19 views

All Environments Share Numbering (According to Subsection)

The numbering scheme I'm looking for causes every environment to share one common numbering counter, according to subsection. For example, in my notes the numbering would look something like this: 1 ...
2
votes
2answers
41 views

Increase table row height but not separation from surrounding text

I would like to construct a table environment that accepts an argument that controls the vertical space between rows but does not influence the vertical separation of the table from the surrounding ...
8
votes
1answer
87 views

Suspending environments and resuming by another environment

Is it possible to interrupt a LaTeX environment, say OuterEnv, by another environment, say InnerEnv, the later closing the first in the environment startup code, doing 'whatever' and then resuming the ...
2
votes
2answers
45 views

Need help to set up a physics question/answer/think environment

I am writing a physics study guide for my students. For working out examples, I created a new environment that can contain up to three parts: the question, the answer, and something to think about ...
1
vote
0answers
36 views

How to align item labels according to the longest one automatically?

Time for revenge! I've been fighting with this problem of aligning items according to the longest label automatically for some time now (see first two examples below). The left side of the longest ...
1
vote
1answer
43 views

equation* environment or \[ \]? [duplicate]

So, I'm writing a mathematics paper, and let's say I have the following: \begin{equation*} 2+2=4 \end{equation*} Is this the proper way to do an unnumbered equation, or is it preferred to do the ...
3
votes
1answer
50 views

Remove unwanted vertical space before and after environment in footnote

I am trying to make my own environment for (left-)indented blocks inside hanging footnotes, in which the normal quote environment doesn't work, it's left indent being the same as that of the indent of ...
1
vote
0answers
40 views

How can I create a new table environment wrapper for pgfplotstable?

A similar question has been asked here: - newenvironment using pgfplotstable At first glance, I thought it was the same question, because the question is not clearly stated. That person is asking for ...
49
votes
8answers
3k views

Why can't the end code of an environment contain an argument?

Environments are allowed to have arguments, but reference to those arguments can only appear in the opening code of the environment, and not the closing code. What is the reason for this, and are ...
0
votes
0answers
34 views

Why can the 7-line TeX file not be compiled? [duplicate]

\documentclass{article} \usepackage{graphicx} \newenvironment{Figure}[1]{\begin{figure}}{\caption{#1}\end{figure}} \begin{document} \begin{Figure}{This is a caption.} \end{Figure} \end{document} ...
0
votes
1answer
35 views

Why does the simplest \newenvironment not work as expected? [duplicate]

\documentclass{article} \usepackage{listings} \newenvironment{hello}{\begin{lstlisting}[language=sh]}{\end{lstlisting}} \begin{document} \begin{hello} ls \end{hello} \end{document} The code ...