Tagged Questions

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

6
votes
1answer
116 views

Macro, new command or new environment for code?

I am using the listings package to typeset code. I have defined a custom style using \lstdefinestyle{verbo} and then typeset code in a lstlisting environment as in the following MWE. ...
5
votes
2answers
242 views

(La)TeX equivalent of MS Word's “Don't add space between paragraphs of the same style”

I'm using a quote environment to add some references at the beginning of sections with two custom commands. If I have more than one reference, the \list nature of the environment automatically adds ...
0
votes
0answers
18 views

image into framewithtitle environment (memoir class)

I need to add image or figure into boxes for my phd document, so i try using the framewithtitle environment defined in page 276 of memoir class documentation. % !TEX encoding = UTF-8 Unicode % -*- ...
5
votes
1answer
49 views

Have something like figure but with its own counter and listof

Given the following MWE: \documentclass[english]{scrartcl} \usepackage{syntax} \begin{document} \begin{figure} \begin{grammar} <example> ::= \[[ \lit{def} <identifier> \lit{=} ...
5
votes
1answer
93 views

Redefine verbatim environment

I have a text with source code, which I would like to display. I am using pandoc, so I have to use either verbatim or listings enviroment. Unfortunately, I can't use listings package (due to ...
0
votes
1answer
54 views

Automatic parsing/extraction of single-argument commands from input (for use in new environment)?

I'm not sure whether this is in principle possible, so let me try to explain; consider this MWE: \documentclass{article} \usepackage[showframe]{geometry} \usepackage{tikz} \usetikzlibrary{calc} ...
1
vote
1answer
86 views

How to make my sty file work only inside a environment?

Say for example, i have a bibpattern.sty which consists of some latex commands (like \COMMENT). I want this bibpattern.sty to work only inside \begin{thebibliography} ... \end{bibliography}. The same ...
3
votes
2answers
50 views

How to align the new environment

I have to define the new environment, similar to the proof environment. I learned on our site how to define it, but I do not know how to customize it. In particular, I design a book by using gsm ...
4
votes
2answers
102 views

Setting vertical margins on top and below align* environment

I'm using the amsmath align* environment to format multi line formulas. Unfortunately, the environment adds a lot of margin before and below the formula. I found only one solution to get rid of this ...
5
votes
2answers
151 views

“itemize” or “enumerate” IN section headings

Is it possible to use lists WITHIN section headings, subsection headings, etc.? I wanted to do so like \documentclass[11pt]{scrartcl} \usepackage{enumerate} %... \begin{document} \section{My three ...
6
votes
2answers
42 views

Environ's body doesn't allow for making an \item

As part of a document process/workflow, it's easier to work with environments. However, in some cases the environment contents needs specific formatting. As such, it's convenient to use the environ ...
4
votes
1answer
41 views

Creating token blocks to hold environment contents and printing from them later

I have the following, works well for one toks block i.e \savedenvtoks but i want to create more toks blocks and i want the \savedenv to take a parameter indicating whichs toks block to add to, and i ...
1
vote
1answer
114 views

How to make an environment same as itembox environment in ascmac package by using mdframed package

I want to make the output same as what I can make from the code shown below. But for some reasons (e.g. some frames extend to multiple pages etc.), I do not want to use ascmac package but mdframed ...
12
votes
1answer
214 views

“Tape” environment in LaTeX

I have never defined an entirely new environment in a LaTeX document - I have only ever modified existing environments to suit my purposes. Now, however, I suddenly have a use for an obscure ...
9
votes
2answers
114 views

Collecting contents of environment and store them for later retrieval

I want to store contents of an environment and add them to a macro or command I could easily retrieve them, but I do not want to use the collect package. Are there any alternatives? ...
2
votes
2answers
61 views

How to write macros that behave like \item in an enviroment?

I am attempting to add an environment to a project that would take the following form: \begin{example} \source some text goes here to be used as an example. \target some more text goes here as a ...
1
vote
1answer
29 views

How to create an environment with its embedded commands?

I would like to create an environment with its commands which can be used like: \begin{myenv} \command1 text paragraph 1 \command2 text paragraph 2 \end{myenv} which translates to: ...
6
votes
1answer
92 views

How to place a figure in page margin beside a mdframe?

In my text I would like to use some icons in the page margin to label element types, e.g., an example or a theorem. The following picture illustrates this: My text is double-sided, so I would like ...
2
votes
1answer
37 views

How to define a custom environment caption for table of contents?

I want to define a custom environment example. This is not a problem at all, the only thing I humble upon is the caption (short title below the element) and its listing in the table of contents or ...
1
vote
1answer
73 views

Theorem style - define indentation

I have a real issue with defining my theorem style. I need indentation after the theorem, but cannot achive it. I google for hours and didn't find a solution. Hope you can help me. By the way, I'm ...
5
votes
0answers
55 views

How to track a page change within an environment?

I'm trying to define an environment that can automatically detect when the material within it moves to a new page, reprint one of its arguments at the top of the new page, and change how it closes as ...
0
votes
1answer
134 views

Change words in a Tikz picture every page

I'd like to create a template, as below. But I'd like to make it so that I can have multiple pages of the same layout and be able to easily replace "Header 1" and "Header 2" with different words each ...
4
votes
2answers
135 views

changing font style/size for proof, adding a square after example

Is is possible to change font size/(or style) for a proof? I was also thinking to add a small hollow square at the end of every example to separate the text a little. Something similar that works like ...
3
votes
1answer
42 views

New environment type without automatic numbering

I'm trying do define a new environment using tabu as a building block. The reason to use tabu is that it will break nicely across pages for long tables. I would like to have some help on doing the ...
0
votes
1answer
123 views

Renew appendix command to remove blank pages

I'm using Steve R. Gunn's Thesis Class. My issue is that Latex insists on inserting a blank page after the first of my 4 appendices, yet at no other point in the document. I believe this is caused by ...
2
votes
1answer
36 views

Passing arguments to mdwlist environments

I'm trying to make a description list more compact. I figured the easiest way to do this would be to use mdwlist's description* environment. This reduces the spacing between list items. I'd also ...
4
votes
1answer
57 views

mdframed package conflicting with \bgroup, \egroup

I'm using XeLaTeX because of language problem. The following code has no problem: \documentclass{article} %\usepackage{mdframed} \newenvironment{mynote}{\footnote\bgroup}{\egroup} \begin{document} ...
6
votes
2answers
93 views

Include only specific environments

I wish to typeset a document and only include occurrences of one specific environment for the output. One thing I tried was using the comment package and putting \begin{comment}just after ...
4
votes
2answers
66 views

Trouble defining new environment with embedded gather

I looked at the solution to How do I embed a gather environment within a custom environment? But things are still not working for me: MWE: \documentclass[border=6pt]{standalone} ...
3
votes
2answers
127 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
30 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
140 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
33 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
61 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 ...
7
votes
1answer
91 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
72 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
73 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
83 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
61 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
93 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
131 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
45 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
41 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
51 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
41 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
73 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
42 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
107 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
113 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
134 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 ...