# Tag Info

8

You can use \bgroup and \egroup to begin and end groups in such circumstances. \documentclass[11pt,a4paper]{article} \newcommand\test{sheep \egroup} \begin{document} Pig \bgroup\Huge\test goat \end{document}

6

The second argument of \lstnewenvironment is just arbitrary code to execute before the environment. It can therefore consist of several \lstset commands, and you can put your common customisations in to one command, say \stringlstset, that is a \lstset in its own right. Here is a small example: \documentclass[a4paper,12pt]{book} \usepackage{listings} ...

5

I'd just use a "helper" macro so the \savedstyle can be expanded (once): \documentclass[varwidth,border=5]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta} \newcommand{\misdirection}[2][]{% \begin{tikzpicture} \node (tree) at (0,0) {tree}; \node (apple) at (3,0) {#2}; \draw [blue,#1] (tree) -- (apple); ...

5

The prefix \global can only go in front of an assignment. However, TeX expands tokens after \global in order to find the assignment. An example is the \booltrue macro in etoolbox: \newrobustcmd*{\booltrue}[1]{% \ifcsundef{if#1} {\etb@noglobal\etb@err@nobool{#1}} {\csname#1true\endcsname}} If one does \global\booltrue{foo}, the latter macro is ...

5


5

You should see your mistake when you compile the following document body: \makefunc{A}{hello}{1} \hello{X}\\ % XA:1 \hello{Y}\\ % YA:1 \makefunc{B}{goodbye}{2} \goodbye{X}\\ % XB:2 \goodbye{Y} % YB:2 The output is as you want it. The reason for that is because when you create your function \hello (via \makefunc{A}), the internal definition requests ...

4

If all that is needed is to obtain the appropriate macro name, there is no need for any tests at all, as things can be done using \csname \newcommand\makefunc[3]{% \expandafter\def\csname #2\endcsname##1{% \csname myobject##1#1\endcsname{#3}% }% } This will work even with more complex names as you can simply use a \cnsame definition for you ...

4

With expl3, just for fun :) \documentclass{article} \usepackage{xparse} % automatically loads expl3 \usepackage{tikz} \usetikzlibrary{arrows.meta} \newcommand{\misdirection}[2][]{% \begin{tikzpicture} \node (tree) at (0,0) {tree}; \node (apple) at (3,0) {#2}; \draw[blue,#1] (tree) -- (apple); \end{tikzpicture}} \ExplSyntaxOn % Declare our ...

3

While it is certainly possible (and maybe also fun) to do such transformations in (La)TeX directly, I would just employ perl or a similar tool that supports search & replace across multiple lines. In your case: perl -0777 -i.bak -pe 's/\n\n\n(.*)\n\n/\n\n\\section{\1}\n/' plain.txt will transform the file text.txt accordingly. Some details: The ...

3

The package mathpartir defines \snoc inside the mathpar environment, overriding whatever definition you give outside. Yes, it is a reserved command, although I couldn't find any trace of this in the documentation.

3

Renewing a command with the command itself in its definition won't work because TeX doesn't remember what the command was previously as you're redefining it. The code you're looking for is something along the lines of: \documentclass[12pt, letterpaper]{article} \usepackage{relsize} \let\RightArrow\rightarrow ...

3

Your problem is not the square brackets: it's the definition of the matrix environment. If you do \show\matrix you get > \matrix=macro: #1->\null \,\vcenter {\normalbaselines \m@th \ialign {\hfil $##$\hfil &&\quad \ hfil $##$\hfil \crcr \mathstrut \crcr \noalign {\kern -\baselineskip } #1\crcr \mathstrut \crcr \noalign {\kern -\baselineskip ...

3

Without putting much thought into it the first to try would be \newcommand\xcut[1]{\ignorespaces}

3

\the\day--\the\month--\the\year In case you want a verbose month, I think it's done in LaTeX with \ifcase\month\or January\or February\or March\or April\or May\or June\or July\or August\or September\or October\or November\or December\fi (Not sure if I wrote them correctly)

2

If I understand what do you need, you plan to write a macro \makefunc which does following: \makefunc \hello A1 \makefunc \goodbye B2 \hello X % -> XA:1 \hello Y % -> YA:1 \goodbye X % -> XB:2 \goodbye Y % -> YB:2 This could be done by only one line of definition: \def\makefunc#1#2#3{\def#1##1{##1#2:#3}} Note that there is no ...

2

Another way is to use the psmatrix environment, from pst-node. The objects are firstdescribed as nodes in a matrix, then the arrows are described. In this description, nodes can be given a name, or are described by their pair of indices i, j in the matrix. See documentation of pst-node for details on how to connect nodes or more generally how to fine-tune ...

1

The lines %\setlength{\maxdepth}{0pt}% to address the "third bug" %\setlength{\topskip}{0pt}% no space above the first line %\vspace*{\dimexpr0.000cm-\topskip plus 1fill} Can't ever do anything very helpful to the document and if I remove them the first page is the expected size.

1

Here's how to do it without expl3: \newcommand\freezeStyle[1][]{% \pgfqkeys{/demo}{#1}% \expandafter\edef\csname\savedname\endcsname##1{% \noexpand\misdirection[\savedstyle]{##1}}} Note that \edef is used here and \noexpand is used to protect macros that should not be expanded. \typeout{\meaning\helloMom} macro:#1->\misdirection [execute ...

1


1

Step1 : you must have installed miktex first Step2 : When you install texnic center in windows 7/8 all configuration will be set Step3 : otherwise manually you can set the path by going into Build ->> define output profiles and set the correct compiler.

1

If you use e-TeX, you can avoid using a register, exploiting the fact that \dimexpr is essentially a nameless dimension register: \def\m#1{\expandafter\minner\expandafter{\the\dimexpr#1\relax}} \def\minner#1{{\dimen0=200pt \#1=#1}} The input \dimen0=100pt \m{\dimen0} will produce #1=100.0pt Without e-TeX and \dimexpr, the workaround is to reserve a ...

1

You can put expanded value of the register to the macro \m. No matter if eTeX is used or isn't, because we needn't to use \dimexpr. \def\m#1{{ \dimen0=200pt \#1=#1 % Outputs 200pt rather than 100pt }} \dimen0=100pt \expandafter\m\expandafter{\the\dimen0}

1

Have a look at Koma-Script package scrdate. Documentation of Koma-Script, look for scrdate Example Commands: \DayName{year}{month}{day} \ISODayName{ISO-date} \ISOToday \todaysname \todaysnumber

1


1

The standard way to make an “invisible” command is to use \@bsphack at its beginning and \@esphack at the end. \documentclass{article} \usepackage[usenames]{xcolor} \usepackage[normalem]{ulem} \def\Corrections{2} % Highlight or Final - 1 or 2 \ifnum\Corrections=1 % 1 - Highlight \newcommand{\xcut}[1]{{\color{red}{\sout{#1}}}}% ...

1

Go to View > Messages Pane: Then click on the "Settings" tab in the bottom right corner: Then click on the "Selected" radio button: Then double click on "User commands" so that "no" turns to "yes": Then click on the "Output" tab: Then do the action that you want to copy the shortcut of. In this case, insert your horizontal line. In the output ...

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