Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [environments]

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

2
votes
2answers
48 views

csname in newenviroment

I defined a newenvironment with this code (sample): \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{amsthm} \newenvironment{myEnv}[1][default] { \pushQED{#1} \expandafter\...
0
votes
0answers
14 views

How to use description environment in theorem environment? [on hold]

\documentclass[oneside,paper=a4]{scrbook} \usepackage{amsmath,amscd,amsthm,amssymb,mathrsfs,setspace,titletoc,enumitem} \theoremsytyle{theorem} \newtheorem{thm}{Theroem} \begin{document}...
0
votes
0answers
18 views

Numbering all environments within chapter with the same counter? [duplicate]

I want to number my definitions, lemmas, examples, etc. as "chapter"."number of environments"... For example: 1. Chapter One 1.1 Env. A 1.2 Section One 1.2 Env. B 1.3 Env. ...
0
votes
0answers
14 views

How to define an environment for a boxed and named theorem?

The environment below gives a boxed theorem with normal font (non italic text). \documentclass[11pt]{article} \usepackage[tikz]{mdframed} \usepackage{amsthm} \newtheorem{thm}{Theorem}[section] \...
3
votes
1answer
24 views

tcolorbox styles deriving from each other [duplicate]

The listing package allow to easily define styles and environment that derives from each other, which is very practical to avoid to copy and paste a lot of code. I am trying to see how to do the same ...
1
vote
1answer
26 views

Cleverref reference not working in custom environment

I have a custom environment defined in a style file, for which I am trying to create a specific cref counter. Here is my environment and the code in mystyle.sty \newcounter{exampleCtr} \setcounter{...
1
vote
1answer
18 views

Redefine enumerate/answerlist environment

Every two months I have to prepare the written statistics exams for my institute. In order to reduce the amount of printed pages I want to print the items of an answerlist horizontally. The package ...
0
votes
1answer
25 views

Use environment into (new) xparse environment

I'm writing a small library, and for some reasons, it seems that I can't nest environments with xparse's new way of defining environments. It's quite annoying as my users may want to nest environments....
4
votes
1answer
130 views

Should I write \begin{quote} … \end{quote} or \quote … \endquote?

I find it much easier to type \quote ... \endquote than \begin{quote} ... \end{quote} The same goes for other environments. I wanted to know if it is "safe" and "sensible" to proceed with the ...
0
votes
2answers
23 views

How to create horizontal dashline length of page inside description environment

I want to create a horizontal dashline with the length of page margin using the arydshln package. I've read this but when using \hdashline[1pt/2pt] I get an error. How should I implement \hdashline ...
0
votes
1answer
24 views

Defining a custom environment with tabularx

I use this code: \begin{tabularx}{\textwidth}{c|X} \emph{17:49} & Very long text... \end{tabularx} to get this (I want to use LaTeX to keep a personal diary and notes should look like that): ...
0
votes
1answer
29 views

Picture fails inside multicols

I have the following MWE \documentclass{article} \usepackage{lipsum} \usepackage{color} \usepackage{multicol} %-> Defining the INFORMATION environment: \newenvironment{info}[1] {\setlength{\...
0
votes
0answers
16 views

Recursive renew environment using algorithm2e for captions underneath

Putting captions below I am trying to implement putting a caption underneath the algorithm environment when using algorithm2e based on this solution. However, unlike the quoted solution I don't wish ...
5
votes
3answers
260 views

Can't remove one character of space in my environment

The essay I'm working on requires an abstract with no abstract title and does not require any indentation. Therefore, I defined the following: \renewenvironment{abstract} {% \par % \noindent \...
0
votes
3answers
67 views

Command for aliasing environments

I'd like to have a command that defines an alias for an existing environment. My idea: \newcommand{\envalias}[2]{ \let\#1\#2 \let\end#1\end#2 } So e.g. \envalias{eq}{equation} would give me ...
2
votes
1answer
90 views

Define double environments

TLDR; How can I define a "double" environment like in theorems/proofs (with an optional proof)? I'm defining a small library that is supposed to behave more or less like theorems/proof environments (...
0
votes
0answers
12 views

Spacing between the different environments

I want to separate more clearly the different theorems, definitions, examples, ... So I need the space between these different environments to be bigger than space between paragraphs. Is there a ...
1
vote
1answer
19 views

Define an environment from tcbhighmath

Let's assume that I have defined very carefully the parameters of the highlight math style from the tcolorbox package. I would like to define an environment \newenvironment{equationbox}{% \begin{...
4
votes
1answer
40 views

Changing a tcolorbox listing option based on the number of lines of its listing

Consider the following code which produces listings: % ---------------------------------------------------------------------------- % % Preamble \documentclass[12pt]{article} % -----------------------...
1
vote
1answer
10 views

Is there an easy way to use two different sets of options for an environment?

I need to use the two quotation styles shown below (the first paragraph is the normal text): To this end, I am currently using the following code: \documentclass[a4paper]{article} \usepackage{...
1
vote
2answers
38 views

Can't make font (of different family from main) bold in new environment

My document's main text is set as follows: \renewcommand{\familydefault}{\sfdefault} % sans serif to default \usepackage[defaultsans,osfigures,scale=1]{opensans} % change main font here So ...
0
votes
1answer
43 views

\newenvironment without using environ package [closed]

I want to create a new environment without using the environ package, which conflicts with other packages that I have. I can create the command like this when using environ package. \NewEnviron{...
2
votes
1answer
22 views

How can I have an additional "source'' caption in a table redefined with `renewenvironment`?

I had tables working well with a regular caption above and source information below each of them: After implementing a solution given in https://tex.stackexchange.com/a/485538/91816, the captions ...
1
vote
1answer
32 views

How can I fix the position of tables formatted with `renewenvironment{table}`?

I've used renewenvironment{table} to make all my table rules green. I also want to fix the position of some of them, using the option H of float package, for instance. I've tried a solution like the ...
1
vote
2answers
56 views

Creating an environment

I'm trying to create an environment. The code below performs something similar to what I want. My difficulty is in adjusting the content that will stay within the environment. I would like to reduce ...
1
vote
1answer
57 views

Using restatable with a custom environment

I want to use the restatable package with a custom environment. It almost works except when I restate with \name* it does not use the original label. Before you ask, I'm not using newtheorem because ...
0
votes
0answers
76 views

Python code environment with input and output

I am trying to set up a simple environment for displaying Python code and output. I want the output to be bold font. I have written the following \newenvironment{code}[2]{ \begin{shaded} \...
0
votes
0answers
20 views

How does RenewEnviron based on old environment work?

I would like to use the second part of answer https://tex.stackexchange.com/a/225075/36836 but to use it for every figure instead of defining the new sourcefigure environment. Unfortunately, I do not ...
0
votes
1answer
24 views

Define an environment that by default load some options

Is there a way to define a new listings environment with some listings options by default? For example, I am hoping to define a new environment, say myenv, such that \begin{myenv} \end{myenv} and \...
0
votes
0answers
22 views

How to patch each environment only within another environment?

I know how to patch environments using xpatch. But is there a way to patch environments only within a certain environment? For example, all tabulars only within sidewaystable?
1
vote
1answer
33 views

How to automatically label using theorem counter?

Someone please help me! I have some custom environments and I want to label them according to theorem counter. Means, that I get a numbering like Def. 1.1, Thm. 1.2 and so on. Right now, I have to ...
0
votes
0answers
18 views

Strike through an environment

For a revision of an article I have the following macro: \newcommand{\revision}[2]{\textcolor{red}{\st{#1}}\textcolor{blue}{#2}} that can be changed to \newcommand{\revision}[2]{\textcolor{blue}{#2}...
2
votes
1answer
28 views

Problem with tabulary when used inside user macro

I have having problems with tabulary inside a user macro. The purpose of the macro is to decide whether to use a longtable or tabulary, depending on the number of rows. Below is a MWE (or a MNWE, ...
4
votes
1answer
41 views

Tikz picture with tikzmark across page boundary won't print if inside environment

Combining this solution to draw braces with tikzmarks, with this to make them go across page boundaries, presents me with an interesting problem: It won't print the vertical part on the first page if ...
4
votes
2answers
69 views

How to resolve clashing definitions of \comment in comment.sty and changes.sty without affecting either's interface?

I'm writing a package that uses both changes (v3.1.2) and comment (v3.8), and I'd like to expose their functionality to consumers of my package without having to modify either one's interface. The ...
1
vote
1answer
30 views

New environment and resuming an enumerate

I use the enumitem package to resume the enumeration counter a lot via: \begin{enumerate}[resume] ... \end{enumerate} I wanted to speed it up slightly the typing, so I tried defining a new ...
0
votes
1answer
25 views

Trying to turn my tex file into regression table - (Note: I am a beginner)

I am saved some regression tables as a tex file. Then when I try to save it as a pdf, it ends up coming out damaged. Then when I try to typeset it, it says: "!LaTeX Error: Environment table undefined."...
0
votes
0answers
20 views

Vertical space after the environment lost when the environment splits between two pages

I defined a personalized theorem environment, such that, there should be a vertical left bar aligned with the environment and the length of the vertical bar should be exactly as long as the text ...
0
votes
1answer
20 views

Define a new caption in a new listing environment by overriding caption setup for lstlisting

This issue is mainly realated to Define a new caption in a listing environment. I want to define caption setup for default lstlisting but also want to define caption setups for new listing ...
1
vote
0answers
14 views

Passing arguments to longfbox in BeforeBeginEnvironment

I defined a \BeforeBeginEnvironment for lstlisting and added a default \begin{longfbox}[...] definition. What I want is to pass some custom arguments to \begin{longfbox}[...] defined in \...
3
votes
1answer
115 views

LaTeX: Why are digits allowed in environments, but forbidden in commands?

Finding out that I can have an environment named env2, but no command cmd2, I read Why are some characters not allowed in command sequences, but still I wonder: Why are digits allowed in environments,...
1
vote
1answer
28 views

Inclosing \section in \vbox failed with: “Something's wrong--perhaps a missing \item. }”

I wanna put some complex commands (e.g. \section and \chapter) inside a box (\vbox) so later I can compute the height of the block contains the text. Here is the full example: \documentclass[11pt]{...
2
votes
1answer
92 views

Example environment with a square box [closed]

I'm trying to add black square before every example in a text book. But when I use the following code, the result is as shown in the figure. \graphicspath{{Pictures/}} % Specifies the directory where ...
1
vote
1answer
24 views

Environment with optional section-based numbering

I would like an environment that optionally numbers based on the current section. I currently have: \newcounter{example}[section] \newenvironment{example}[1][]{\refstepcounter{example}\par\medskip ...
0
votes
0answers
15 views

Custom environment for syntax highlighted and indented code

I am writing some lecture notes involving blocks of code. I would like a custom environment always indents the block with consistent formatting. My current attempt of just wrapping a listing in a ...
2
votes
1answer
82 views

Create custom note boxes

I am trying to create custom info boxes (very similar as in awesomebox package). The and everything sims is fine except when the box is not surrounded with some text. Then I get an error There's no ...
1
vote
0answers
31 views

How to avoid rewriting lines to generate code blocks

I have the following lines : \scriptsize \begin{Shaded} \lstset{language=C++, keywordstyle=\color{blue}, stringstyle=\color{red}, commentstyle=\color{...
2
votes
1answer
25 views

Using varwidth within an environment definition with minted

I'm trying to create a new environment which holds a centered code snippet using minted. Firstly I came across to a minipage package, however it needs the width specification. I just want it to be ...
1
vote
1answer
40 views

svmono v5.6 doesn't like unnamed labeled examples

Put \documentclass{svmono}%%% v5.6 from http://www.springer.com/gp/authors-editors/book-authors-editors/resources-guidelines/rights-permissions-licensing/manuscript-preparation/5636 \begin{document} \...
3
votes
1answer
99 views

Detect \begin{…} … \end{…} mismatch, or ending what you did not begin

While testing some of my new environments I made a mistake like this: ... \begin{document} ... \begin{A} ... \end{A} ... \begin{B} ... \end{A} ... \end{document} LaTeX complained that B did not ...