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.

Filter by
Sorted by
Tagged with
2
votes
1answer
22 views

Interspersing a text with numbered propositions

I wanted to intersperse a text with numbered propositions, so I defined a list that would not reset its counter. \documentclass{article} \usepackage{enumitem} \newlist{propositions}{...
0
votes
1answer
28 views

Indentation within a minipage, and \noindent doesn't help

I am getting an unwanted indentation within a minipage (marked with arrow in the image). How can I get rid of it? The \noindent doesn't help here. MWE: %XeLaTeX \documentclass[11pt]{scrbook} \...
0
votes
0answers
30 views

How to create LaTeX templates on VS Code to avoid repeating the same codes every time?

Every time I start editing, I write these words at first: \documentclass[a4paper]{article} \usepackage{amsfonts} \usepackage{amsmath} \usepackage{microtype} \begin{document} \title{\large{\textbf{xxx}}...
1
vote
2answers
39 views

newenvironment for a five-liner

I am interested in a newenvironment for a five-liner (or n-liner). My code is \documentclass[letterpaper,12pt]{article} \usepackage{fancyhdr} \usepackage{footnpag} \usepackage{fontspec} \usepackage{...
1
vote
0answers
18 views

Can environments be redefined in beamer to accept slide numbers?

I'd like the environmnets align and align* in my beamer document to accept slide numbers. For instance, I'd like to be able to do something like this: \documentclass{beamer} \begin{document} \begin{...
-1
votes
0answers
40 views

Argument of \@tempa has an extra }. \maketitle [closed]

I have a latex source file of a thesis. After updating Miktex, the file is not working and it gives an error that Argument of @tempa has an extra }. \maketitle. How to solve this issue.
9
votes
2answers
228 views

Save the body of an environment to a macro, without typesetting

I am trying to save the contents (i.e., the body) of an environment into a macro for later use (in order to typeset it later in the document). I thought of using the environ package (see the minimal ...
2
votes
1answer
29 views

Problem with Beamer, environments, and \if

The following code will not compile and I am mystified: \documentclass{beamer} \usetheme{default} \newif\ifTest \Testtrue \begin{document} \begin{frame} \frametitle{title} \ifTest \begin{center} ...
2
votes
1answer
55 views

How to process the body of an environment and divide it by a \macro?

I am trying to automate the following layout to place images and tables using the minipage environment. The width of the minipage environment is calculated automatically, and the design is almost ...
2
votes
1answer
30 views

Problem with custom environment inside a list

I am trying to use a custom theorem-like environment inside a list (using the enumitem package), but I get the error message ``LaTeX Error: Something's wrong--perhaps a missing \item.'' Outside the ...
1
vote
2answers
66 views

How to center verbatim in environment

I have the following environment: \documentclass{book} \usepackage{fancyvrb} \newenvironment{codesample} { \scriptsize \begin{center} \BVerbatim } { \endBVerbatim \end{center} } \begin{document} \...
4
votes
3answers
239 views

How do we create an exercise environment like this:

How can we to create an exercise environment like this: I tried: \begin{tcolorbox} \textbf{Câu 3} Cho $x,y,z$ thỏa mãn $x^2+y^2+z^2=1.$ Chứng minh rằng $$\dfrac{x^2}{1+2yz}+\dfrac{y^2}{1+2zx}+\dfrac{...
4
votes
1answer
53 views

Asymptote environment wrapped in another environment doesn't work

I am trying to create an environment that essentially centers and creates an asymptote diagram, given the diagram's code. Here is a minimal working example: \documentclass{article} \usepackage{...
0
votes
2answers
37 views

Highlight environment by setting a violet background color that works on xelatex

Please, what I need is an example environment that has a violet [rgb(238, 130, 238) for example] background, the font color black and this has to work on xelatex (I need this compiler because I'm ...
2
votes
0answers
26 views

Only first page of abstract is numbered [closed]

I have a two page abstract, but only the first page is getting numbered, which doesn't satisfy my department's guidelines. I've been trying to fix this for a couple days and going back and forth my ...
3
votes
1answer
46 views

double itemize in newcommand or newenvironment

I am trying to simplify a sort of diary I am keeping by using newcommand. Here is a sample of what my diary looks like: \documentclass{article} % General document formatting \usepackage[margin=0.7in]{...
1
vote
1answer
20 views

Incomplete \ifx: How to use ensuremath in split environment?

I have defined this command \newcommand{\edge}[1]{\ifx&#1&\ensuremath{e}\else\ensuremath{e_{#1}}\fi} I now want to use it inside a formula: \begin{equation} \begin{split} \edge{1} \end{split} ...
4
votes
1answer
157 views

How to know group level in LaTeX?

Sometimes I have cases when \everypar calls in other group level than before. For example, \everypar calls inside document, but the second time it calls inside \xalignat environment. Is there an ...
0
votes
1answer
25 views

Formatting minted code box in tcblisting

I am creating a code/strategy reference document for my student organization to be built on by groups of students into the future, and trying to make it simple and readable for those who will be ...
7
votes
5answers
334 views

Replace a string inside an environment

\documentclass {article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \newcommand{\testone}{Test one.} \newenvironment{test}{} \begin{document} \begin{test} t1 \end{test} \end{document}...
1
vote
1answer
30 views

How to display the correct choice in red color in exam class?

\documentclass{exam} \printanswers \begin{document} \begin{questions} \question Sample Question 1 \begin{choices} \choice Option1 \choice Option2 \choice Option3 \...
1
vote
0answers
25 views

How to have ntheorem with option thmarks and <alert@> beamer command working together?

I am puzzled by the interaction between the package \usepackage[thmarks]{ntheorem} and the command <alert> from beamer class. Indeed, in a recent question it has been shown that the interaction ...
0
votes
1answer
57 views

How to produce answer key in exam class for multiple choice type of question?

\documentclass{exam} \begin{document} \begin{questions} \question Sample Question 1 \begin{choices} \choice Option1 \choice Option2 \choice ...
1
vote
2answers
44 views

I would like to automatically produce repetitive elements that I can fill in that stays together

I would like to automatically produce a "use the following" followed by a \fbox with a \parboxthat I can fill in with text, graphs, etc. I usually do this manually but would like to ...
3
votes
1answer
68 views

Defining a new environment that contains tabularx inside another environment (e.g., center)

I'm trying to define a new environment that encloses a tabularx environment within some other environment to provide some formatting (such as center to centre the whole thing). The following was my ...
0
votes
1answer
49 views

Changing the color within a command to an environment

I hope this is not a stupid question but I feel like I've tried everything, even stupid ideas at this point. I am using a CV template which defines an environment for entry lists and then uses a ...
2
votes
0answers
26 views

Numbering chemmacros schemes within sections [closed]

Hello dear community, excuse me if this is a very basic question. But I googled to no avail. I also checked the manual of chemmacros, which gives no information. I am using "scheme" ...
2
votes
0answers
30 views

Environment with its own line numbers

I would like to create an environment with its own line numbers, that is to say: (1) the lines within this environment are not counted by lineno (2) it has a continuous line numbering itself, with ...
0
votes
1answer
33 views

Enumerate with left justify after breakline

I would like to change 1 thing in enumerate (or create new enviroment like enumerate) As in picture i would like to make "unless other switch is used" to be aligned to left (just like &...
5
votes
3answers
111 views

Create a simple “scheme” environment and a “List of Schemes”

I have the majority of my thesis written and typeset. Currently, I have a List of Figures and a List of Tables. However, now my committee tells me that I must also have a List of Schemes. In chemistry,...
1
vote
1answer
34 views

Creating custom abstract environment

I would appreciate any help in creating a custom abstract environment in kaobook document class (it is based on koma-script). Here is what I have done so far \newenvironment{secabstract}[1]{% \hrule \...
0
votes
1answer
36 views

Is there a change to get SyncTeX work with text within environments?

I know that SyncTeX does not work correctly in Beamer (see Inverse PDF Search in beamer). But there seems to be also a problem with inverse search in environments defined with \NewEnviron. I want to ...
1
vote
2answers
37 views

Defining environments that do not start a new group

In the following MWE \documentclass{article} \usepackage{amsmath, environ} \NewEnviron{hidden}{} \def\hide#1{} \begin{document} \begin{align*} X &= Y \\ % \begin{hidden} % DOES NOT WORK ...
1
vote
1answer
24 views

Custom environment with full line width, even when put in e.g. enumerate

I am writing a latex setup for exercise sheets. I have defined a "solution" environment, that is only rendered if a boolean is set to true. Sometimes, but not always, I will use a customised ...
2
votes
1answer
35 views

Randomly Shuffle Enumerated list using enumerate package

I am building a template for writing exams, and I'd like to randomly shuffle my enumerated lists at compile time. The answers to this question worked for that purpose, however I am using other ...
1
vote
1answer
37 views

How to use a fact as an equation in latex

I have a fact that I want to use it in my latex as equation file it does not look too good. I was wondering if there is any other way to make it and look it better This allows us to use the well known ...
0
votes
1answer
33 views

2 minipages side by side in environment

When using 2 minipages side by side this works (part 1 of MWE), but not inside an environmen (part 2 of MWE). There I get "underfull \hbox (badness 10000)". What is the reason? \...
2
votes
1answer
39 views

Enumeration within self defined environment

My self defined environment having a symbol at the beginning and at the end works fine for text without enumeration. When including enumerate the symbols are not there where desired. Is it possible to ...
2
votes
1answer
44 views

Comment environment not working with complex structures inside it

I am a math teacher and would love to use latex to prepare exercise to send to my students. I usually do something like this: \section{exercise} text text text \begin{equation} some ...
1
vote
1answer
36 views

VerbatimOut, newenvironment and removing characters

I'm coding a LaTeX interface for mscgen (another one) and I'm using fancyvrb::VerbatimOut inside a newenvironment to output a part of the tex file into an external file, process it, then import the ...
0
votes
1answer
52 views

How to use table environment when using multicols

I am using the command multicols as it is the best option for me. However, I have to introduce a table and I want to addd a caption. If I use the enviroment table it does not work, the table disappear....
3
votes
2answers
50 views

if-condition for next command

After I started building my own environments, I was wondering, if there is a if-condition, that checks what the next command is, and then gives the option to run something before the next command. A ...
0
votes
2answers
67 views

LaTex macro not properly executed in tabular environment

I want to use a macro to set the separators (&,\\) in a tabular environment. The macro should thereby act as a Boolean switch with three states. Unfortunately I keep getting a result like this: ...
1
vote
1answer
32 views

Custom environment with options for tikz

I wanted to create a custom environment and I am currently facing the following problem: I want to pass an Option to my environment which scales the tikzpicture but the first example does not work ...
1
vote
1answer
22 views

Pass parrameter of custom enviroment as parameter of theorem

I want to create basically a shortcut for \begin{sometheorem}[optional parameter] \leavevmode \vspace{-\baselineskip}\vspace{-\baselineskip}\vspace{3pt} %some space adjustments \begin{leftbar} ...
-1
votes
1answer
24 views

Renew Figure Environment Nature Documentclass

I want to renew the figure environment because I want the caption to be Supplementary Figure instead of Figure. I am using the nature documentclass and found the code snippet: \renewenvironment{figure}...
0
votes
1answer
84 views

not works tagging of tabular with one cell

I desided create a new question for this,because this question connected with previous question. I decided use properties,for tagging of several environments. But for \maketitle,in which use \tabular,...
0
votes
1answer
19 views

Define same environment with different amount of parameters

I want to define two versions of the environment \begin{mainbox} \end{mainbox}, depending if I provide zero or one parameter. I want to use them like this: \begin{mainbox} stuff \end{mainbox} \...
0
votes
1answer
25 views

Omit environment-content from being printed

I've created a very simple environment for myself to make reminders/comments visible inside the document: \newenvironment{todo}{~\\\color{red}}{~\\} However, now I want to create a pdf for someone to ...
1
vote
2answers
34 views

How to properly putting enumerate inside a defined environment?

I'm using an environment to work with a form-type of information, I'm trying to use enumerate for automatic numbering. Here's my current output : And here's my code, \begin{document} \begin{...

1
2 3 4 5
51