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

5
votes
1answer
26 views

How to end a user-defined environment having conditional start definitions?

For silly example, the following user-defined environment initiates either the itemize environment or the enumerate environment, depending on the optional argument. But if the argument variable cannot ...
1
vote
1answer
39 views

Remove whitespace around own environment

Does anyone know how to remove the whitespace which is created by TeX everytime I use my own created environment? I tried the tricks with \ignorespaces and \ignorespacesafterend but that doesn't seem ...
1
vote
1answer
31 views

Problems using hooks

I am trying to duplicate a document using hooks at the beginning and the end. Here is a minimal example of my problem : \documentclass{minimal} \usepackage{environ} \usepackage{forloop} %Repeat ...
3
votes
1answer
55 views

What to use for itemize/enumerate/description type question

I have a lemma in which I want to say something like this: Let f be a function which satisfies either (A) f=0 and f is continuous, or (B) f=1 and f is well-defined. Then f is good. ...
4
votes
1answer
47 views

Blank left and right delimiters produce an unknown symbol

I recently compiled one of my files after updating my TeX distribution (including the unicode-math package, as I use the MinionMath font set) and noticed a strange error. In my file I used a cases ...
4
votes
1answer
55 views

How to condense environments and options to one environment?

In order to make grey boxes around code in my document I am using: \usepackage{listings} \usepackage{xcolor} %custom colours \usepackage{mdframed} %nice frames \definecolor{light-gray}{gray}{0.95} ...
0
votes
1answer
24 views

how to create a list for mdframed example boxs

So i found the question Make an Example and shaded box like in the book which fitted to my desires. I modified the box and counter so it fits to my whishes. (first number is the chapter second number ...
2
votes
1answer
26 views

Misplaced frametitle in new environment

In beamer, I defined a new environment for frame. My problem is, the frame title now comes along the text, instead of appearing at the top. See the working example. \documentclass[]{beamer} ...
0
votes
0answers
20 views

Call environment lstlisting without begin-end [duplicate]

I want to create a command for calling the lstlisting environment without the use of \begin{lstlisting}...\end{lstlisting}, i.e. I want to write something like \lst{text in enviromnent}. I have tried ...
1
vote
1answer
57 views

Enumerate with \noindent

I am creating a custom macro for enumerated lists, but with this attempt, I haven't been able to eliminate the indentation of the item numbers. Every time I use \myitemize, the lists still indents. ...
1
vote
1answer
23 views

Wrap single command as environment [duplicate]

I am trying to define a note environment, currently it is just a wrapper of \marginpar function like this: \newenvironment{note}{\marginpar}{} but \begin{note} Important Notes \end{note} will ...
1
vote
0answers
36 views

How to make a new figure environment that does additional stuff?

Currently I have a document in which most caption of figures and tables is placed in the margin, using mcaption. But for some figures and tables I need the full width (textwidth and margin). Both ...
15
votes
2answers
312 views

Environment to stack a word and a number

There is a requirement to write a list of words, underline each word and place a number centered below the line. Using the stackengine package I have prepared the following MWE. ...
4
votes
1answer
60 views

How to define a new left-aligned environment?

I am working on preparing a document in latex, and I need to define an new environment as follow: When the code is: \begin{IF} the sum of $a$, $b$, and $c$ is 10,\\ the product of $a$, ...
1
vote
1answer
32 views

Redefining an environment and summary box using grid and gridleno

This question is inspired by Gonzalo's great answer here concerning his creation of gridleno.sty to enhance the functionality of grid.sty. Ultimately I have two seemingly simple questions (please ...
2
votes
1answer
45 views

Shaded theoremstyle

I'm trying to create a theoremstyle whith a shaded background. As I already have a working preamble I'd like to change as less as possible. Previously I defined an own theoremstyle 'selfdefined' which ...
4
votes
2answers
66 views

Move tag next to equation in align environment

It's my first time asking here but I have got so much help from this site :D My particular case is that I need order and tag Maxwell's equations but I need set the tag in a particular location, just ...
1
vote
1answer
32 views

How to automatically escape special characters in your own environment?

I need to create my environment for examples of source codes. I want it to look like this: Code example: ------------------------------------------------ # This is the code example echo 'Hello' ...
33
votes
3answers
727 views

Do fontsize environments exist?

Without any doubt there are fontsize switches in the form of control sequences (described here for instance.) But, from time to time I ran into code examples where environment versions of those were ...
2
votes
0answers
34 views

(Is it wrong to) Use commands to begin and end equations (?) [duplicate]

I'm helping a professor write the second edition of his book, so I'm working with a lot of "old" code and bad practices. Something I've found is that he has defined macros for beginning and ending ...
2
votes
0answers
39 views

How do I make unruled footnotes within an environment?

I have a single environment, fancyfoot, in which I would like footnotes to have no rules. \documentclass{memoir} \usepackage{lipsum} \newenvironment{fancyfoot}{ \renewcommand{\footnoterule}{} ...
2
votes
2answers
76 views

Definition of a macro with multiple arguments and usage of \csname

Why does the following code not work ? \Requirepackage{amsthm} \renewcommand\newtheorem[2]{% \NewEnviron{\csname #1\endcsname}[1]{% ##1 : \BODY } } I have seen examples of the use ...
3
votes
2answers
30 views

How can I print beginning and end values of a counter within an environment?

I'm working on a formatting system for standardized tests. Within each section of a test, there are groups of consecutive questions that I might choose to contain inside an environment. ...
1
vote
1answer
22 views

Use macro as totcount counter name

In the top level of the document environment, a macro defined (using \def) can be expanded into the name of a totcount counter. This, for some reason, does not work inside an environment definition. I ...
8
votes
3answers
871 views

Making an anti-clockwise circled arrow around a + sign in a math environment

\makeatletter \newlength\@SizeOfCirc% \newcommand{\CricArrowRight}[1]{% \setlength{\@SizeOfCirc}{\maxof{\widthof{#1}}{\heightof{#1}}}% \tikz [x=1.0ex,y=1.0ex,line width=.15ex, draw=black]% \draw ...
2
votes
1answer
49 views

NewEnviron, \BODY and lstlisting [duplicate]

I was trying to understand egreg's answer to Hide content to show later, and I noticed that there were some problems when using lstlisting or tcblisting environments inside the solution environment ...
1
vote
1answer
57 views

Legrand Orange Book template Example colorbox from black to ocre

In the Legrand Orange Book template, I would like to change the begin and end of the Example Box color from black to ocre: and Here is the code from the structure.tex file where the example ...
3
votes
2answers
77 views

Is it possible to “scan” the text within an environment?

Say I have an environment env which is used like this: \begin{env} *Text* \end{env} Is it possible to "use" *Text* in the definition of the environment (top or bottom part) - similar as a ...
1
vote
1answer
33 views

“Problem definition” environment

Is there such a thing as an environment for defining problems? See this picture for an example of what I want to achieve: Thanks!
1
vote
0answers
13 views

Is it possible to include a lstlisting code block inside an lstlisting? [duplicate]

I am trying to include a LaTeX code within an lstlisting. But the problem is that the LaTeX code includes an lstlisting, so the \end{lstlisting} within the included code is terminating the actual ...
4
votes
2answers
89 views

Compilable custom environment when in the body text becomes uncompilable when defined as a new environment

I attempted to make a table which has gray backgound cells except for the first column and the first row colored blue. The following code successfully generates the desired output (although I do not ...
10
votes
2answers
135 views

Strikeout all text, including enumerated lists

Is it possible to define an environment that strikes out all text, even in enumerated lists? I am basically trying automate what is currently being done manually in Microsoft Word. I have a body of ...
0
votes
0answers
35 views

Predefining placement of figures and tables in custom package

I am trying to define figures in a new custom package using \newenvironment{name}{begin defs}{end defs} and minipage command (code is given below). if i create a \newcommand{\name}{defs} (named as ...
3
votes
0answers
40 views

Extensions to the standard environment, what is out there?

\NewDocumentEnvironment from the xparse package allows accessing environment arguments also in the code that is supposed to go after the content. environ and newenviron allow referring to the ...
2
votes
0answers
41 views

Can the hygiene problem of environ and newenviron be eliminated completely?

The packages environ and newenviron both provide an alternative to the standard environment macros included with LaTeX. The main difference is that they make it possible to refer to the environment ...
5
votes
1answer
87 views

What are the uses of being able to refer to an environment body by a macro?

The packages environ and newenviron both provide an alternative to the standard environment macros included with LaTeX. The main difference is that they make it possible to refer to the environment ...
3
votes
0answers
44 views

wrap around task environment not working

I am trying to create an environment wrapping a task environment (from the tasks package). To build the new environment I am using the xparse package. \documentclass{article} \usepackage{xparse} ...
15
votes
1answer
274 views

LaTeX programming Inheritance with \newcommand \newenvironment \renew… etc

I'd like to create (or renew) several LaTeX commands and environments, and understand how it works. One of my new environments would be equivalent to \begin{quotation}. So, imagine my \begin{foo} ...
4
votes
1answer
88 views

Macro for creating a table

I want to have a macro that creates tables of a specific type which specialize in multiple choices questions. The required command \createtable{#1}{#2}{#3} has three arguments: The total number of ...
4
votes
1answer
89 views

Intended Paragraphs Inside Environment

I have decided to come back to beautiful LaTeX typesetting after several years. I have just decided to hone up my LaTeX skills but have found out that it will be not easy. Here is my question: I have ...
1
vote
0answers
69 views

what is the change in macro expansion when using environ and newenviron as compared to the standard environment

The packages environ and newenviron both provide an alternative to the standard environment macros included with LaTeX. The main difference is that they make it possible to refer to the environment ...
4
votes
1answer
45 views

\AtBeginEnvironment not accepting parameters in the code

etoolbox's docs say in the section on environment hooks: Parameter characters in the code argument are permissible and need not be doubled. However, this won't compile: ...
3
votes
1answer
27 views

Using apptocmd inside newenvironment

I try to produce a document containing an exam and the associated correction. I want automatic hyperlinks from the question to the associated answer and vice-versa. Using the solution given by ...
2
votes
1answer
52 views

Problem with adding exercises - “missing \item error”

I have the following MWE: \documentclass[12pt]{article} \makeatletter \usepackage[dutch]{babel} \usepackage{blindtext} %Paragraphs get numbered continuously \usepackage{chngcntr} ...
2
votes
1answer
31 views

Environment for Counting Names and Marking the count as Subscript

For typesetting a religious document explained as below This contains verses of list of names separated by commas. A counter is to be initiated and will be incremented with each name. Each name ...
4
votes
1answer
93 views

Making headings that depend upon later environments

I want to typeset a test and a marking scheme. I have the following code: \documentclass{article} \usepackage{ifthen} \usepackage{amsmath,amsfonts,amsthm,amssymb} \setcounter{secnumdepth}{0} ...
3
votes
1answer
34 views

Data structure: Define a command or environment only valid inside a certain type of environment

I want to script the generation of LaTeX documents, and therefore, I will need to use a data structure to organize the information. For example: Person: Name Phone Address I know in LaTeX you ...
1
vote
1answer
19 views

Allow page break in table in customized environment

\documentclass[12pt]{report} \usepackage{amsmath,enumerate} \usepackage[top=1cm,bottom=1.5cm,left=1cm,right=1cm]{geometry} \usepackage{booktabs} \usepackage{longtable,tabu} % allow page break ...
0
votes
1answer
35 views

How can i write the text show in red rectangle?

How can i write the text show in red rectangle?
4
votes
2answers
140 views

How to use \newenvironment; why doesn't this code work? How do I fix it?

I've been trying to find out but my latex skills are too weak to understand what seem like similar problems. When I try this: \documentclass{memoir} \usepackage{graphicx} \usepackage{exsheets} ...