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

Align environment

I'd like to ask how in align environment to number only one of the equations. \begin{aligned} \mathsf{E}[W^{i}_{t}-W^{i}_{s}]&=0,\\ ...
3
votes
1answer
90 views

Storing contents of environment within align

Now we are at it here is another one that has been puzzling me. \documentclass[a4paper]{article} \usepackage{amsmath,environ} \def\storer#1{\def\data{#1}} \makeatletter ...
6
votes
1answer
267 views

write contents of an environment to document and toc

I want to write the contents of an environment to the document and the toc. Here's a MWE hacked to look (almost) like what I need. \documentclass[pdftex,12pt]{book} \usepackage{hyperref} ...
2
votes
1answer
341 views

Prevent caption to appear on separate page

I'm using a custom listing environment which does not float taken from Code spanning over two pages with minted, inside listing with caption. The caption is done with the caption package. The ...
5
votes
1answer
118 views

Safeguard an environment against tabular mode

The semantics of a given environment require that it is typeset inside a minipage if it is used inside a tabular. If I add the minipage declaration for a positive check for "internal" mode in the ...
16
votes
5answers
871 views

How to put a star (or other symbol) in sections that are “special” (difficult, optional, etc)?

I'm currently writing a book, and I'd like some of the sections to be clearly marked as "difficult" or "optional". Not only sections, but also exercises (I'm using the exercise package) and theorems ...
15
votes
3answers
10k views

Creating a new environment with one optional argument

I want to create a new environment with one optional argument in LaTeX. Here is what I used: \newenvironment{argument}[1][]{% \par \noindent \textbf{Argument#1:} \noindent} {} When there is no ...
10
votes
3answers
438 views

How do you put a character in the margin (using an environment)

I'm using framed to create a little callout box for tips and other information in a book. So for it's going well however I cannot get the icon (using ding) to sit in the margin. It currently looks ...
4
votes
1answer
1k views

Specification in `theorem` environment also bold

I'm using the following packages/options in my article: \documentclass[b4paper,12pt]{article} \usepackage[english]{babel} \usepackage{amssymb} \usepackage{amsmath} ...
5
votes
3answers
641 views

Command enclosing content of custom environment

I want to create an environment that wraps the content in a command so that I can write this: \begin{mybox} content \end{mybox} and get this: \psshadowbox{content} When doing it as a custom ...
13
votes
1answer
256 views

How does LaTeX implement environments?

Do you know how LaTeX implements environments? To be more precise, what does \newenvironment{<env-name>}[<n-args>][<default>]{<begin-code>}{<end-code>} in terms of TeX ...
6
votes
2answers
609 views

Custom environments with multicolumn header

I tried to create an environment that creates a tabular frame around the content of the environment. For instance: \begin{tabular}{|l|l|} \hline \multicolumn{2}{|c|}{Team sheet} \\ \hline ...
2
votes
2answers
539 views

Making more easy the itemized of item with tabulation system

Actually, isn’t not really a question. (Since my examinations get close, I don't really have the time to search for a solution to my problems.) Rather than using the common \item, I'd like to use ...
4
votes
1answer
343 views

Numbering sequent proofs like equations

I am trying to reproduce some very old articles for use in an anthology. Some of these articles present certain rules of inference as proofs in sequent calculus, but number them along with equations, ...
19
votes
3answers
2k views

Formatting FAQ lists in LaTeX

I want to format a list of "Question + Answer" pairs in a TeX-document. In HTML I use the <dl> command: http://www.w3.org/TR/html401/struct/lists.html, e.g.: <dl> ...
4
votes
2answers
667 views

Is there an “identity” (or “no-op”) environment that simply uses its contents unaltered?

In the functional programming paradigm, it is common to have functions accept other functions as parameters. This paradigm can be followed in LaTeX, too: A macro can accept parameters which themselves ...
5
votes
1answer
2k views

lstinputlisting does not include file within lstnewenvironment?

I want to use lstinputlisting to include a file with code within an lstlisting block, which is defined through a new environment. However, the lstinputlisting command itself, not the code, is ...
2
votes
1answer
520 views

Tabular: set a line between each row in \newenvironment

I have created a particular table with 3 columns using \newenvironment. Now I want to put a line between each row and from the 2th to the 3th column. I know it is possible to add \cmidrule{2-3} at the ...
16
votes
1answer
671 views

How to define a starred version of an environment in LaTeX

I am interested in defining a new environment in LaTeX that has a starred version. How is this done?
6
votes
3answers
154 views

String parsing macro fails within custom cite command of biblatex?

I am trying to use the same string parsing macro as in String parsing macro fails within a minipage environment?; but this time in context of biblatex - and I'm having similar problems, I guess. ...
4
votes
1answer
518 views

String parsing macro fails within a minipage environment? [closed]

I am trying to work with a string parsing macro, found in the answer of TeX capacity exceeded while parsing a date string - TeX - LaTeX. Basically, I have strings num01, num02... num09 - from these, ...
10
votes
1answer
2k views

Change only the ending with renewenvironment

I have a theorem environment I've made called "ex" (using the theoremstyle "definition"), which I use for examples in a book document class. I like that I can number the examples, but I want a proof ...
3
votes
1answer
391 views

Difference in behaviour between tabular and flushleft environments

In response to my earlier question the following working code has been provided: \documentclass{article} \usepackage{showframe} \begin{document} \hfill \begin{tabular}{l@{}} some text\\ some other ...
6
votes
1answer
231 views

Custom environment move to end of chapter

I have written a custom example environment for formatting mathematical worked examples. These are currently included in the sections they are related to, however are sometimes looking a bit ...
26
votes
1answer
219 views

Why is there no \provideenvironment?

LaTeX2e provides a \providecommand but there is no \provideenvironment which defines an environment only if it (or a macro with the same name) was not defined before. Is there a specific reason why it ...
6
votes
2answers
179 views

Frame environment with fixed size given by numbers of characters and lines

I would like to make one framed environment with the following behavior. Only the last 8 lines of the content must be displayed. If the content have more than 8 lines, a gentle warning must be ...
8
votes
2answers
239 views

Ignore first parskip inside a save box

I have the following definition (MWE below) of a lrbox. If I use the normal setting parskip=off the interaction \mdf@restoreparams works as expected. Inside the lrbox I can use parskip and parindent. ...
8
votes
2answers
466 views

Write a LaTeX macro to differentiate the text

I'm writing a report, and, for editorial purposes, I would like to use different fonts for each part of the report. I think I need to write a macro for it, but I don't know how to have this effect: ...
6
votes
1answer
551 views

How to use figure inside a exercise environment?

Trying to use figure inside an Exercise environment (exercise.sty) gives me "LaTeX Error: Not in outer par mode." Example: \documentclass{article} \usepackage[]{exercise} \begin{document} ...
0
votes
1answer
385 views

textpos error with newenvironment{aside} and xelatex

I'm using xelatex with texlive 2011 vanilla on the latest ubuntu precise pangolin. I fork and try to use the great cv template from https://github.com/afriggeri/cv This template uses TikZ for the ...
3
votes
2answers
208 views

How to use an environment defined by the versions-package inside another environment

When I use the versions package to conditionally exclude content like this: \documentclass{article} \usepackage{color}% just as example \usepackage[tracing]{versions} \excludeversion{vers}% opposite ...
4
votes
1answer
249 views

Text environment with vertical header and border

I have no experience with creating latex environments, so I hope that someone would be so kind helping me trying to create a new text environment with a border and a vertical header to the right of ...
4
votes
1answer
406 views

<F5> in vim-latex doesn't expand environment

I'm new to vim-latex and have been reading some tutorials. I've noticed that the behaviour of the F5 on my machine is rather different from what the tutorials tell me. I'm supposed to expect F5 to ...
3
votes
2answers
180 views

Sharing parameters between a command and an environment

(This question is related to Using \total of totcount package in section title) I'd like to keep track of the papers I review, and I have written a code (MWE shown below). The code keeps the count of ...
10
votes
3answers
409 views

Environment that obeys spaces

I need to build one environment that obeys spaces, but not new lines, and also change tabulation into four spaces. I can't use verbatim because I would also like to use macros in my environment.
3
votes
1answer
184 views

Define an align environment that always aligns to the first equal sign

I noticed that 98% of the times I use align or aligned I place the & just before the first = of each line. Is there a way to define a new environment that automatically aligns equations to the ...
4
votes
2answers
476 views

Problems When Escaping from Listings

I would like to use LaTeX to document my C++ code, since I am able to typeset mathematics easily, as well as create diagrams using TikZ. I made a minimal LaTeX template for testing, but I have already ...
0
votes
1answer
110 views

Is there a package with standard theorem environments and math functions

I would like a package that defines nice things by default like: Theorem environments like definition, property, example etc. Standard includes like subfloats, the amsmath family Reference functions ...
7
votes
2answers
537 views

How to put environment text inside node?

Consider a simple environment in the documentclass as \newenvironment{abstract}{ \node (tbl) { }; } The content of \begin{abstract} Content \end{abstract} will goes ...
2
votes
2answers
2k views

Problems with environments in TeXStudio

This document \documentclass{article} \usepackage{amsthm} \newtheorem{lemma}{Lemma} \newcommand{\mycommand}{Here is the command} \begin{document} \begin{lemma} Here is the lemma \end{lemma} ...
15
votes
2answers
2k views

How to create new table environment

I am working on a book that has many many such tables. Is there a way to create shortcut for the code shown below. I want to make table caption a variable, because in the MWE shown below except ...
25
votes
4answers
5k views

Numbers outside Math environment

Should numbers inside the text be placed inside a math environment? For example, if I am writing ...indent code by 4 spaces..., should I write it this way or ...indent code by $4$ spaces...? ...
5
votes
3answers
630 views

How to extract parts of (La)TeX document?

I want to run queries against LaTeX documents like these: get list of all equations, even if one declares \def\be{\begin{equation}} and uses it; get list of all arguments of some command (e. g. ...
8
votes
3answers
388 views

Verbatim in environ’s \BODY

I’d like to print a TeX install guide for different OS, but the most text is the same for all OS. So I build the following \documentclass{article} \usepackage{environ} \newcommand{\mlw}[3]{} ...
3
votes
1answer
187 views

afterpage + list = missing \item

I'm trying to use the afterpage package to automatically insert text at the top of each page (please see my other question Section reminders at the top of each page?) but I'm having trouble. ...
16
votes
1answer
3k views

Avoiding “\Url Error ->\url used in a moving argument.” in a custom environment

I have a document I'm trying to render using two classes -- my university's dissertation .cls, and tufte-latex (my uni's styleguide is ugly, and I want to make a pretty-print version for my own ...
9
votes
2answers
233 views

Not display the content of one environment when its content contains one special macro

I need to build one environment for proofs in my lessons. \begin{proof} ... \end{proof} This environment could have one content containing one macro named \lines like in the following example. ...
3
votes
1answer
387 views

Getting errors when using the grammar environment before \chapter{} and \begin{description}

I hope you can help me. I am using an empty grammar environment, included in the syntax package, within a file called appendix_c.tex, whose contents are as follows: \chapter{Modified version of the ...
6
votes
1answer
414 views

Plain enumeration of theorems definitions etc

In my TeX document Theorems, Definitions, Lemmas are enumerated in the following way: Definition 1.1 Lemma 1.1 Theorem 1.1 Definition 1.2 Lemma 1.2 Theorem 1.2 But I would like to have ...
17
votes
2answers
370 views

Why do I have to put the center environment in a group for \@afterindentfalse\@afterheading to suppress indentation?

Consider the following two macros, the only difference being that one has the environment inside a group: \documentclass{article} \makeatletter \newcommand\thisworks{% {\begin{center} $\ast$ ...