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.

1
vote
2answers
29 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
40 views

\newenvironment without using environ package [on hold]

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
20 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
30 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
53 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
49 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
35 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
22 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
18 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
28 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
14 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
40 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
48 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
25 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
23 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
18 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
13 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
108 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
23 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
81 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
75 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
28 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
38 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
91 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 ...
1
vote
1answer
48 views

How to redefine proof?

I want to define a new proof environment. I have defined it as below. \documentclass{article} \usepackage[section]{placeins} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{...
1
vote
1answer
26 views

How to create a new environment with \begin{frame}\begin{itemize}

In order to save some typing, I tried to create a new environment with some commands I use very often. But LaTeX does not like them, and keep me throwing errors at my head when I use them. Here is a ...
0
votes
1answer
69 views

How can I make these types of lines?

How can I make these types of lines?
1
vote
0answers
21 views

Problem defining a fancyvrb verbatim environment within tcolorbox

I want to define an environment for verbatim text using fancyvrb functionality, but within an entitled frame drawn using tcolorbox. Here is an example: \documentclass{article} \usepackage{fancyvrb} \...
0
votes
0answers
13 views

Theorem environment switch

In the accepted answer to this question, the poster mentions implementing a custom environment (rather overwriting the theorem environment) that allows them to switch between a theorem/proposition/...
1
vote
0answers
15 views

`\newgeometry` and `\pagestyle` inside custom environment

The case is simple: when I put \newgeometry{margin=0} or \pagestyle{empty} inside a custom environment, it doesn’t work (but it work outside). So, with the following MWE: \documentclass[a4paper,11pt,...
1
vote
1answer
46 views

Environment to get degressive text size like optic’s chat-like text

The goal is to get with the following MWE \documentclass{book} \begin{document} \begin{degressive} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus ...
0
votes
0answers
15 views

Disable environment contents by condition

I have implemented another question's accepted answer in an attempt to omit any contents of my custom environment if an optional argument is specified. However, even the most basic version does not ...
0
votes
1answer
23 views

Renewcommand within an environment doesn't persist

I'd like to be able to change the behavior of my environment commands by another command. They should be changed until the end of the environment. This is what I thought would happen if I made a ...
2
votes
1answer
35 views

Hiding an environment but keeping equation labels and their numbers inside

I want to hide some of the proofs of some lecture notes that are given to students. I defined a new proof environment hiddenproof because I want to only hide some of the proofs. I can then hide this ...
5
votes
4answers
719 views

How to robustly store bits of text for later use

I'm trying to write myself a package, similar to the exercise package, so I can prepare problem sets for my students. I wish to delay the output of problems and/or solutions until a suitable place in ...
4
votes
2answers
107 views

Is there a way to make cleveref distinguish two environments with the same counter?

I believe that usually you explicitly tell cleveref what to call your label using \crefname{type}{singular}{plural}, this doen't work however as here "type" has to be the name of the counter (I ...
0
votes
1answer
42 views

Using table inside solution environment of exam documentclass

I am trying to use the table environment inside the solution environment of the exam documentclass. Unfortunately this doesnt work as stated in this question since table is also a float. The ...
0
votes
1answer
44 views

Expansion of macro in environment argument

I'd like to generate an environment that changes a bit according to an argument given for it. The reason is having different locales in the document. I have defined a command, EmitLanguageStr that ...
3
votes
2answers
42 views

Create an environment to translate sentences

I'm trying to create a command to use when I need to translate the language or make examples to both languages. So far I have created a box around the text and two columns, one for each language. \...
0
votes
0answers
39 views

Creating two different modified versions of the same environment

In an earlier question, I defined a modified version of the quoting environment using \tcolorboxenvironment. But now I want a different, and hopefully better, modified version of the quoting ...
1
vote
2answers
109 views

Verbatim inside \block

I already searched for a solution but found none which works for me. My aim is to write some command inside a block environment. Even though I used \cprotect or \protect it still won't work. Normally ...
0
votes
1answer
29 views

How to arrange two bodies of text /sections side by side? (Custom Resume Building)

I've done a ton of digging but have been unable to find a solution to this problem. Specifically, I am creating a resume using the AltaCV class and multi column packages together. The goal is align ...
2
votes
0answers
22 views

Ways to define “Alternative” environment

Suppose we have two/three ways to prove a mathematical statement in a non-rigorous context. What would be the best option for you to say the following?: We will prove it [a math exercise, minority a ...
2
votes
2answers
28 views

Automatic sorting of environments by parameters (e.g. by date)

I desire for some sort of easy system for manipulating "sections" or environments based on additional data such as dates. I did a preliminary google search and couldn't come up with anything because I ...