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.

0
votes
1answer
34 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
41 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 ...
0
votes
0answers
64 views

How to create my own table/figure environment with alignment of the caption on the left [without package]

I want to create my own environment for tables and figures in such a way that the caption is aligned to the left and the formatting caption uses a dot instead of a colon, e.g, Table x. My caption ...
3
votes
2answers
40 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
34 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
76 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
22 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
26 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 ...
7
votes
1answer
75 views

Copy the content of an environment

I would like to copy the content of an environment so that I can use it somewhere else. My main purpose is to print it inside a tooltip note. My idea was to use the environ package: \NewEnviron{foo} ...
4
votes
2answers
76 views

Environment for chemical reaction with reference

I need a chemical reaction environment, numbered and able to be referenced/labeled. It must also that is consistent with equation in its looks. I have read many questions and my code is an adaptation ...
2
votes
2answers
36 views

How to configure the environment for AMS-tex?

I installed the Miktex, Winedt, and Texmaker in my PC. And I saw that there is amstex in MikTex package manager. Unfortunately, I still can not successfully compile the files written in ams-tex, such ...
0
votes
0answers
23 views

mapsto and function definition / definition environment

Ok, these are 2 questions in one, but they are different. I am trying to define a function f mapping from X to Y. So what i am doing is: open the equation environment and writing: $f:X{\rightarrow}Y$....
0
votes
0answers
21 views

Using optional argument in closing statement of new environment

The answer 969/29410 showed that it is possible to use optional arguments in environment definitions: \documentclass{article} \newenvironment{hello}[1][world]{\noindent Hello #1, }{Bye now!\\} \begin{...
1
vote
1answer
32 views

Creating a custom definition environment, with an optional argument and non default punctuation

This seems like it should be the most basic question, but I can't find a comprehensible answer on the site, I'm afraid. I'm trying to define a definition environment that 1) replaces the ...
3
votes
2answers
47 views

“environ” package and nested environments won't work [duplicate]

I'm trying to make a little style package to make some nice blocks with icons and so on. I'm using environ package + tikz. Actually the document compiles and shows me my boxes but with errors saying ...
1
vote
2answers
41 views

Exclude numerals from a custom counter environment

I have my document set up so that examples are numbered but I would prefer to be able to add my own number or title. I know I can add the title in square brackets, but how do I remove the numbers? ...
4
votes
2answers
120 views

why this \newcommand doesn't work in \align environment?

I'm trying to use the 'newcommand' in the environment 'align', for that I created the 'newcommand' \rbel that is an 'arrow' with a 'n' below It. I put all the packages that I'm using. \...
1
vote
1answer
44 views

tabularx repeat headers at the start of each new page

I am trying to write a latex template for math dissertations for my university and I have gotten most of the formating built into the appropriate class file. However, one issue that I'm not sure how ...
0
votes
1answer
37 views

Mathcal fonts in Times New Roman environment

I am typing a document where the preset font style is Times New Roman. As a result the \mathcal fonts looks as \mathscr fonts. Is it possible to define somehow the usual mathcal fonts (even for a ...
2
votes
3answers
115 views

Environment with argument and optional argument

I want to create an environment that receives an argument and an optional argument in such a way that the first argument will be a title and the optional argument will decide whether the title should ...
2
votes
1answer
89 views

Code between \begin{environment} and \end{environment} stored in an array

Is there a way to store the text between the \begin and \end commands of a generic environment in an array? A code that obviously doesn't work but shows what I mean is the following \documentclass{...
0
votes
2answers
44 views

Append command to existing environment without redefining it altogether

I'm investigating how to customize environments provided by other packages without having to redefine the env completely in my document preamble. Specifically, the verse package define its ...
2
votes
2answers
53 views

Typeset commands inside an environment like if they were -out- of the environment

I'm trying to use a custom command \dialog[]{}{} inside an environment verse and executing it "as if" the command was outside of the environment. In short, I'd like to make the command to not be ...
1
vote
0answers
36 views

How to write nested enumerates nicely

I'm writing solutions to some problems in LaTeX. My finished answers look a little like: 1. (a) (i) Something (ii) Something else (b) More things 2. (a) Stuff Writing this out, even with ...
1
vote
0answers
30 views

it is better to create a command that passes as argument paragraphs or better to create an environment?

My purpose is to create a command that admits two arguments, namely, a title and content (paragraphs), for example, \newcommand{\mytxt}[2]{\clearpage% \MakeUpercase{\bfseries #1}\newline\newline #2 \...
1
vote
1answer
39 views

Custom environment with variable indentation and auto-line breaking?

Say, I want the first line to have no indentation, but then subsequent lines to have a set amount of indentation. And I don't want to have to type "\" at the end of each line to break it. I'd also ...
0
votes
1answer
60 views

How to create a numbered and dependent case/subcase environment

can we make a numbered and dependent case/subcase environment. This is much different from what usually a case does in Latex. I do not want to use it to break the domain of definition while writing a ...
4
votes
3answers
87 views

How to redefine characters as alignment tabs in a table

I have a pretty good understanding of LaTex, but I've spent a while now digging up information on catcodes, but because they're lesser known, I haven't seen any applicable examples that will help with ...
0
votes
0answers
35 views

Forcing markdown in a comment environment creates a runaway argument

I would like to create documents that include markdown within environments that can be hidden. Currently, I am using pandoc with a custom template and following the instructions for hiding ...
4
votes
1answer
69 views

Workaround for tabularx inside environment when using csquotes

I need an environment that presents data in a table. The number of right-most columns shall be adjusted at compile-time, and the first column is dynamic width. For this reason I am using \usepackage{...
2
votes
2answers
36 views

Nested newenvironment definitions, within a table

I'm trying to define two environments, one to be used inside the other. The first is a section in a CV, the second a subsection (cvitem). The latter holds an unordered list (commented for now, to ...
1
vote
2answers
51 views

How can we Define our own Simple Environment for Source Code?

Inside of our document we wish to define a new environment for blocks of source code \newenvironment{srcblock}% % Define the environment Later, we will use the environment: \begin{srcblock} % use ...
0
votes
1answer
49 views

Self-defined table template

When I write the template below, where: the first parameter has been designed for optional headers: the second has been designed to pass to tabularx. I get the following error: Forbidden control ...
2
votes
1answer
58 views

Define a new environment based on “proof”

I want to change the word "Proof" as in \begin{proof}...\end{proof} to "Solution". I found out that \begin{proof}[Solution]...\end{proof} could do the trick. But is there a way to define a new ...
7
votes
1answer
68 views

Effect of `\label` on caption position in new environment

I use a new environment and have tried to refer to it using the \label-\refcommands. I'm running into the problem that the \label command affects the vertical position of the caption. The MWE is: \...
1
vote
0answers
56 views

mintinline inside environ

\mintinline inside of an environment created by \NewEnviron of environ package seems to be strange. There are some unintended blank spaces, after the macros followed by \. What should I do to fix it? ...
1
vote
1answer
82 views

Formatting of new environment based on minipage and sidecaption

In my memoir-based document, I need to occasionally insert some content (text quote or pseudocode) and I want to be able to add a caption. Because the content must appear exactly where I want it, I ...
8
votes
2answers
377 views

Environment decorators

I'm looking for a way to write a "decorator" (in Python terminology) or a "wrapper" for LaTeX environments: a way to give addition behaviour with save of the notation. For example, before every \begin{...
2
votes
1answer
32 views

Setting up new font in environment

I'm defining a new environment to display some text in devanagari, but the text does not appear to be centered, despite defining \centering in the environment: \documentclass{article} \usepackage{...
7
votes
2answers
256 views

LaTeX 2e environment that “knows” the name of surrounding environment

I'd like to have a LaTeX 2e-environment which when occurring inside another environment "knows" the name of the surrounding environment. Is this possible? I know that \@currenvir provides the ...
0
votes
1answer
54 views

Environment definition adds vertical space above

I already have found the solution to define a new environment without the additional space above the paragraph. But why does the "vanilla" way of defining this not work? Pictures MWE \documentclass[...
2
votes
2answers
82 views

Create a new environment with the same numbering as \newtheorem

The setup \theoremstyle{definition} \newtheorem{definition}{Definition}[section] \theoremstyle{plain} \newtheorem{theorem}[definition]{Theorem} \newcounter{nremarkctr} \newcommand*{\nremarkname}{...
2
votes
1answer
111 views

Newly defined environment swallows the text it contains

I want to define an environment to format test directions. So I do this: \documentclass{minimal} \usepackage{lipsum} \newenvironment{directions} { \noindent \fbox{ \begin{minipage}[t]{...
0
votes
1answer
60 views

mcexam a custom type question

I'm trying to create an exam using the code provided by him. Here is the code: \documentclass[twoside]{article} \usepackage[english]{babel} % set fonts \usepackage[utf8]{inputenc} \usepackage[T1]{...
6
votes
2answers
227 views

Unwanted line break after beginning of solution environment in exam class

Question update: Ulrich's answer (and its iterations) largely achieves the desired behavior: An answer environment (ans is the answer environment in the new MWE provided below) where the end is ...
1
vote
1answer
35 views

LaTeX Error: \begin{zentriert} on input line 54 ended by \end{document}

i'm very new to latex and i'm trying to define a new environment that uses a existing environment and does some extra stuff at the beginning and the end. The environment i'm talking about is the "...
1
vote
1answer
23 views

How do I set multiple text styles in an envirnoment defined in a layout file?

I'm trying to make the font monospace, bold, and small at the same time in an environment defined in my layout file. This seems like a ridiculously simple thing to do, but I've been struggling with ...
0
votes
1answer
20 views

Command needed for proper textstyle

I would like to know if there is a predefined latex command/environment/package that I can use to write something in style "Availability" or "Lecutures" shown in the picture below:
2
votes
1answer
33 views

Automatic arrangement of the same type of theorem environments

Consider the following: \documentclass{article} \newtheorem{exe}{Exercise} \newtheorem{sol}{Solution} \begin{document} \begin{exe} \dots \end{exe} \begin{sol} here the ...