# Tag Info

6

You can define a command as \newcommand\set[1]{%% \begingroup \def\suchthat{... some definition...}%% ... other macro content .... \endgroup} And this will make \suchthat available inside the macro. You could have done this with \bgroup and \egroup, but that creates a subformula with consequences on how the spacing is handling if used in ...

5

A. Ellett's suggestions are good, but there are some subtleties connected with this approach. Localizing the definition with \bgroup and \egroup is bad, because the \set macro is clearly used in math mode. Such a construction would make a subformula, with the consequence that spaces are frozen and don't participate with stretching and shrinking on the ...

4

You shouldn't use repeated [] arguments in this way. use a comma separated list for an arbitrary argument syntax. \documentclass{article} \usepackage{xparse,expl3} \ExplSyntaxOn \DeclareDocumentEnvironment{myenv}{O{}} {\doargs:n{#1}} {} \DeclareDocumentCommand{\mycom}{O{}}{ \doargs:n{#1} }% \clist_new:N\arglist \cs_new_protected:Nn\doargs:n{{ ...

3

% arara: pdflatex \documentclass{article} \usepackage{tikz-cd} \usepackage{mathtools} \newcommand*{\statement}[1]{\text{STATEMENT}\ #1} \begin{document} \begin{tikzcd}[every arrow/.append style={Rightarrow}] \statement{1} \arrow{r} & \statement{2} \arrow[out=0, in=0]{d} \\ \statement{3} \arrow[out=180, in=180]{d} & \statement{4}\arrow{l} \\ ...

3

You need to perform a string comparison with the expansion of \@currenvir against itemize. \ifthenelse with the \equal operator does this, but you're short a magic \makeatletter...\makeatother wrapper (see What do \makeatletter and \makeatother do?). Consider the post Why is the ifthen package obsolete?, I've used the e-TeX \pdfstrcmp to perform a string ...

3

3

Doubt this is what the OP wants, but every now and then it's nice to do something from (almost) first principles, and convince myself that all that time I spent years ago reading Stephan von Bechtolsheim's TeX in practice wasn't completely wasted. Note that the use of \scantokens assumes that etex is used. \documentclass[border=10]{standalone} ...

3

Just define the notes environment to do what you want: \documentclass{article} \usepackage{xcolor,comment} \newenvironment{notes} {\par\textcolor{blue}{\bfseries Note:} \color{blue}\ignorespaces} {\par} %\excludecomment{notes} \begin{document} Some text for saying some nonsense. \begin{notes} Here we want to add a note. \end{notes} Start again with ...

2

The space is comming from topsep, so you need to set this to 0 for this environment. The easiest way to this is with \AtBeginEnvironment from the etoolbox package which will keep the change local to the environment: \documentclass{article} \usepackage{alltt} \usepackage{etoolbox} \AtBeginEnvironment{alltt}{\setlength{\topsep}{0pt}} \begin{document} ...

2

This is due to an additional \begingroup / \endgroup pair which is introduced by \newenvironment combined with deep magic which communicates the set of graphics layers from the axis to the tikzpicture. There are basically three ways to solve it: 1] Activate layered graphics manually before your axis: \documentclass[class=minimal,border=0pt]{standalone} ...

2

My solution uses the temporary external file. The data are scanned in verbatim mode and saved to the file. Then the file is read with normal catcode settings, so the normal output is printed. Then the data from verbatim scan is used for verbatim output. \documentclass{article} \newwrite\verbfile \def\setverb{\def\do##1{\catcode##1=12}\dospecials} ...

2


2

\documentclass{article} \usepackage{hyperref} \newcounter{exo} \makeatletter \newenvironment{exo}[1]% {\refstepcounter{exo}% \protected@edef\@currentlabelname{#1}% addition here \vspace{0.5cm}\noindent {\large\bfseries{Exercice \theexo~: #1} \par} {\par\vspace{0.5cm}}} \makeatother \begin{document} A small example \section{First degree} \begin{exo}{First ...

2

If you want to avoid the list environment, you could just make one environment for your structure build around a minipage. The problem with this is that it will not break across pages. But since you mentioned subfig I'm assuming that this environment isn't something that is intended to span multiple pages. \documentclass{article} ...

2

Using a hack of the example package. It could be a good idea make directly your own package based in example.sty instead of muddle the preamble on this way. \documentclass[a4paper]{article} \usepackage[margin=3cm]{geometry,xcolor} \usepackage{example,booktabs} \parindent0pt\parskip0em \columnsep .1\textwidth \makeatletter \chardef\escape=0 ...

2

since you want only a word or so omitted, i think an ordinary command is better than an environment. here's one possibility. \documentclass{article} \newif\ifmycmd \newcommand{\FlagText}[1]{% \ifhmode\unskip\fi \ifmycmd \else \space #1\fi } \begin{document} Here is some text \FlagText{with some words} to be ignored. \FlagText{Start} a new ...

1

The solution depends on the alphabet, used for the variables. If these are identifiers with upper and lower case letters, digits, underscore and some other harmless symbols (with category code 12/other, as punctuation chars) then \detokenize can be used to normalize the category codes of the identifier to token with category code 12 (same as digits): ...

1

\documentclass{article} \newenvironment{hang} {\list{}{% \parindent1cm \itemindent-1cm }\item[]} {\endlist} \begin{document} \begin{hang} This should hopefully be a hanging line of text. This should hopefully have a hanging line of text. This should hopefully be a hanging line of text. This should hopefully have a hanging line of text. This should ...

1

A complete minimal working example can look like this: \documentclass{article} \usepackage{listings} \begin{document} \begin{lstlisting}[language=bash] #!/bin/bash echo "Hello,world!" \end{lstlisting} \end{document} This compiles fine with XeLaTeX:

1

Try enumitem \documentclass{article} \usepackage{enumitem} \usepackage{lipsum} \begin{document} \lipsum[1] \begin{enumerate}[leftmargin=*,label=aaa \arabic* --] \item \lipsum[1] \item Some other text \end{enumerate} \lipsum[2] \end{document}

1

I did not use the OP's code, but I show here how the filecontents, etoolbox and verbatimbox packages can be used to both typeset some code and display the source, all in one environment. EDITED to include it in a single environment, using the syntax \begin{enviro}{name}{description} <code> \end{enviro} I set the output using my own simplistic ...

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