# Tag Info

9

This could be a starting point : \documentclass{standalone} \usepackage{xcolor} \begin{document} \colorbox{green!30!black!90!white}{\makebox[3cm][l]{\strut\color{white}\sffamily\textbf{Example 20-1}}}% \colorbox{green!30!black!20!white}{\makebox[10cm][l]{\strut\color{green!30!black!90!white}\sffamily\textit{Theoretical...}}} \end{document}

7

It is an environment by definition (as that's what the official latex manual calls it) however it does have one more or less unique property in that unlike any normal environment the content is not in a TeX group, this is for efficiency reasons and makes little observable difference as there can be no code after the environment that is executed.

7

\tcblower is a very special marker which ends an environment (the content box of the upper part) and begins another environment (the content box of the lower part). Therefore, all environments and TeX groups of the upper part have to be closed, before \tcblower is used. This also means that you cannot already begin an environment or TeX group for the lower ...

6

You could use titlesec for keeping up with counter automatically. Then you just issue \subsection, like you are used to, and the header will print, with the counter there. Of course, you can change this to say, \paragraph, er even create your own, \example, all with support for referencing and such. Output Code \documentclass[11pt]{book} \usepackage{...

5

Here's a tcolorbox version with sidebyside for the logo. Please note that such a box is not breakable! \documentclass{article} \usepackage[svgnames,dvipsnames,x11names]{xcolor} \usepackage[most]{tcolorbox} \usepackage[tikz]{bclogo} \newtcolorbox{framed}[1][]{ colframe=lightgray, colback=yellow!40!white, enhanced jigsaw, sharp corners, lower ...

5

Would you be happy with something like this? \documentclass{article} \newcounter{qnumber} \setcounter{qnumber}{0} \newcommand{\newquestion}{\addtocounter{qnumber}{1}\section*{Question \theqnumber}} \begin{document} \newquestion abc \newquestion cdf \end{document}

5

The nesting level is stored in \@listdepth, so you could check its value: \documentclass{article} \begin{document} \setlength{\fboxsep}{0pt} \let\saveditemize=\itemize% \let\savedenditemize=\enditemize% \makeatletter \renewenvironment{itemize} {\ifnum \@listdepth=0\begin{minipage}{5cm}=foo=\fi\saveditemize} {\savedenditemize\ifnum \@listdepth=0 \end{...

4

Why can't you just use a new listings environment since you are loading it anyway, for the tex4ht case? \documentclass[12pt]{book}% \usepackage[T1]{fontenc} \usepackage{color} \usepackage{listings} \usepackage{matlab-prettifier} \definecolor{bg}{RGB}{240,240,240} \usepackage{upquote} %to fix string quotes \usepackage{fancyvrb} \ifdefined\HCode \...

4

You can't use \begin{tcblisting} inside the argument to another command, just like \begin{verbatim} or \begin{lstlisting}. The listings package has \lstnewenvironment for coping with the case of defining new environments based on lstlisting and, of course, also the tcolorbox package has the appropriate feature, called \newtcblisting (see page 290 in the ...

4

verbatim environments like listings can not be nested in definitions for the simple reason they disable parsing, after \begin{matlab} you start verbatim listing mode so \ does not have its normal meaning so that it can appear verbatim in code listings. so \end{matlab} is not the instruction to end an environment it is just the sequence of characters to be ...

4

The problem lives in the code of the float package: If the placement [H] is used, \endfigure will be redefined locally with no respect on the original definition of \endfigure: \def\@float@HH#1[H]{% % Locally redefine the end of the environment. \expandafter\let\csname end#1\endcsname\float@endH ... As consequence the following code compiles fine, ...

4

The comment environment is defined by the verbatim package as a variant of verbatim: instead of printing each line, it simply throws it away. The package defines its verbatim-like environments by doing some steps. First all special characters (well, almost all) become non special; then TeX is instructed to absorb one line at a time, checking whether it ...

3

Here's a preliminary version to maintain the line number at least for manual breaks, using \codeboxcontinuedtrue and \codeboxcontinuedfalse The last line number is always stored at the end of a codebox and may be reinjected to the codelinenumber counter if \ifcodeboxcontinued evaluates to be true. \documentclass{article} \usepackage{clrscode3e} \...

3

Very close to your code fragment, just replaces \fbox by \fcolorbox from the xcolor package: \documentclass{article} \usepackage{framed} \usepackage{xcolor} \usepackage{graphicx} \definecolor{note}{rgb}{1 1 0.5} \makeatletter \renewenvironment{framed}{% \def\FrameCommand##1{\hskip\@totalleftmargin \fboxsep=\FrameSep\fcolorbox{black}{note}{##...

3

Similar to samcarter's solution, but uses \section (no argument needed): \documentclass{article} \let\oldsection\section% Store \section in \oldsection \renewcommand{\section}{% Update \section \refstepcounter{section}% Step section counter \oldsection*{Question~\thesection}}% Write a \section* with a specific header \begin{document} \section Some ...

3

Here is a way using moreverb package: \documentclass[12pt]{book}% \usepackage[T1]{fontenc} \usepackage{color} \usepackage{listings} \usepackage{tcolorbox} \tcbuselibrary{listings} \usepackage{matlab-prettifier} \definecolor{bg}{RGB}{240,240,240} \usepackage{upquote} %to fix string quotes \newtcblisting{matlab}[1]{ nobeforeafter,colback=bg,listing only, ...

3

Currently, the environment cvskill uses the earlier created L-column for the second column, which uses m{#1} as a basis. Therefore, it is aligned at vertical center. change this to p{#1}, and it is aligned at vertical top. To not mess up anything else, I have created a \newcolumntype{K}: \newcolumntype{K}[1]{>{\raggedright\let\newline\\\arraybackslash\...

2

You can use the environ package to collect the body and then write it. Be aware that the body is written in one long line. \documentclass[]{article} \usepackage{polyglossia} \usepackage{ltxtable,longtable,colortbl,environ,etoolbox} \newwrite\mytabularwrite \NewEnviron{tbl} {% \immediate\openout\mytabularwrite=\jobname-ltxtable.tex \immediate\write\...

2

You're starting and ending the \vtop in the “begin” part, so \begin{itemize} is executed and the box ends before the contents of the environment is even examined. TeX allows starting a box with \bgroup and ending it with \egroup. \documentclass[12pt]{article} \usepackage[a5paper]{geometry} \usepackage{microtype} \usepackage{multicol} \usepackage[...

2

I redefine the shaded environment from framed to have a frame, then define a note environment, based on ntheorem with option framed, as a shaded theorem: \documentclass[english]{article} \usepackage[utf8]{inputenc} \usepackage{babel} \usepackage{geometry}% \usepackage[x11names]{xcolor} \usepackage{fourier, erewhon} \usepackage{lipsum} \usepackage{...

1

A preliminary version with article instead of abntex2 (that one fails!) \documentclass{article} \usepackage{tocloft} \usepackage{chemfig} \usepackage{environ} \newcommand{\listofstructformname}{List of structural formulas} \newlistof{structform}{stf}{\listofstructformname} \makeatletter \NewEnviron{structuralFormula}[1]{% \let\c@equation\c@structform ...

1

You can always check with \ifvmode or \ifhmode, e.g., \ifvmode do this\else do that\fi. But here you don't need that because \par acts that way (don't use \newline or \\ to end paragraphs). I added the \noindent which does no harm if \parskip=0pt and acts as you seem to want when \parskip≠0pt. \newenvironment{myenv} {\begin{trivlist}\item} {\par\...

1

For frames around environments you can use the \surroundwithmdframed command. This surrounds all environments with the specified name with a frame. To surround only some parts, you can define a second dialogue command with a different name. An additional problem is that mdframed sets leftmargin, which is used by dialogue for the hanging indent. To recreate ...

1

You can have this, for instance: \documentclass{article} \usepackage{amsmath} \usepackage{amsthm} \usepackage{thmtools} \usepackage[dvipsnames]{xcolor} \declaretheoremstyle[ spaceabove=0\topsep, spacebelow=0\topsep, name={\color{Blue}Proposition}, ]{propsty} \declaretheorem[style=propsty]{prop} \declaretheoremstyle[ spaceabove=0.5\topsep, ...

1

You have to make @ an active character with \Activate and switch off this feature with \Deactivate later on. This can be either done by using the \spobj etc. commands outside of objectives or wrap \Activate\newenvironment{objectives}...\end{objectives}\Deactivate In addition, the @ etc. characters must be followed by a space character (as stated in the ...

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