Tag Info

Hot answers tagged

6

With the help of \NewEnviron from the environ package \documentclass{article} \usepackage{tikz} \usepackage{environ} \NewEnviron{smallenvironment}{% \tikzstyle{mybox} = [draw=red, rectangle,inner sep=5pt, inner ysep=5pt]% \begin{center}% \begin{tikzpicture}% \node [mybox] (box){% ...


6

First of all, the definition of rubrique, being a new environment, lacks the ending part... Then, it is defined with a tabular inside it, which is not allowed to break into pages. The solution may be to load the package longtable \usepackage{longtable} and to substitute tabular with longtable in the definition of rubrique: ...


5

Grab the contents of the conditional environment using environ: \documentclass{article} \usepackage{empheq,environ} \NewEnviron{pdfORht}[3][]{% \ifdefined\HCode %htlatex \begin{#3} \BODY \end{#3} \else% pdflatex \begin{#2}[#1]{#3} \BODY \end{#2} \fi% } \begin{document} \begin{pdfORht}[box=\fbox]{empheq}{align*} ...


4

For fancyvrb, you need to use \VerbatimEnvironment before the \begin{Verbatim}. That tells fancyvrb to detect the name of the current environment, and look for the end of that environment, rather than looking for a literal \end{Verbatim}. You will probably want to use a proper framing package to provide the background color...that way you won't have to ...


4

Place the proof inside the figure environment, or else the "fact" may end up in a different location than the figure. EDITED to allow for multi-figures and page breaks in proofs (by using the \captionof{figure}{} approach). \documentclass{article} \usepackage{caption} \usepackage{xcolor} \usepackage{framed} \usepackage{lipsum} ...


4

I'd suggest you to use a \list (as many of the standard LaTeX2e environments do): \documentclass{article} \usepackage{lipsum}% just to generate text for the example \newenvironment{myenv} {\list{}{\leftmargin=0pt}\item\relax}{\endlist} \begin{document} \lipsum[4] \begin{myenv} \lipsum[4] \end{myenv} \begin{myenv} \lipsum[4] \end{myenv} \lipsum[4] ...


4

\addvspace only inserts vertical space up to some maximum: \documentclass{article} \usepackage{lipsum} \newenvironment{myenv} {\par\addvspace{\baselineskip}}% \begin{myenv} {\par\addvspace{\baselineskip}}% \end{myenv} \begin{document} \lipsum[4] \begin{myenv} \lipsum[4] \end{myenv} \begin{myenv} \lipsum[4] \end{myenv} \lipsum[4] \end{document} ...


4

You have some options. Since you are using listings as floats, you may use float=h as the option \begin{codice_c++}[float=h,,caption={c1}] Also since you are using placeins, you can use \usepackage[section]{placeins} thereby restricting the placement of (all) floats within the section. Code: \documentclass[a4paper,11pt]{article} ...


3

You have to set \@currentlabelname if you wish nameref to extract the appropriate content. Since you specify the question title using \questtitle, you could incorporate this addition using: \makeatletter \newcommand{\questtitle}[1]{% \renewcommand{\givenquesttitle}{#1}% \protected@edef\@currentlabelname{Quest~\givenquestid: #1}} \makeatother


3

\\ is used by the tabbing environment to break lines. Since you've issued it inside the environment foo, the environment is not ended before the linebreak and tabbing gets confused. That's the reason of the error forgotten \endgroup. If you let foo end before the linebreak, you don't get the error, as in following MWE: ...


3

\refstepcounter should be used before \label. \refstepcounter defines \@currentlabel that is used by \label. \documentclass{book} \usepackage{lipsum} \usepackage{mathpazo} \newcounter{exam}[chapter] \setcounter{exam}{0} \renewcommand{\theexam}{\thechapter.\arabic{exam}} % % Method 1 % ...


3

Karl has already shown you about forming a newenvironment using environ. I will point out some improvements to your tikzpicture code. Use tikzset instead of tikzstyle. No need of specifying ysep when you have already inner sep. No need of using minipage inside the node. You can specify text width= 0.85\textwidth, minimum width = 0.85\textwidth in node ...


2

(Note: there are parts of this solution that are sub-optimal, and I'm aware of that, but I'll have to fix that later. I'll remove this note when I find the time to improve things.) You can change the files theorems-ams.module and theorems-ams.inc, or better create copies as described in my answer to How to make "claim" environments look like ...


2

Try the environ package. \documentclass{article} \usepackage{environ} \NewEnviron{test} {\textsc{\MakeLowercase{\BODY}}} \begin{document} \begin{test} THIS IS A TEST \end{test} \end{document} Everything between \begin{test} and \end{test} is scooped up and stored in the macro \BODY.


2

To change the representation for the first level of an enumerate environment, you can redefine \theenumi; the default definition on your example is \renewcommand\theenumi{{\rm (\roman{enumi})} so the label numbering will use lower-case Roman numerals; to get Arabic numbering you need to change it to \renewcommand\theenumi{{\rmfamily(\arabic{enumi})}} ...


1

I deleted an extra {, but that wasn't the major problem. You haven't defined the second definition (\myUseCaseCTR) if you check it closely, the name is different from (\SharedCTR). I have used the \let command to define it, see line number 7. I enclose a working example and a preview. \documentclass{report} \pagestyle{empty} \begin{document} %{ % Deleted ...


1

We can find some workarounds. Solution A: We could generate a temporary file during the TeX run, close it a load it back to TeX per every command call, please see mal-dot2tex-file.tex. We can run all LaTeX engines. Solution B: We could use LuaTeX to generate that part of the TeX code for us and run it on-the-fly, please see mal-dot2tex.tex. We can run ...


1

Here is a MWE based on etoolbox: \documentclass{article} \usepackage{etoolbox} %\edef\printsolution{} % Uncomment to print solutions. \newcommand{\nosolution}[1]{% \ifdefmacro{\printsolution}{}{#1}% } \newcommand{\solution}[1]{% \ifdefmacro{\printsolution}{#1}{}% }{} \begin{document} \nosolution{ No solution. } \solution{ Solution. } ...


1

The exsheets package has ready made solutions for this. The following example \documentclass{article} \usepackage[demo]{graphicx} \usepackage{exsheets} % custom headings: \DeclareInstance{exsheets-heading}{myheading}{default}{ runin = true , title-post-code = \space , attach = { main[l,vc]points[l,vc](\linewidth+\marginparsep,0pt) ...


1

First, here is a solution that uses only the xcolor package and the standard verbatim environment. But it is not a new environment, per se, and so does not directly answer the OP's question (for that, see below). \documentclass{article} \usepackage{xcolor} \fboxrule=1pt \begin{document} \setbox0=\hbox{\begin{minipage}{3in} \color{red!90} \begin{verbatim} ...



Only top voted, non community-wiki answers of a minimum length are eligible