{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
1answer
20 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
32 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
13 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 ...
0
votes
0answers
77 views
+50

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 ...
10
votes
3answers
228 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 ...
5
votes
2answers
118 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 ...
4
votes
2answers
108 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} ...
4
votes
1answer
43 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
83 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 ...
1
vote
1answer
83 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 ...
2
votes
1answer
48 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
18 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
1answer
52 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 ...
2
votes
2answers
36 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 ...
2
votes
2answers
39 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
32 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 ...
7
votes
1answer
83 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 ...
3
votes
1answer
43 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
38 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 ...
0
votes
0answers
27 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 ...
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
33 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 ...
1
vote
0answers
43 views

Ending a tikzpicture environment in conditional causes “Missing } inserted”

I want to create a number of tikzpictures. I have a number of items I want to draw. Each tikzpicture takes up a whole page and may contain up to 4 items. (It is not good enough to to have each item in ...
3
votes
3answers
74 views

Remove par indent from environment

The real problem here is that I can't figure out how to modify an existing environment. The concrete thing I want to achieve follows below. I'm pretty happy with what the framed package gives me with ...
4
votes
1answer
44 views

How to use newenvironment inside a table?

How to define a formatting to use for (individual) rows of a table? Example: (For each row) the first column is always bold, and the second column has an italic "title" and some text and possibly ...
3
votes
1answer
61 views

My “definition” environment is in italic

I obtained a TeX "pre-built" file in order to write for my college, but it so happens that every time I call a definition environment (which is defined in the file), it is always in italic. I am not ...
2
votes
1answer
26 views

newenvironment: error with \begin{align} and \end{align}

In the example below, an error is caused by \begin{align} and \end{align} but I do not see why: \documentclass{book} \usepackage{amsmath} ...
7
votes
1answer
129 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 ...
3
votes
1answer
34 views

Q&A environment with separation

I am writing a question and answer problem book. I would like the questions and their answers to be proximal in the source, but, upon compilation, for the questions to all clump together in one ...
3
votes
1answer
44 views

Making an environment with the same text color as the background

I am looking to type up some solutions to math problems. However, I do not want someone who just looks at the document to be able to see the solution; I want the students to be able to see the ...
1
vote
0answers
64 views

Nested mdframed environment problems

I have a problem concerning a mdframed into an other mdframed. If the content of the second mdframed is too important, the result is horrible: it's separated by one page and the content of the second ...
1
vote
0answers
19 views

define environment with Verbatim and options [closed]

I'm working on an edition, and I need to create some environments using verbatim. I use the fancyvrb package and when I write : \documentclass[9pt]{report} \usepackage{xltxtra, fontspec, xunicode, ...
2
votes
1answer
38 views

Textual replacement macros to wrap environment

I want to create simple textual replacement macros for an environment: \def \myEnvStart {\begin{someEnvironment}[enormous list of arguments]} \def \myEnvEnd {\end{someEnvironment}} This doesn't ...
4
votes
1answer
60 views

How to control conditional statements within new commands and environments

I'm writing a pretty complicated class to typeset a book based on memoir. One of my commands draws a caption on the preceding verso page, draws content on the following recto and verso pages, and ...
1
vote
0answers
37 views

Wrap text around with newenvironment

I am trying to create a new environment with a background color. The issue is that I want text to be wrapped around it but I can't do it. The minimum working example is as follows ...
1
vote
2answers
23 views

Save a longtabu in a box for check and reuse

I want to measure the height of a table and insert a \newpage before it if the table is too high. My table is done with longtabu of the tabu package. Where should I start? \documentclass{article} ...
2
votes
1answer
101 views

How can I know if I am inside an equation environment if it's nested with others?

I wanted to define some partial derivative commands that would be \partial y/\partial x if it was inside an inline equation and would use \frac{\partial y}{\partial x} if inside an equation ...
0
votes
0answers
37 views

What environment is best for Copyright page in a createspace novel using scrbook class

I've tried adding page breaks within \frontmatter but it either sticks to the Titlepage formatting, or erases my Dedication page, or adds huge spacing with lineskips. Other experimenting resulted in ...
0
votes
1answer
57 views

Change font spacing and size of bibunits \putbib

In the following example I would like to force my references section to be typeset in a smaller font with single (more condensed) spacing. My commands (a spacing environment call and a font small ...
4
votes
2answers
71 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) { ...
10
votes
2answers
133 views

How to implement common layouts instead of misusing tabular environments?

Note: My hope is that this can become a general resource for "use a list instead" comments. If you have suggestions for improvement, please let me know. I often see comments such as This ...
1
vote
1answer
75 views

Using mathspec \setmathfont with \newenvironment

I would like to change back and forth between two fonts. But I would like these two fonts to affect both normal text, as well as the digits and letters in maths mode. Something like this should work ...
8
votes
2answers
112 views

New environment for boxed equations

I would like to define new environments to highlight certain equations in some way. For example, I would like a highlighted equation to appear in red text or with a box around it. I have the red text ...
1
vote
1answer
36 views

Strip environment command in hyperref PDF meta data

When adding PDF meta data using hyperref you can also use certain LaTeX commands which are magically stripped away during the conversion into a PDF string. But this doesn't seem to work with ...
4
votes
2answers
69 views

How to define labels within a tcolorbox?

Inspired by this great answer, I'm trying to typeset my definitions using tcolorbox. My document contains hundreds of definitions which follow the pattern: \begin{definition} % ... ...
1
vote
1answer
26 views

longtabu from within newenvironment

I'm trying to use a longtabu environment as a replacement for a tabularx environment that I was using. When I try to compile this example, I get the error: ! LaTeX Error: There's no line here to ...
3
votes
1answer
33 views

Printing Caption of an environment in text automatically

Consider the following situation Suppose that I have several environments, each with a caption. To be clear, suppose that I have the following environments: \newtheorem{theorem}{Theorem} ...
5
votes
2answers
43 views

Adding optional arguments to environment

I'm trying to understand and modify this code: \newtheorem*{nonamethm}{\nonamethmname} \newcommand{\nonamethmname}{} \newenvironment{genthm}[1] {\renewcommand{\nonamethmname}{#1}\nonamethm} ...
3
votes
3answers
56 views

Creating a new list Environment, how to change the length of \items

The code for the environment is bellow, For the longer lines in \list item how do I change the length of the \items so that it lines up with the date? Basically I want a kind of "margin" that is on ...