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

8
votes
2answers
597 views

Write a LaTeX macro to differentiate the text

I'm writing a report, and, for editorial purposes, I would like to use different fonts for each part of the report. I think I need to write a macro for it, but I don't know how to have this effect: \...
7
votes
1answer
780 views

How to use figure inside a exercise environment?

Trying to use figure inside an Exercise environment (exercise.sty) gives me "LaTeX Error: Not in outer par mode." Example: \documentclass{article} \usepackage[]{exercise} \begin{document} \begin{...
1
vote
1answer
134 views

Define preamble to a default

I have \begin{arab}[utf] ... some text \end{arab} throughout entire document. Is there any way to get rid of this reoccurring \begin \end command so to have my document look like this: \begin{...
0
votes
1answer
498 views

textpos error with newenvironment{aside} and xelatex

I'm using xelatex with texlive 2011 vanilla on the latest ubuntu precise pangolin. I fork and try to use the great cv template from https://github.com/afriggeri/cv This template uses TikZ for the ...
2
votes
1answer
426 views

Prevent caption to appear on separate page

I'm using a custom listing environment which does not float taken from Code spanning over two pages with minted, inside listing with caption. The caption is done with the caption package. The ...
10
votes
1answer
3k views

Q&A Template in LaTeX

I am preparing a Q&A document. I created the image below in MS Word. I was wondering if there is a way this can be accomplished in LaTeX. I want to keep formatting consistent through out the ...
4
votes
1answer
305 views

Text environment with vertical header and border

I have no experience with creating latex environments, so I hope that someone would be so kind helping me trying to create a new text environment with a border and a vertical header to the right of ...
4
votes
1answer
531 views

<F5> in vim-latex doesn't expand environment

I'm new to vim-latex and have been reading some tutorials. I've noticed that the behaviour of the F5 on my machine is rather different from what the tutorials tell me. I'm supposed to expect F5 to ...
3
votes
2answers
190 views

Sharing parameters between a command and an environment

(This question is related to Using \total of totcount package in section title) I'd like to keep track of the papers I review, and I have written a code (MWE shown below). The code keeps the count of ...
11
votes
3answers
584 views

Environment that obeys spaces

I need to build one environment that obeys spaces, but not new lines, and also change tabulation into four spaces. I can't use verbatim because I would also like to use macros in my environment.
3
votes
1answer
198 views

Define an align environment that always aligns to the first equal sign

I noticed that 98% of the times I use align or aligned I place the & just before the first = of each line. Is there a way to define a new environment that automatically aligns equations to the ...
4
votes
2answers
587 views

Problems When Escaping from Listings

I would like to use LaTeX to document my C++ code, since I am able to typeset mathematics easily, as well as create diagrams using TikZ. I made a minimal LaTeX template for testing, but I have already ...
0
votes
1answer
116 views

Is there a package with standard theorem environments and math functions

I would like a package that defines nice things by default like: Theorem environments like definition, property, example etc. Standard includes like subfloats, the amsmath family Reference functions ...
3
votes
2answers
239 views

How to use an environment defined by the versions-package inside another environment

When I use the versions package to conditionally exclude content like this: \documentclass{article} \usepackage{color}% just as example \usepackage[tracing]{versions} \excludeversion{vers}% opposite ...
7
votes
2answers
677 views

How to put environment text inside node?

Consider a simple environment in the documentclass as \newenvironment{abstract}{ \node (tbl) { }; } The content of \begin{abstract} Content \end{abstract} will goes ...
8
votes
3answers
519 views

Verbatim in environ’s \BODY

I’d like to print a TeX install guide for different OS, but the most text is the same for all OS. So I build the following \documentclass{article} \usepackage{environ} \newcommand{\mlw}[3]{} \...
3
votes
1answer
225 views

afterpage + list = missing \item

I'm trying to use the afterpage package to automatically insert text at the top of each page (please see my other question Section reminders at the top of each page?) but I'm having trouble. ...
20
votes
1answer
6k views

Avoiding “\Url Error ->\url used in a moving argument.” in a custom environment

I have a document I'm trying to render using two classes -- my university's dissertation .cls, and tufte-latex (my uni's styleguide is ugly, and I want to make a pretty-print version for my own ...
5
votes
3answers
859 views

How to extract parts of (La)TeX document?

I want to run queries against LaTeX documents like these: get list of all equations, even if one declares \def\be{\begin{equation}} and uses it; get list of all arguments of some command (e. g. \...
6
votes
3answers
920 views

New paragraph style for newbie

This question may have already been asked, but with all of my searching, I couldn’t find it. I am new to LaTeX and after a few rough starts, I am finding my way. I am using this tool to create ...
3
votes
1answer
607 views

Getting errors when using the grammar environment before \chapter{} and \begin{description}

I hope you can help me. I am using an empty grammar environment, included in the syntax package, within a file called appendix_c.tex, whose contents are as follows: \chapter{Modified version of the ...
9
votes
2answers
243 views

Not display the content of one environment when its content contains one special macro

I need to build one environment for proofs in my lessons. \begin{proof} ... \end{proof} This environment could have one content containing one macro named \lines like in the following example. \...
6
votes
1answer
590 views

Plain enumeration of theorems definitions etc

In my TeX document Theorems, Definitions, Lemmas are enumerated in the following way: Definition 1.1 Lemma 1.1 Theorem 1.1 Definition 1.2 Lemma 1.2 Theorem 1.2 But I would like to have ...
5
votes
0answers
496 views

Synctex and Environments [closed]

Synctex makes it possible to jump between your LaTeX code and the compiled PDF, which is absolutely great, if you have larger documents. However it is my impression that when you use environments, ...
1
vote
2answers
195 views

How to modify side margins in front pages (declared in subenvironment)?

I'm about to submit my thesis and I just noticed the first pages have different sidemargins to the rest of the text :(. They are supposed to be 2.5cm and they apper of ~ 1in. I tracked the problem ...
5
votes
1answer
583 views

Setup a newenviroment for figure with includegraphics and caption

Here is my MWE, I want to 'refactor' the code so that I do not need to write so much when I import source code into my document: \documentclass[12pt,a4paper]{article} \usepackage[demo]{graphicx} \...
9
votes
3answers
5k views

lrbox in \newenvironment

I cannot make lrbox work if put within a \newenvironment. I'll explain with an example. If I write: \documentclass{article} \newsavebox{\mybox} \begin{lrbox}{\mybox} \begin{minipage}[t]{\...
1
vote
0answers
380 views

lyx change environment level with keyboard [closed]

Much in the way that the tab key iterates over section levels: Part -> Chapter -> Section -> Subsection -> Subsubsection -> Paragraph -> Subparagraph I would like to do the same ...
9
votes
2answers
86 views

Can I redefine an environment to generate an error?

I know how to use \renewenvironment to redefine an environment, but instead of changing formatting, I'd like to have any use of the environment generate an error (log and abort). Is there a way to do ...
18
votes
3answers
3k views

Defining commands that are scoped to a particular environment

Is it possible to define commands in a separate namespace so that they only work within a particular environment? For example, can I create a package named foo that defines a foo environment and a \...
4
votes
2answers
2k views

Environment in \NewEnviron style, with key-value parameters

I want to define an environment that read its content before processing (like \newEnviron from the package environ) but also that allows key-value parameters (like \newkeyenvironment from the package ...
2
votes
3answers
2k views

Problems with environments in TeXStudio

This document \documentclass{article} \usepackage{amsthm} \newtheorem{lemma}{Lemma} \newcommand{\mycommand}{Here is the command} \begin{document} \begin{lemma} Here is the lemma \end{lemma} \...
10
votes
3answers
5k views

Defining an Environment that Takes an Argument

I want to define a new environment that will take a text argument, and use it as a title. \documentclass{article} \usepackage{amsthm} \newenvironment{titleproof} {\begin{proof} \textbf{Title of the ...
10
votes
2answers
1k views

\newtoks token seems to have local scope

I want to collect the first line of a quotation to use later. I have used \newtoks for a similar purpose so tried it here, this way: \documentclass[12pt] {article} \newtoks{\qfirstlineinternal} \...
6
votes
2answers
715 views

Framed answer environment

I am trying to write a simple environment for the solutions of assessments I give. The code below defines such an environment: \newenvironment{answerenv}[1][Answer]{% Sets the default "Answer" but ...
9
votes
3answers
5k views

Change the font of the block quote?

Sorry if this is a duplicate, but I can't find the right way of doing this. I want to redefine my quote and quotation commands to use a different font. My main font is Linux Libertine O (I am using ...
4
votes
1answer
1k views

Dynamically use RTF-Code in latex-document

I'm looking for a way to dynamically use Rich-Text-Format code in a latex document. The background is this: I want to paste formatted programming-source from visual studio into my latex code because ...
28
votes
2answers
5k views

Definitive guide to trivlists

I create a lot of theorem-like environments, and I'm usually happy to employ a package (such as ntheorem, amsthm, etc) to do the work for me. After studying the ntheorem documentation, and reading ...
2
votes
1answer
73 views

Auto including the section into an (pre-defined) environment

There is a coherency problem in the following text (its typesetting). The last paragraph must not be considered as a part of subsect02. For instance it is a kind of conclusion of two approaches ...
15
votes
2answers
4k views

How to create new table environment

I am working on a book that has many many such tables. Is there a way to create shortcut for the code shown below. I want to make table caption a variable, because in the MWE shown below except \...
7
votes
1answer
327 views

Environment for step by step modification of graphics

I would like to have one environment that produces the following two examples where the pictures are not animations. I would like that the environment takes care automatically of the numbers of ...
4
votes
3answers
5k views

Redefine \arraycolsep for particular environments

How do I change \arraycolsep for a single environment? E.g., I have \arraycolsep set so that the white spacing on either side of "=" in the equation array environment is not excessive. However, this ...
2
votes
1answer
340 views

Custom environment to accept \item

How can I create an environment that takes items in a way similar to lists? Example: \begin{myEnv} \item{AAA}{BBB} \item{CCC}{DDD} \end{myEnv} I'd like the above do something like \begin{tabular}...
3
votes
3answers
451 views

Making an environment that stores stuff in a box

Im trying to make make an environment that both: displays text and stores stuff in a box for later use. For this I need to use the input argument of the enviroment to manufacture a command name, i.e. \...
5
votes
1answer
288 views

Spacing between environments

I am trying to define a dialog environment while using the lettrine package. My problem are the spaces between the dialogs. There is no problem when a dialog consists of more than two lines. But ...
5
votes
1answer
349 views

Suppressing remarks when not needed

I have written some remarks in some of my works that are somewhat informal and repetitive in nature (mainly for my own clarification). I was wondering if there is a way of suppressing them when I don'...
9
votes
1answer
1k views

hide proof environment for restructuring

I am writing my thesis, and i am in restructuring phase - sorting theorems where they should belong thematically. And it would be helpful to have all the proofs hidden so i am not laden with the ...
3
votes
1answer
2k views

How to define environment in LaTeX which replaces its content?

I'd like to define an environment that would display a graphviz image. The code should look like this: \begin{graph}{name}[optionalArgs] a -> b; /* graphviz code*/ \end{graph} I've ...
10
votes
1answer
801 views

Use the s (star) argument with \NewDocumentEnvironment

Would it be possible to use the s argument specifier of xparse in \NewDocumentEnvironment so that we get an environment an a starred version of it? Actually it works, but the star goes to the wrong ...
9
votes
1answer
198 views

Is there a way to replace an environment with a command?

Under certain conditions (triggered by selection of a package option) I would like to change specific environments into margin notes. However marginnote is not itself an environment, but a command ...