Tag Info

Hot answers tagged

12

It's trivial to define, just \makeatletter \def\endenv{\expandafter\end\expandafter{\@currenvir}} \makeatother This will work for any normal environment that is closed by expanding \end. Special environments that parse ahead to find their end (verbatim, tabularx, align, ...) will not work with this command, But you should not use it. One of the main aims ...


12

Below I present two options, both of them admitting page breaks. A simple example using tcolorbox (admits page breaks); adjust the settings according to your needs: The code: \documentclass{article} \usepackage{lipsum} \usepackage[many]{tcolorbox} \definecolor{greentitle}{RGB}{61,170,61} \definecolor{greentitleback}{RGB}{216,233,213} \newtcolorbox[ ...


7

You are missing an awful lot of % at the ends of lines, and \parbox{1.75in}{\textsf{ \hspace{-5pt} } { }} Just always makes an empty parbox. I don't think the tikz code is helping here really it is just complicating things if you just want to draw three lines. \documentclass[final,oneside,11pt]{memoir} \usepackage{wrapfig} ...


6

Several things are going on that are not working for you. First, the new lengths that you're defining should be defined outside of the environment. Secondly, you cannot call \parbox{1.75in}{ in one part of the definition for your new environment and close it in the second part. It's best to use an lrbox for that purpose. Thirdly, wrapfigure needs to be ...


5

Here's the environment, actually three: \documentclass[twocolumn]{article} \usepackage{mathpazo} \usepackage{xcolor} \newsavebox{\strunkbox} \newenvironment{strunk} {\begin{lrbox}{\strunkbox} \begin{minipage}{.8\columnwidth}} {\end{minipage}\end{lrbox}\begin{center} \setlength{\fboxrule}{1pt} \leavevmode\color{red} ...


4

Rather than as an environment, I create \strunk{}{} for the task. It will not break across page breaks. I have limited \textwidth here, instead of using columns. The \strunk macro will occupy 85% of \textwidth, plus the red border. \documentclass{article} \usepackage{xcolor} \parskip 1ex \textwidth 3in \parindent 0in \fboxrule 3pt \newcommand\strunk[2]{% ...


3

Another alternative is the use of newcommand which is similar to newenvironment. For references: Link1 Link2 Code \documentclass[final,oneside,11pt]{memoir} \usepackage{tikz} \usepackage{calc} \usepackage{wrapfig} \usepackage{lipsum} % \usepackage{showframe} \newcommand*{\offset}[1] { \begin{wrapfigure}[19]{r}[1in]{2in} \noindent ...


3

Gonzalo's answer can be easily modified to do this. Just add \renewcommand\qedsymbol{$\blacksquare$} to the definition \documentclass{article} \usepackage{amsthm,amssymb} \newenvironment{solution} {\renewcommand\qedsymbol{$\blacksquare$}\begin{proof}[Solution]} {\end{proof}} \begin{document} \begin{proof} test. \end{proof} \begin{solution} test. ...


3

\newenvironment{graf}[1][]{}{} generates the error ! LaTeX Error: Command \graf already defined. Or name \end... illegal, see p.192 of the manual. You really don't want to ignore that error. Call your enviornment something else, otherwise you would be redefining \endgraf (which would be bad).


3

I changed the \renewenvironment line to \renewenvironment{solution}{\solutionnew}{\endsolutionnew} You also seemed to be missing the ending part of the environment definition in solutionnew which I just added as a {}. Perhaps a macro form would be more suitable. I also recommend making the \marginpar ragged. See original answer here and FOLLOW UP ...


3

The syntax you're using specifies that the argument to the myenv environment is optional, with empty default value. So with your definition, \begin{myenv} body \end{myenv} will execute \csuse{bla}, while \begin{myenv}[1] body \end{myenv} will execute \csuse{bla1}. If you want a mandatory argument in braces, which seems the case by looking at your ...


2

The \labelformat command offers a way to change the counter behavior but for that to work the counter needs to exist. As you define the counter later that definition reinstalls the default behavior as neither check if there is already something defined. So if you move the counter declaration before the \labelformat everything works out fine (well more or ...


2

Update Based on revised MWE. Unfortunately I don't know why this problem occurs. But, one way to proceed is to eliminate the warning of missing list items as per How to make itemize/enumerate/description environment robust to missing \item elements? Code: Suppress Missing Item Error \documentclass{article} \usepackage{environ} %% Allow for lists to ...


2

With the lineo package you can use the linenumbers environment to locally enable numbering: You can also use \nolinenumbers to disable numbering for the nested itemize if desired: Code: Use linenumbers environment \documentclass[10pt,a4paper]{article} \usepackage{lipsum} \usepackage{lineno} \begin{document} \lipsum[1] \begin{linenumbers} ...


2

It is to do with the way tabularx deals with its argument. The package environ provides a work around for such situations. Instead of \newenvironment you say \NewEnviron{myenv}{start code \BODY end code} Then \begin{myenv} mybody \end{myenv} will run the contents of myenv with \BODY replaced by mybody. In your case the relevant definition ...


2

Another solution for those (like me) who doesn't manage low level commands like egreg and Steven. It uses tcolorbox and its possibility of arranging two texts side by side. strunk is an environment instead of a command but I hope it doesn't matter. \documentclass[twocolumn]{article} \usepackage[most]{tcolorbox} \usepackage{mathpazo} ...


1

You also can do that very simply with ntheorem. Its advantage is an automatic placement of endmarks even if the environment ends in a display math environment: \documentclass[leqno]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{fourier} \usepackage{heuristica} \usepackage{amsmath} \usepackage[thmmarks, amsmath, thref]{ntheorem} ...


1

You should use proper tool for each job ;-) Here it is tcolorbox \documentclass[12pt,border=5]{standalone} \usepackage[most]{tcolorbox} \newtcolorbox{mybox}[1][]{ enhanced, colframe=gray!80, colback=gray!40, left=2em,right=1ex,top=1ex,bottom=1ex,%boxsep=1em, leftrule=4pt, rightrule=0pt, toprule=0pt, bottomrule=0pt, arc=0pt, %breakable, ...


1

With tcolorbox 3.30 (2014/11/17), there are new possiblities to answer this question using the raster library: \documentclass{article} \usepackage{lipsum} \usepackage{tcolorbox} \tcbuselibrary{skins,raster} \tcbuselibrary{breakable}% <- remove, if box should be not breakable \newtcolorbox{xmybox}[1][]{ ...


1

This should do the trick. \documentclass{article} % Beginning of definitions \usepackage{environ} \newif\ifappendix \NewEnviron{maybeappendix}[1] {\ifappendix \expandafter\global\expandafter\let\csname putmaybeappendix#1\endcsname\BODY% \else \expandafter\newcommand\csname putmaybeappendix#1\endcsname{}\BODY% \fi} ...



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