Hot answers tagged

9

Something like this? I used tikz drawings, but this could be replaced by \includegraphics commands of course and a enumitem new list with a special counter named shapeenum has been defined with \AddEnumerateCounter, which selects the shapes according to the value. Due to the internals of enumitem, the shape commands should be robust, i.e. use ...


6

Since the OP wants a variety of unspecified icons, I'll leave the actual specification of those images to the OP. However, what I do here is create a custom environment geonumerate and the ability to specify item types with \newitem{<Name>}{<content>} When \itemName is called inside the geonumerate environment, it scales a version of ...


6

Use \unskip before the ] in the closing part of the environment definition. This will eat up any space characters prior to the ]. EDIT to heed Barbara's comment to remove stray space following em-dash. And as she notes, one cannot have a blank line before \end{example} without automatically introducing a paragraph break. \documentclass{article} ...


5

Here's an example use of the mentioned tcolorbox package for you: Output Code \documentclass{scrartcl} \usepackage[T1]{fontenc} \usepackage{blindtext} \usepackage{tcolorbox} \usepackage{tikz} \usetikzlibrary{shapes} \tcbuselibrary{skins,breakable} \newcounter{example} \newtcolorbox[use counter=example]{defi}[3][]{% enhanced, breakable, drop fuzzy ...


4

It is possible to change the definition with a patch: There are two issues here The missing % after \textbf{#1} An empty {} causes spacing due to \textbf{} I've added a \string% and a check whether the argument is empty -- \notblank{#1}{}{} checks if the #1 is empty and if this is not the case does the code in the 2nd argument. ...


4

How about something like this? This uses minipages as the tabular doesn't really seem appropriate here. The environment altassumption becomes a command \altassumption{}{} which takes 2 arguments. \documentclass[12pt]{article} \pagestyle{plain} \usepackage[margin=1.8cm]{geometry} \geometry{a4paper} \usepackage[parfill]{parskip} \usepackage{setspace,array} ...


4

The command form is easier: \documentclass{article} \newcommand{\LHZZ}[2]{% \expandafter\newcommand\csname LH#1\endcsname[1]{#2}}% } \begin{document} \LHZZ{XY}{% write stuff here refer to #1% } \LHXY{parameter} \end{document} If you really insist in using an environment, use environ: \documentclass{article} \usepackage{environ} \makeatletter ...


4

UPDATE: I've looked at this question for some hours, checking the tcolorbox and cleveref documentation (I even asked here for something related to this, although the MWE I initially did was a mess and I deleted the question afterwards), but @cfr gave me clues and finally I found a solution to your problem. You can create and use your own counters, and the ...


3

It does not work because you use \AtBeginEnvironment to set the label, while the equation counter has not yet been stepped, meaning that the label 1 is not defined when you try to use it, only the label 0 is. From the documentation: \AtBeginEnvironment{<environment>}{<code<}: Appends arbitrary <code> to a hook executed by the \begin ...


3

It's quite easy to do with ntheorem. I loaded the package with options thref (extended references for theorem-like environments) and thmmarks (automatic placement of end-of-proof symbols, including when the proof ends up in equations): \documentclass{book} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{amsmath} % \usepackage{blindtext} ...


3

I don't know if this is precisely what you want, but this does seem to work. I loaded etoolbox for convenience (\csgdef, \csxdef, \csuse). \documentclass{scrartcl} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{etoolbox} \usepackage{environ} \newenvironment{Liederbuch}[1] ...


3

Here is your minimal example turned into a working one: \documentclass[a4paper]{article} \usepackage[T1]{fontenc} \usepackage[ascii]{inputenc} \usepackage{environ} \makeatletter \@ifdefinable\@my@temporary{} % check availability of the name % That's my environment: \NewEnviron{LHZZ}[1]{% \let \newcommand \relax \protected@xdef\@my@temporary{% ...


3

I don't suggest to use an environment here, but I provided the solution anyway for this. But I don't recommend using a 9 arguments, but applying a key-value interface to grab the values -- it's not necessary to remember which argument stands for which content then. \documentclass{article} \usepackage[utf8]{inputenc} \newcounter{usecase}[section] ...


3

It is not clear to me, what is the purpose of the file template1.tex. But the syntax can be fixed. Package filecontents can be loaded before \documentclass via \RequirePackage: \RequirePackage{filecontents} \begin{filecontents*}{template1.tex} \documentclass{beamer} \begin{document} \begin{frame}{A frame} Foo \end{frame} \end{document} ...


3

Like this? \documentclass{article} \usepackage{xcolor} \newcommand{\sectioncolored}[3]{% \section{\textcolor{#1}{#2} #3}% } \makeatletter \def\entrylistsplitfirst#1 #2\@nil{#1} \def\entrylistsplitsecond#1 #2\@nil{#2} \newenvironment{entrylist}[2]{% \edef\tempa{\expandafter\expandafter\expandafter\entrylistsplitfirst #2\@nil}% ...


3

There are some reasons because the code does not work: \newcommand{\title} fails because \title is provided by many classes already → use \renewcommand{\title}. Since it's a redefinition within some other command (an environment actually, the argument parameter is ##1, not #1. The logical error is using \thetitle in the environment start up code -- at ...


3

Of course you get an error: if you want to use scrartcl you have to call \usepackage[nochapters]{classicthesis} However your redefinition of \spacedlowsmallcaps makes no sense: \renewcommand{\spacedlowsmallcaps}[1]{\SC{#1}} is probably what you want. There is no need to do tricks, though. \documentclass[10pt,letterpaper]{scrartcl} ...


2

Perhaps this is a solution: \gobble the content away with a \RenewEnviron{proof}{}{} that has no \BODY command, i.e. the \BODY is 'thrown away'. I used the first proof environment to show some content and then redefined proof, the second content isn't display any longer then. \documentclass{article} \usepackage{amsthm} \usepackage{environ} ...


2

It's possible to use a new counter that is checked at the start-up code of the environment. If the counter is equal to zero, all is fine, increase the counter to indicate that is zero not any longer, if the counter is not zero right from the start (because it has been increased already) issue an error message. At the end of the environment the counter is ...


2

I think this is code golfing however... \expandafter\newcommand\csname ....\endcsname{... won't work outside -- it's a local definition. \global\expandafter\newcommand...won't work neither due to expansion, but \global\expandafter\def\csname... would work, but since the environment body shall be grabbed, the \BODY macro must be expanded first, otherwise it ...


2

The issue with your original code is that (i) the answer environment occurs inside a macro (ii) the answer environment, in turn, invokes a verbatim-like environment. (The comment environment is a special verbatim environment.) Why would this matter? While processing your code, LaTeX correctly inserts \comment at the start of an answer environment. LaTeX then ...


2

In my opinion, the middle environment isn't really delimited and the aufgabe environment should be used as \aufgabe and \endaufgabe, wrapping around the collection. \documentclass{article} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage{amsthm} \usepackage{amsmath} \usepackage{amssymb} \usepackage{collect} \theoremstyle{definition} ...


2

You can't embed a verbatim - like environment like lstlisting inside another environment, at least not without much tricks (like \scantokens etc.) listings provides the facility to generate own, customizable environments with lstnewenvironment. Use \lstset{style=Matlab-editor} to provide the relevant settings in the start-up-code section of the environment. ...


2

You can use a local bounding box declaration to name the collective contents of the scope. In order for this to work in this case, the most straightforward strategy is to draw the stuff in the scope first. For example (updating the code a little along the way e.g. to use arrows.meta and positioning as recommended): ...


1

So, I figured the \tcblistof thing out. It was the title with an image causing the problem. There are two approaches to this issues: Do not use this image in the title definition, but in an overlay. This keeps the title simple and suitable for the list of listings. Use a list entry to define a title for the list of listings. Here's the solution suited to ...


1

The answer from Bernard worked fine, but if you want to stick with the amsthm package then you can also do the following as I later found out. \documentclass{book} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{amsmath} % \usepackage{blindtext} \newtheoremstyle{break}% {2em}{2em}% {}{}% ...


1

If you are using environ package then you can write something like this: \NewEnviron{LHZZ}[1]{% \expandafter\gdef\csname LH#1\expandafter\endcsname \expandafter##\expandafter1\expandafter{\BODY}} Note, that the code is much more compact than the usage of eTeX's \unexpanded, four hashes, etc...


1

First Answer This is kind of a plain texish answer, that does not really solve all of the problems raised by the question regarding wrapping verbatim commands within an environment (I don't know if they can be solved), but sidesteps them, and it works. The toggle for "show answer" is \answertrue and the toggle for "do not show the answer" is \answerfalse. ...


1

You need the listings key label={....}, not \label. The \label command would refer to the section 2 (which was typeset before), since this was the last counter being using in \refstepcounter before the caption come into action (which applies the listings counter) \documentclass{scrreprt} \usepackage{regexpatch}% http://ctan.org/pkg/regexpatch ...


1

Most latex commands are not safe in \xdef (which is why latex has a \protect mechanism and \protected@edef) but here you just want \let I think and don't need to expand \BODY at all. \documentclass[12pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[german]{babel} \usepackage{environ} \usepackage{etoolbox} %%Environments %Liederbuchumgebung ...



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