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

3
votes
2answers
115 views

Create a “case”-environment

I'd like to create an environment for enumerating different cases. Something that would look like \itemize but instead of printing a "-" symbol at the begining of each item, prints (for the first ...
3
votes
1answer
29 views

How to make some visible effect on the output file of a document “invisible” or non-effective while fulfilling its “invisible” function?

Are there any commands/packages/environments that can make some code that has a visible effect in the output file as if it were not written but fulfilling its internal function? For example, ...
3
votes
4answers
89 views

How to print the value of the last \refstepcounter in the first page in the memoir class?

I made an environment named sol, that has a \refstepcounter command. I want to print on the first page of my document how many sol environments I have made in my document. ...
0
votes
1answer
28 views

Redefine a value during runtime inside another macro

I would like to redefine a value during runtime. More precisely, I'm creating my own environment and in the preamble I would like to change a value and set it back afterward. ...
5
votes
1answer
49 views

Syntax to setup environment using environ package with multiple arguments

I can't get the syntax right. I am trying to use this answer below to help me. how to use conditional to define different \begin and \end environment at compile time I am trying to setup an ...
6
votes
1answer
80 views

What's the smartest way to typeset a poem which includes prose?

I have a script to query a database containing poems and typeset them in LaTeX within a verse environment. Some poems contain section which are in prose. These prose lines are clearly tagged in the ...
2
votes
1answer
42 views

Suppress poem line numeration only in selected environments

I would like to drop the poem line numeration for only one poem, thus forcing it to behave differently from the general setting defined for the verse environment of my document. Please consider the ...
3
votes
1answer
54 views

Usage of minted inside newenvironment in minted 2.0a³

As a followup question to Lstinline macro inside another environment, I kind of want to do the same thing for minted as well, but I'm held back by the following: I used the code from Using minted to ...
3
votes
1answer
78 views

tikz and new environment

I would like to creat a new environment in order to draw the following matrix : \begin{tikzpicture}[baseline,every right delimiter/.style={xshift=-8pt},every left delimiter/.style={xshift=8pt}] ...
3
votes
1answer
43 views

Problem with an environment definition

I know it is an easy and quite specific request but I've been on it all day and I cannot really understand what's wrong! \documentclass[12pt,a4paper]{report} \usepackage[T1]{fontenc} ...
4
votes
2answers
84 views

Change to libertine font except in certain parts?

I am producing my LaTeX document using pdflatex. If I want to switch my entire document to a libertine font I use : \documentclass[11pt,a4paper]{book} \usepackage[utf8]{inputenc} ...
9
votes
1answer
79 views

Ignore spaces and \par's after an environment

In defining an environment, I could use \ignorespacesafterend to ignore all spaces after the environment. But how could I also ignore all \pars and empty lines after the environment? In other word, ...
2
votes
1answer
35 views

Indenting text and still allowing sections, pagebreaks and floats

I have a document where there are some sections with and some without subsections. When there are subsections, I want them (and all their content) to be indented. I have found several approaches to ...
1
vote
1answer
39 views

Retrieve a table with a Macro

I would like to retrieve a table with a Command which is using an new environment including a table. So basically something like: \begin{measurtab}{Test 2110} \value{0.0}{0.0} \end{measuretab} ...
2
votes
1answer
32 views

Usage of minted inside a new environment, inside IfFileExists

I want to conditionally load minted and define an environment, but after using IfFileExists I'm running into an error: FancyVerb Error: Extraneous input `resetoptions \setkeys ...
5
votes
0answers
35 views

How can I make a custom environment that wraps listings?

Thanks to this answer, I know it is possible to float and wrap text around a listing. I would like to setup an environment for mini-code snippets that always floats and wraps the same way. I can ...
5
votes
2answers
59 views

Newenvironment wrapper around widetable

I'm trying to create a custom environment figs based on widetable, using \newenvironment. \documentclass{article} \usepackage{widetable} ...
2
votes
1answer
33 views

Passing commands as environment-arguments

I'm trying to realize two versions of an environment numberedlist: if no argument is passed to it, it should begin the environment enumerate and pass default values as its argument, if one argument ...
0
votes
1answer
54 views

How to display the text in a new environment italic?

I created a new environment: \usepackage[dvipsnames]{xcolor} \usepackage{mdframed} \newenvironment{test} {\begin{mdframed}[backgroundcolor=gray, linewidth=1pt]} {\end{mdframed}} I'd like to ...
3
votes
1answer
110 views

Can I use a TeX primitive in a “before” and “after” macro? (and how?)

The Question Can I use a TeX primitive in a "before" and "after" macro? (and how?) There are two questions that I found useful and related to my question, which sent me in the right direction: how ...
6
votes
2answers
105 views

What to do with both “underfull \hbox” and “overfull \hbox” in the same line?

I've recently read through my \jobname.log files to spot errors in typography. I came across this: Overfull \hbox (6.8925pt too wide) in paragraph at lines 650--651 [][]\T1/cmtt/m/n/10 ...
1
vote
1answer
100 views

naming argument and optional-argument for \def, \newcommand and newenvironment

I know how to create a new command or an environment. I think it will much better if I can specify name of the arguments. For example in framebox command and array environment below, we know exactly ...
1
vote
1answer
45 views

Defining a newenviroment for definition, theorem, example and so on by using a name

My trying of defining a newenviroment for LaTeX is \usepackage{mdframed} \newenvironment{mf}{\begin{mdframed}}% {\end{mdframed}} I want to define a simple command with a name next to it, for ...
1
vote
1answer
46 views

How to align two entries of a list that appears in the center of the page?

Using the Beamer Presentation template I am creating slides, my aim is to make a list environment with the bullet points aligned in the center of the page. How can I do so? Thanks
4
votes
2answers
74 views

Emacs key binding open environment

On Emacs, I used to have "C-c C-e" as a shortcut to "open an environment with begin and end". I changed my computer and reinstalled emacs: Mac OS 10.9 and Emacs 24.3, and now in LaTeX mode, "C-c C-e" ...
1
vote
1answer
48 views

longtabu newenvironment caption error [duplicate]

I want to make an environment for my tables. See the following example: \documentclass[a4paper,10pt]{scrartcl} \usepackage{longtable} \usepackage{booktabs} % \toprule, \bottomrule ...
4
votes
4answers
165 views

Running numbers for comments

I wish to have comment 1, comment 2 as running numbers, and for each reviewer I want to restart the running number, is there a good way to achieve this? Following is how the pdf currently looks, and ...
3
votes
1answer
60 views

\BeforeBeginEnvironment not doing anything?

I'm attempting to do something similar to Two column glossary, making an extant glossary style wrap into multiple columns. I've followed the suggestion in the comment to the first answer, i.e. use ...
2
votes
1answer
63 views

Case numbering within proof [duplicate]

I am currently using this in the preamble: \theoremstyle{plain}% default \newtheorem{thm}{Theorem}[section] \newtheorem{lem}[thm]{Lemma} \newtheorem{prop}[thm]{Proposition} ...
3
votes
1answer
43 views

Command \env already defined

This is a follow-up to How to ignore everything in the document environment?. The code below is intended to extract the value of a token that occurs before \begin{document}. For some reason, there ...
3
votes
3answers
81 views

Horizontal space in a new environment after \label{}

Why is the horizontal space inserted in the following mwe? \documentclass{scrartcl} \usepackage[american]{babel} \usepackage{environ} \usepackage{amsthm} % proof environment \makeatletter ...
4
votes
1answer
37 views

How to generalize a solution with \NewEnviron to \RenewEnviron (error: \env@proof@save@env undefined)

This question is a follow-up from Solution environment via true/false switch where Ian helped me to define a solution environment which can be hidden. I tried it as well for a proof environment, but ...
10
votes
2answers
280 views

Defining a new command name in the correct way

I'd like to define a short command name \gm{a,b} that would mean in LaTeX \overset{a\to b}\longrightarrow I tried on my own. The below code only works for \gm{a} (or \gm{b} if changing a into b) ...
3
votes
1answer
42 views

Copy the abstract environment for acknowledgments

I would like to create an acknowledgments environment that's simply the duplicate of the abstract environment, with two exceptions: It should print Acknowledgments as its heading, not Abstract. The ...
5
votes
2answers
65 views

Line break in a modified proof environment (with show/hide feature)

In the recent post How to define a proof environment which can be displayed/hidden? [combining two TeX solutions], Werner helped me to redefine a proof environment which can be hidden by an optional ...
1
vote
0answers
43 views

How to define a proof environment which can be displayed/hidden? [combining two TeX solutions] [duplicate]

I once asked for a solution to suppress vertical space right after the beginning of a proof environment; see the link (1) below. I use this quite heavily, it works very well. I recently asked how to ...
14
votes
2answers
205 views

Dash in Environment Name

I'm trying to make a verbatim environment called "my-environ" \documentclass{article} \usepackage{fancyvrb} \DefineVerbatimEnvironment{myenviron}{Verbatim}{numbers=left,frame=lines,label=My ...
19
votes
2answers
317 views

I want to start learning how to use \newcommand \newenvironment and \def any suggestions where to start?

I have been using LaTeX for a long time now, and I find myself often going to this website to solve my problems. This often includes copy pasting codes which include \newcommand, \newenvironment and ...
7
votes
2answers
155 views

Solution environment via true/false switch

I would like to create a solution environment that prints a solution in the case where an optional argument is set to true (the default) and hides the solution in the case that the argument is false. ...
8
votes
1answer
52 views

Collecting environment content with support for xparse arguments

I'm trying to create an environment which uses xparse style arguments but I have to be able to use the whole environment content in the environment definition, e.g. as an argument. Ideally I'd like ...
2
votes
0answers
86 views

Gantt chart is not drawn and give “! LaTeX Error: Environment gantt undefined.” [closed]

I am writing a report for FYP in Ubuntu 13.10 in TexMaker, with document class and use different files use for chapters. I write the code below in the chapter1.tex for draw a gantt chart ...
4
votes
1answer
49 views

How can I use arabic numbering for theorems?

I used the newtheorem command to create exercises in a book in the following way. \newtheorem{xca}[theorem]{Problems} So in the body I use the following command to create a set of exercises, ...
6
votes
2answers
93 views

Seemingly trivial: verbatim, newenvironment, and colorbox

I am, once again, trying to achieve what seems like a trivial goal. I want to use \newenvironment to define a verbatim environment with a background color. I need to define my own environment because ...
6
votes
1answer
74 views

Cross-reference of custom environments created with environ and TikZ package

Problem: I want to create an environment named Example, and the environment has a counter (number within chapter). I want to refer to the counter for illustration just as the table, figure and ...
1
vote
1answer
51 views

How to make an environment such as “theorem” not have italics [duplicate]

I found this: How to change the font style in theorem environment? as well as this: Italic in theorem environment Neither however seem to make sense to me as I have been using the following: ...
5
votes
1answer
71 views

Spreading newenvironment over two pages

I am using a template found online to do my CV and I am getting a hard time trying to spred the content of a newenvironment over two pages. I want the content of one of my rubrique to be over the end ...
2
votes
1answer
49 views

Can't define environment whose macro code contains dot2tex environment

I try to define a new environment whose macro code contains the dot2tex environment from the dot2texi package (look at the appended MWE). Unfortunately the compilation ends with the following error ...
6
votes
2answers
158 views

How to rewrite this command using \newenvironment?

I once defined a customized latex command, which works well. And now I would like to convert it into a latex environment using \newenvironment command. However, I failed after trying several ways. ...
3
votes
1answer
47 views

Giving a custom environment a name

I have defined a custom environment: \documentclass[11pt]{article} \usepackage[table,hyperref]{xcolor} % Better control over color \usepackage[colorlinks=true, linkcolor=DarkBlue, ...
10
votes
3answers
707 views

Found it tiring to type so many \begin and \end

Is there some way to get rid of the \begin and \end's? For example, I need to type a small matrix, but I should type \begin{matrix}...\end{matrix}. I tried to define a macro ...