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

4
votes
1answer
463 views

Create an environment like the `checkboxes` in exam.cls

I am having trouble on how will i create something like the checkboxesor oneparcheckboxes environment in exam.cls. The only difference is that since the checkboxes gives circle, i'd like to create ...
2
votes
0answers
49 views

Is it possible to check if I am inside a float environment? [duplicate]

I have a class file that I am writing (it's my first one and I am new to LaTeX). I have a situation where I'd like to know if I am inside a float so that I can prevent attempting to create a nested ...
14
votes
1answer
387 views

Is there a way to have an “empty” environment to merely limit scope of declarations?

I am fairly new to LaTeX, so I apologize if this is a beginner question, but I have not found a good way to query for it otherwise. I have observed that when I use an environment like ...
4
votes
1answer
925 views

Using tabularx in a custom environment - “misplaced \noalign”

Question Currently, I'm trying to shorten the creation of small tabularx-tables with pre-defined headers, but somehow, trying to use the tabularx-environment, even though I used the \tabularx and ...
2
votes
1answer
109 views

Content being pushed off page, no new page being started

I've got a custom class made for homework assignments, and I'm only just now running into an issue with it. I made a couple of custom environments for problem/solution pairs, and I used a tabular to ...
16
votes
6answers
497 views

A new environment to decide dynamically which commands to run?

I am having some user defined commands defined and used in my latex document. I need a way to check whether any of the commands is used. I want to make decisions based on the argument used in the ...
2
votes
1answer
1k views

Create new environment with options

I'm new to creating new environments and even though I searched at the xparse*documentation I couldn't figured out how to solve my specific problem. I would like to create a new environment, say ...
1
vote
3answers
202 views

Is there other possible way for continuous numbering?

I am creating a document using exam class. I have four question types here which i had created each a command. Is there facility to enforce continuous numbering for each question types instead of ...
5
votes
1answer
551 views

How to prevent indent on second line with packed itemize?

How to prevent indent on second line with packed itemize instead of itemize? In other words I dont want "Major" to be indented. \documentclass[letterpaper]{article} \usepackage[empty]{fullpage}% ...
4
votes
2answers
160 views

My custom theorem/proof environments aren't playing well together

As can be shown in the following MWE, when I have a theorem environment followed by a proof environment, the proof isn't going into the next line; it's rendering right on top of the text I have for ...
8
votes
2answers
499 views

Patch tabular environment with colorbox

I'm trying to quickly add a colored background using colorbox to all tables as shown in this answer. While I could just update all the TeX by hand, I am trying to patch the tabular environment to ...
10
votes
3answers
327 views

Defining a list environment with multiple optional arguments

I'm trying to define a list environment with multiple optional arguments and with a default values for those arguments. For example, creating a new environment with a name newenv, which accepts two ...
1
vote
0answers
47 views

How to avoid text style adoption in environment? [duplicate]

When I define a macro such as: \newcommand{\mymacro}{a_{\text{sample}}} the "sample" text is italic when used in e.g. an example environment. How can I make sure it will not adjust to this ...
4
votes
1answer
84 views

Problem with referencing to a newenvironment

The reference I'm using below doesn't work. I think I'm missing something in the definition of myclaim. Any ideas? \documentclass{llncs} \usepackage{amsmath} \newcounter{claimcounter} ...
6
votes
2answers
162 views

Getting the first line of an environment

as the title suggests, I'm looking for a way to get the first (printable) line in an environment. My first naive attempt (ignoring the printable requirement) was something like this: ...
1
vote
1answer
342 views

Counters for claims

I want to redefine the claim environment so that it will be numbered but I'm having a hard time with the counters. I want the following: \begin{theorem} thm 1 \end{theorem} \begin{proof} ...
9
votes
1answer
227 views

how to redefine \begin{align*} … \end{align*} to \begin{eqnarray*} … \end{eqnarray*}

Scientific word insists in generating displayed math using \begin{align*} ... \end{align*} and htlatex has a bug in that it does not generate bit mapped images in this case. The fix that I found ...
4
votes
2answers
167 views

I can't use & tabs in the `align` environment while using it inside a custom environment

I've got a custom environment made for problem sets, and it uses a tabular to align the question number and question body. When I try to use & to group parts of an equation together - like if I ...
1
vote
1answer
494 views

Problem using enumerate environment in a proof newenvironment definition

I want to define a simple environment to enclose my proofs, actually I just wanted to put a little square right at the end. So, I made this new environment definition: \newenvironment{Proof}{ ...
3
votes
1answer
123 views

Custom environment problems using environ

As shown by my MWE, I have two small issues that I'd like to get assistance with in fixing. First off: When I start two problem environments one after another without a blank space between the ...
0
votes
2answers
160 views

How do I make frame environment play nice with \textbf?

I am getting a strange error message when I put textbf into a frame environment. Minimal Example \documentclass{article} \listfiles \begin{document} \begin{frame} \textbf{Lemma 1} \end{frame} ...
3
votes
2answers
85 views

Cross-referencing a custom environment with two arguments

Sorry if my question title is ambiguous. I want to write an environment called "problem" that works as follows. I want to be able to write \begin{problem}{1}{2} this is a problem statement ...
8
votes
1answer
266 views

Replacing Leading Minus Signs in Environment

In this question concerning negative signs and the alignment of entries in matrix environments, Heiko Oberdiek gave a great answer in which he uses a user-defined command called \matminus instead of ...
0
votes
1answer
240 views

How to get minipage to fill remainder of width up to right margin?

I'm trying to design a custom question\solution environment for homework assignments (I'm aware of the exam class but I am choosing to try and make my own) and am having problems with the alignment. ...
4
votes
1answer
270 views

How can I make an environment so that I can reserve space for text next to a figure?

I'm working on a layout for a custom textbook class, and I'm having issues getting this environment to work as I like. Here's a shot of my current working layout: I'd like to be able to make an ...
3
votes
1answer
673 views

Can't use theorems in lyx (mac)

I want to switch to lyx, but I'm having a hard time trying to use environments. I red that they are supposed to be as a class in the drop down list at the top left (If I'm nor wrong, together with ...
8
votes
1answer
1k views

Defining a new type of floating environment

In a document, I need to provide some details about specific topics without disrupting the flow of the main document, so that the details may easily be omitted at first reading. To do so, I thought it ...
5
votes
2answers
369 views

Multiple split equations

I find myself again and again using a combination of the gather and aligned environments. So it would be nice to not have to write so much. In particular, it is often only clear after writing the ...
16
votes
2answers
860 views

A special example environment

How can I define an environment named "example" so that: can be broken over pages has a horizontal line above "Example \chap.\no" (e.g. Example 4.10), and vertical line that is spread to the whole ...
19
votes
7answers
822 views

How to create a command that automatically escapes curly braces?

How could I create a command that will automatically escape all curly braces within the current environment? For instance, I would like a command (or environment, I suppose) that allows me to write ...
11
votes
2answers
993 views

A new environment based on enumerate

I have defined the following simple environment: \newenvironment{renumerate}{\begin{enumerate}\raggedright}{\end{enumerate}} I wonder how the above can be modified to use with, say, the following: ...
2
votes
1answer
245 views

Parameterised Enviroments in Lyx

Ok, I have a set of structured data that I want to format consistently. In this case a set of spells for a role-playing game. Now in Latex I vaguely remember I could do something using ...
10
votes
1answer
2k views

Adjusting space before and after a latex beamer block

I wanted to ask you if there is a better way to adjust the spacing between two beamer blocks: \documentclass[slidestop]{beamer} \usetheme{Madrid} \begin{document} \addtobeamertemplate{block ...
7
votes
1answer
93 views

newenvironment with displaymath causes strange extra space/indent on following line [duplicate]

Possible Duplicate: Spacing issue for newenvironment wrapper of equation environment I have \newenvironment{mymath}{\begin{displaymath}\begin{array}{l}}{\end{array}\end{displaymath}} ...
1
vote
1answer
62 views

Avoid skipping before environment

I'm having trouble handling vertical space with my custom environments. I noticed that using \unskip after the environment eliminates that space, but I have found now solution for the space before ...
3
votes
1answer
130 views

Using cleveref with newenvironment

I am trying to refer to a newenvironment using cref from the cleveref package. Here is a MWE that demonstrates what I am trying to do. \documentclass{article} \usepackage{cleveref} % define a ...
5
votes
1answer
85 views

Can I redefine \begin so that it does not complain about undefined environment

I'd like to be able to do the following kind of thing: \documentclass{standalone} \begin{document} Foo \begin{MyUndefinedEnv} Bar \end{MyUndefinedEnv} \end{document} without LaTeX complaining ...
14
votes
2answers
197 views

Repeating environment contents twice

I'm writing a document where I have many code blocks like so: \begin{align} d = \sqrt{ (x'-x)^2 } \end{align} \begin{minted}{latex} d = \sqrt{ (x'-x)^2 } \end{minted} So the first line renders ...
3
votes
1answer
68 views

Renewenvironement error

I'm using the epigraphs package, but try to redefine the epigraphs environment (to later on add something to it, e.g. a page break before). So I thought I do it like this: ...
3
votes
1answer
315 views

how to redefine \href to \htmladdnormallink when in \htmlonly?

I use Scientific word (SW), which generates Latex, then I process the Latex output using Latex2html (l2h) to generate HTML as the support for HTML is better with l2h than SW (table of contents, break ...
4
votes
1answer
249 views

Multiple caption names for listings code (lstinputlisting) based on type of code

In my document I have used: \renewcommand\lstlistingname{Algorithm} \renewcommand\lstlistlistingname{Algorithms} to rename my lstlistings titles. The problem is that now I want to add a different ...
7
votes
2answers
488 views

Defining shared counters for theorem environments *after* environments are defined

I am trying to use the same numbering for theorems, propositions, definitions, etc. This is normally easily be solved by using amsmath and defining these environments and using the same counter: ...
8
votes
1answer
324 views

Custom environment with fancy text indentation

I am trying to typeset text by breaking it into smaller cameos, numbering each cameo, and putting a heading. See below for an example of how I want the typeset text to look. The code with which I ...
11
votes
2answers
179 views

How to define an environment that begins with a node?

Please see the following definition: \tikzstyle{boxStyle} = [draw=blue!80, fill=blue!9, very thick, rectangle, rounded corners=3mm, inner sep=10pt, inner ysep=15pt] ...
7
votes
1answer
109 views

Lists, counters, and refs

I'm trying to create an environment containing a single-instance, numbered list (so that I can easily control the spacing, etc.). The problem is that I cannot used \ref to cross-ref to the enumerated ...
7
votes
2answers
157 views

How to add an environment in the table of contents?

For example, if I use amsbook document class and have the section Problems, how to include problem environments created like: \documentclass[a4paper,12pt, reqno, oneside]{amsbook} ...
4
votes
2answers
348 views

Turning parts of text on and off

Is there a way to turn certain parts of the text on and off in LyX/Latex ? I'm thinking of having something like an environment (lets call it "TL" for "traffic light") and a parameter t such that if ...
7
votes
1answer
846 views

define a new Example environment

how can i define a new Example environment like the image shown in the following? this environment should have the following attributes: endmarks must be positioned at the last line, whether it ...
5
votes
2answers
292 views

Address book form

I want to create an environment (or any other command) for entering addresses. For example, I want something like this: \newaddress \home \name{John Doe} \phone{123-456-7890} \address{100 1st Street, ...
6
votes
1answer
825 views

lstlisting in a newenvironment

I have a problem with the lstlisting package. I want to define an \newenvironment with one obligatory parameter, which will be the caption name for the lstlisting. I will also have other lstlisting ...