{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
386 views

minipage breaking, or some other route to layout

I'm trying to make a resume with a 2 column layout, where I'll have something like [SECTION NAME] * space * [DETAILS] For example: Work experience[spaaaaaaaaaaaaaace]Some location, 2 years, etc ...
8
votes
6answers
975 views

How to split an example into two parts?

I am trying to have an example (using the theorem environent in amsmath) split in two parts: Example 1 ... Some more discussion Example 1 (continued) ... What is the best way to do this ? The ...
2
votes
2answers
290 views

Custom list of environments (per section)

I'd like to have a list of my custom environments at the start of each section. I read this post, but wasn't able to get the titletoc to help me. The given response worked for floats, but I couldn't ...
4
votes
2answers
1k views

Beamer: Emphasize a part of a slide

I am using Beamer to create presentations. I know that it is possible to use environments like Theorem, Definition and so on: \begin{Teorem} Great theorem \end{Theorem} It appears in the box of ...
23
votes
2answers
3k views

Label and caption without float

I’d like to have an environment that works much like a float, except that it doesn’t float. That is, in fact, I’d like to be able to define an environment that has a label and a caption. I ...
9
votes
3answers
245 views

Remember position of equal sign from one align environment to the next

As you know, the align-environment puts all positions marked with & (normally the equals sign) exactly beneath each other. I now want to save the position LaTeX calculates for & and use it ...
2
votes
1answer
407 views

Renew section command to wrap whole section in an environment

I am trying to write a beamer template for pandoc. For that I need to convert \section{Text 1} Some text. to \begin{frame}[fragile]{Text 1} Some text. \end{frame} Is there a way to do this ...
3
votes
4answers
127 views

Through enumeration

I would like to have problems be consecutively numbered throughout a book, irrespective of the chapters and sections where they appear. E.g. Chapter 1 [Text] 1. Some problem Section 1 2. Some ...
4
votes
3answers
478 views

Problem Set template - explain this preamble to me?

Can someone explain the following preamble to me? This is copied and pasted from a problem set template my T.A. made to help us typeset our homework... I'd really like to understand how it works. The ...
4
votes
2answers
2k views

\bgroup and \egroup?

So I've been looking to expand on the following bit of code (a hack to not screw up the margins when using oversized figures): \noindent\makebox[\textwidth]{% \begin{tabularx}{1.5\textwidth}{XX} ...
4
votes
3answers
238 views

Why does a defined command appear differently in the align environment?

In the LaTeX document shown below, my definition \comp does not show correctly in the align environment. Why it is this the case? ========== Begin LaTeX scripts ============= ...
5
votes
1answer
2k views

Extra intervals before and after flushright environment

I am preparing questionnaire template in LaTeX. I have the following code (simplified): \documentclass{article} \begin{document} \framebox{\parbox{4cm}{ \textbf{3. How often do you have a ...
8
votes
3answers
368 views

How can I indent all text after the label in my example environment

I have built my own example environment for a paper I am working on. I have created a counter to label the resulting blocks of text. Now I want to indent the Text after the label, like so: (1) ...
7
votes
2answers
579 views

Own command to create new environment

The following code isn't very minimal but I hope you will be able to understand the code. \setcounter{errorcontextlines}{999} \documentclass{scrartcl} \usepackage{lipsum,ntheorem} ...
1
vote
1answer
291 views

Defining the caption of newtheorem with a command

In the example below you can see that both environments get the same caption. How to prevent this? You will get the same result if you use an other package like amsthm, theorem or thmtools. ...
1
vote
1answer
366 views

Why does pdfLaTeX fail when I try to use `begin{lstlisting}` inside a user-defined environment?

I'm having trouble with the listings package. I can't compile the following minimal example through pdfLaTeX: \documentclass[a4paper, 11pt, twoside, openright, english]{memoir} \usepackage{listings} ...
2
votes
1answer
99 views

Package with an environment-based sectioning mechanism?

Is there any package for LaTeX that performs sectioning using environments, where doing something like \begin{section}[Section Title] \begin{section}[Subsection Title] ...
5
votes
1answer
4k views

Removing extra vertical space in \maketitle with titling package

Consider the following two LaTeX source files: First, manually producing a title using a new environment (eww): \documentclass[a4paper,10pt]{article} \parindent0cm% ...
2
votes
1answer
1k views

Implementing “aside” environment for explaining details of calculation

I would like to have parts of the text set in smaller time with different indentation, and separated from the rest of the text visually (e.g. by horizontal rules). I would like to use this to set off ...
0
votes
1answer
2k views

Problems with captions in the environment wrapfigure

I'm dealing with a rather weird issue. Using the enviroment \wrapfigure, I receive an error message undefined control sequence \float@caption ... oxrestore ... \normalize @fs@capt ... let alone ...
5
votes
1answer
157 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 ...
1
vote
1answer
263 views

Hyperref with answers [ntheorem]

I read Hyperlink with answers and have tried to apply the technique to my environments that I have defined using the ntheorem package. In the MWE below the answer links correctly go to the questions, ...
5
votes
3answers
814 views

Change line spacing for normal text, but not in tabular or verse

\usepackage{setspace} \doublespacing I used above two lines to change the spacing in my document. This changes the spacing of the entire document. My requirement is to change the line spacing in ...
5
votes
1answer
389 views

How to use macros with parameters inside a \newenvironment?

I would like to define a new environment that changes the section titles via \titleformat. Obviously I have to "escape" the #1 somehow, so it is not considered to be an (undeclared) parameter to ...
19
votes
4answers
735 views

Is there a reason to use \begin{environment} \end{environment} rather than \environment \endenvironment?

What reason (other than perhaps being easier for my syntax highlighter to parse) is there to write \begin{center} Here is centered text \end{center} rather than: \center Here is centered text ...
4
votes
1answer
192 views

converting documentclasses into environments: is it possible?

Rewritten question. For my phd-project i need to quote screenplays. I would like to keep the screenplay layout in my thesis. I know there is the document class called screenplay. Now i am wandering ...
9
votes
1answer
2k views

How can I write multi line equations with alignment in inline math mode?

Is there any way to override the fact that certain environments in LaTeX are automatically "displayed"? One such example is the align* environment. I want to keep my aligned equations inline. So ...
4
votes
1answer
491 views

stack.sty and \end{environment}

I'm writing a multilevel itemize list environment to simplify the process of putting nested lists in Beamer slides, and I want it to support enumerate lists as well. The mitemize environment is ...
5
votes
1answer
233 views

Environment definitions with arguments in \enddef

I was hoping to create a custom proof environment where along with the qed symbol it also mentions what was the claim that was proved. I thought the following would work: \newenvironment{myproof}[1]% ...
9
votes
2answers
1k views

How to include tabularx/y in a new environment?

I am looking for a way to define a customizable environment for tables in my latex documents. This means: caption and label width of table customized column format (tabular preamble) While this ...
3
votes
2answers
500 views

Is there package to create a “Problem-Solution” environment that is symmetric for “twoside” pages?

Background The following screenshot shows a Problem-Solution environment that is symmetric for twoside papers. NOTE: The problem heading is on the right side for odd-numbered pages. For ...
4
votes
1answer
818 views

Quote environment with long reference at the end right – without widows

I need a quote-environment to end with source-references in a new line, flush right. Simply using \begin{quote} QUOTED TEXT \begin{flushright} SOURCE \end{flushright} \end{quote} ...
1
vote
1answer
380 views

Custom (or any) environment inside tabular adds unwanted vspace

I wanted to define my own version of a verbatim-like environment, that has some less line spacing and uses alltt instead of verbatim, so what I can use \(\cdots\) inside. What I tried was: ...
4
votes
1answer
887 views

Defining a command for a minted environment

How can I define a newcommand macro or an environment for minted? What is causing the problem that the following does not work? \newcommand{\CppSourceCode}{ \begin{minted}[linenos=true, mathescape, ...
10
votes
2answers
2k views

Listings: different counters for different listing environments

How do I create two lstlisting environments that each have its own counter? If I use for example \lstnewenvironment{algorithm}[2]{ \renewcommand\lstlistingname{Algorithm} \lstset{ ... } } ...
3
votes
2answers
467 views

How to remove trailing spaces at the end of each line in a block of code?

NOTE: I have to adapt this question to reflect Martin's answer (that actually not 100% solves the original problem) so I can accept it. :-) If I work without standalone document class, I usually put ...
4
votes
1answer
355 views

How to redefine environment that has arguments?

To produce html and pdf files from the same set of sources I need to transform all wrapfigure environments (package wrapfig) to standard figure environments. One example is: ...
5
votes
2answers
307 views

Redefining \enumerate using \let - why does it behave this way and what can I do to bypass it?

The following code produces a result, that I find quite strange: \documentclass{article} \let\origenumerate\enumerate \renewenvironment{enumerate}{\begin{origenumerate}}{\end{origenumerate}} ...
7
votes
4answers
6k views

\overline outside of math mode

If I want to draw an overline over some text, not an equation, how can I do it? \overline seems to only work in math mode, and when used outside of math mode, it automatically says "Missing $ ...
0
votes
3answers
402 views

I failed to use \newenvironment and \newcommand

The following code snippet does not work. \documentclass{article} \usepackage{pstricks} \newcommand\Left{-1} \newcommand\Right{1} \newcommand\Bottom{-1} \newcommand\Top{1} ...
11
votes
2answers
349 views

Restrict macro to an environment

I am quite a noob when it comes to customising LaTeX/XeLaTeX. I would like to know if there's a way to limit the usage of a macro to a specific environment. Consider the following macro and ...
8
votes
3answers
15k views

LaTeX enumerate - bold item with non-bold text

I'm trying to customize the environment enumerate where the \item is bold but the text is not bold. What I've tried is (at the suggestion of one of the google-results): \let\origitem\item ...
3
votes
1answer
525 views

Tabular environment within the \newenvironment

I'm writing a book, in which we refer the reader to the CD-ROM for the source code, and tell him the compiler and the result of running the program. Here's an example: Since this "template" is ...
8
votes
1answer
762 views

Problem with environment expansion and the Tikz external library.

I've created my own environment mytikz, which basically looks like this (full MWE): \documentclass[a4paper]{article} \usepackage{tikz} \usetikzlibrary{external} \newenvironment{mytikz}{%begin code ...
9
votes
1answer
232 views

Suppressing indentation of the next paragraph

I'm trying to define an environment/command, with the following property: The immediate paragraph after the environment must not be indented. The following shows my attempt at defining such ...
4
votes
1answer
159 views

How to avoid duplication of longtable setup code

I have many longtable's in my document. Everything is the same across all the tables, except for the caption and the content (of course). How can I avoid duplicating the stuff required to set up ...
1
vote
2answers
234 views

Problem with the answers package.

I am using the answers package to build a series of exercises. The problem i have encountered is when going from \item $ 5x^2-x \geq 0 $ \begin{sol} $x \geq 1, x \leq 0$ \end{sol} to ...
1
vote
1answer
315 views

Problems using \def commands inside an environment

In trying to build the commands \sol and \solutions to use them inside the exercises environment. The commands must work in this way: \begin{exercises} \exer text for exercise 1\sol{solutionA} ...
3
votes
3answers
3k views

Set width of a custom environment

I'm trying to make a letter template (I don't want to use the existing one) and I am trying to make an environment for the adress at the top. I want it to be a certain width and located to the right ...
5
votes
1answer
781 views

textpos for all pages - environment usage

I'm trying to put some text on topleft for every page of my appendix. I use textpos but it adds the text only one page. I thought I might use an environment and put the appendix between this ...