Tag Info

Hot answers tagged

12

You need delimited arguments for such things: \def\nam#1{\nami #1 {} {}} \def\nami #1 #2 {% \if\relax\detokenize{#1}\relax\else \stackunder{\uline{#1}}{\tiny{#2}} \expandafter\nami \fi } Then a call of \nam{foo 1 bar 2 baz 3} would alredy do what you need. Hence, there is no need to have an interface that uses an environment. Here is the complete ...


7

I'd prefer a different syntax: \documentclass[12pt]{memoir} \usepackage{environ,xparse} \ExplSyntaxOn \NewEnviron{numberedEnviron} { \par \rama_numbered_environ:V \BODY \par } \cs_new_protected:Nn \rama_numbered_environ:n { \seq_set_split:Nnn \l_rama_numbered_words_seq { ~ } { #1 } \seq_map_inline:Nn \l_rama_numbered_words_seq { ...


5

For jobs like this, use enumitem that provides flexible options. Here is an example. \documentclass{article} \usepackage{enumitem} \newlist{myitemize}{enumerate}{10} \setlist[myitemize]{label*=\arabic*.,nosep,leftmargin=*} \begin{document} Here is some text \begin{myitemize} \item some text \item some text \end{myitemize} And again some more... ...


5

Here's one option using a list with the help of enumitem: \documentclass{article} \usepackage{enumitem} \usepackage{lipsum} \newlength\mylen \AtBeginDocument{\settowidth\mylen{IF:~}} \newlist{MIF}{description}{1} \setlist[MIF,1]{leftmargin=*,labelsep=0pt,itemindent=-\mylen} \newenvironment{IF} {\begin{MIF}\item[\textnormal{IF:~}]} {\end{MIF}} ...


4

You can use \surroundwithmdframed[<options>]{<environment>} A complete example: \documentclass{article} \usepackage{listings} \usepackage{xcolor} %custom colours \usepackage[framemethod=tikz]{mdframed} %nice frames \definecolor{light-gray}{gray}{0.95} %the shade of grey that stack \surroundwithmdframed[backgroundcolor=light-gray, ...


4

The natural structure to use here is an enumerated list. Using the enumitem package you can easily change the counter representation to have the desired formatting: \documentclass{article} \usepackage{enumitem} \usepackage{amsthm} \newtheorem{lem}{Lemma} \begin{document} \begin{lem} Let $f$ be a function which satisfies either ...


3

You are adding lots of space, so just don't add it. For example \newenvironment{codeexcerpt}[1][]{ \refstepcounter{codeexcerptcounter}% }{% } should be \newenvironment{codeexcerpt}[1][]{% \refstepcounter{codeexcerptcounter}% }{% } to avoid adding a space at the start of the environment. also in \newcommand{\addcodeexcerpt}[1][]% {\begin{center} ...


3

Instead of opening the environment, use the true/false arguments to define a macro: \documentclass{article} \usepackage{ifthen} \newenvironment{selectlist}[1] {% \ifthenelse{\equal{#1}{itemize}} {\def\selectedlist{itemize}} {\def\selectedlist{enumerate}}% \begin{\selectedlist}% } {\end{\selectedlist}} \begin{document} ...


3

You can use tocbasic from KOMA-Script, like this: \documentclass{scrartcl} \usepackage[framemethod=TikZ]{mdframed} \usepackage{xcolor} % EXAMPLES %% set the counter for your environment \newcounter{example} \renewcommand{\theexample}{\thesection.\arabic{example}} %% define the style \mdfdefinestyle{example}{% backgroundcolor=black!2, ...


3

How about this? I put the explanations in a \parbox, and I think there is no risk of confusion. With the eqparbox package, I align all = signs, and the alignat environment allows alignment of the texts. In addition I replaced \overrightarrow with arrows from the esvect package. Also, I used the esdiff package, from the same author, which simplifies typing ...


2

There are several problems; the first two are the main ones: You need to load thmtools after amsthm. Since you used \declaretheoremstyle for the shaded style, you need to define your structures using \declaretheorem instead of \newtheorem, and pass the shaded style as an option to the style key instead of using \theoremstyle. Load hyperref in the last ...


2

Using verbatim package the code for the second example works out of the box (if dashrule package is included as well) \documentclass{article} \usepackage{verbatim} \usepackage{dashrule} \newenvironment{codeExample}{ \vspace*{1.5em} \noindent Code Example:\\ \hspace*{1.3em} \hdashrule[0.5ex]{435pt}{0.9pt}{1.5mm} \verbatim } {% \endverbatim ...


1

Untested as you don't provide working code, but for the second question \newenvironment{exercises}[1][Exercises] {\section*{\Hrulefill\quad% {\bfseries #1}\quad\Hrulefill}% \let\enumerate\exenumerate\let\endenumerate\endexenumerate} {} would let you say \begin{exercises} \item items with Exercises as title \end{exercises} or ...


1

With \NewEnviron{myframe}[1][]{...} you are declaring that myframe has an optional argument (default empty), so when you use \begin{myframe}{TITLE} the value of #1 is empty. The title is there, but it's empty. You can prove it by changing \NewEnviron{myframe}[1][]{% into \NewEnviron{myframe}[1][Hey!]{% and you'll see “Hey!” in the title place. You ...


1

The OP decided to resolve this problem via defining \newenvironment{solution}{\begin{proof}[Solution]}{\end{proof}} See also the comments under the question


1

The following example with up-to-date TeXLive works well: \documentclass{amsart} \usepackage{colonequals} \usepackage[math-style=ISO]{unicode-math} \setmainfont[Numbers=OldStyle]{Minion Pro} \setmathfont{MinionMath-Regular} \setmathfont[range={\mathfrak,\mathcal}]{XITS Math} \begin{document} foo \textit{bar} \textbf{baz} \begin{equation*} f(x) ...



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