Tag Info

Hot answers tagged

49

It allows using arguments in nested macro definitions. In \def\a#1{\def\b#1{...}} the macro \b would not have an argument, since #1 belongs to \a and would be replaced by its argument. However, \def\a#1{\def\b##1{...}} defines \b with an argument. During expansion #1 will be replaced by a parameter ## becomes # Then \b can use #1 instead of the ...


25

If you are talking about the left and right margins of a tabular (be careful with the term 'table'), they can removed using @{} as first and last element in the column definition: \begin{tabular}{@{}ll@{}} The replace the normal skip with the content of the {}, which is empty in this case. This also works for tabularx and array etc.


23

Playfair's axiom\footnote{% so called in honor of mathematician John Playfair, etc, etc., but was actually discovered by Proclus\footnotemark} \footnotetext{Greek mathematician, etc, etc.} But I'd advise against doing this. As a bonus, here's an example of how you can really mess with footnotes. \documentclass{article} \begin{document} ...


22

Without any package, the correct command to be redefined is \labelitemii (note the second i). \documentclass{article} \renewcommand{\labelitemii}{$\star$} \begin{document} \begin{itemize} \item one \dots{} \begin{itemize} \item Language Models \item Vector Space Models \end{itemize} \item two \dots{} \item three \dots{} ...


22

A package? The following simple macro does it: \documentclass{article} \newcount\smcount \def\smart#1{\ifcase\smcount(\or[\or\{\else TOO DEEP!\fi% \advance\smcount by1 #1\ifcase\smcount\or)\or]\or\}\else TOO DEEP!\fi% \advance\smcount by-1 } \begin{document} \smart{Ala \smart{ma \smart {kota}}} \end{document} (Or, if you wish, not \smart but ...


21

The problem comes up already with a "more minimal" example: \documentclass{article} \usepackage{amsmath} \begin{document} $\breve{\breve{a}\breve{b}}$ \end{document} which produces ! Undefined control sequence. \macc@adjust ->\dimen@ \macc@kerna \advance \dimen@ \macc@kernb \kern -\dimen@ thus showing that the ...


20

If you use the enumitem package you can easily reset the label via [label=$\star$] option. If this is the default behavior you want for nested lists you can use \setlist[itemize,2]{label={$\star$}} to automatically set the 2nd level itemize lists to use the \star. \documentclass{article} \usepackage{enumitem} \begin{document} \begin{itemize} \item ...


20

For comparison I am posting a ConTeXt solution. Such a macro already exists, albeit for quotes. One of the good things about ConTeXt is that a feature is never defined in a one-off basis. For example, instead of defining a macro for quotations that changes the quote symbol depending on the level of nesting, ConTeXt defines a generic delimitedtext mechanism ...


18

When TeX reads arguments, then TeX only checks for matching curly braces (characters with catcode 1 and 2). Square brackets are not special in this sense. The first ] that is not hidden inside curly braces is taken as the end of the optional argument. Therefore an additional set of braces is the usual solution: \foo[{\bar[...]}]{...} It is only a bug, if ...


18

Define a new quote style and add appropriate level tests for the outer quotation marks: \documentclass[12pt]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[maxlevel=3]{csquotes} \makeatletter \DeclareQuoteStyle{threelevel} {\ifnum\csq@qlevel<2 \guillemotleft\else\textquotedblleft\fi}% opening outer mark ...


17

Yes, you can. \newcommand\question[1]{{% extra brace \renewcommand\code[1]{\textit{##1}}% double # whatever you want for #1}}


16

You have the following options: Outer double, inner single: ``\thinspace`\ \ldots\ '\thinspace'' \par Outer single, inner double: `\thinspace``\ \ldots\ ''\thinspace' The TeX Book mentions (Chapter 2: Book Printing versus Ordinary Typing, p 5): "There's usually less space preceding a single left quote than there is preceding a double left quote. (Left ...


16

The paralist package provides the package option pointedenum (or pointlessenum depending on whether you want 1.1.1. or 1.1.1) that makes the enumerate environment behave in exactly this way. If you only want to use this on some enums, you can define (with paralist loaded) \newenvironment{myenum}% {\pointedenum\begin{enumerate}}% {\end{enumerate}} The same ...


16

Here is an approach which is somewhat more modular than alexurba's approach, which accomodates indefinite levels of nesting. \makeatletter \def\@enparen#1{\bgroup\let\enparen\@@enparen(#1)\egroup} \def\@@enparen#1{\bgroup\let\enparen\@@@enparen[#1]\egroup} \def\@@@enparen#1{\bgroup\let\enparen\@enparen\{#1\}\egroup} \let\enparen\@enparen ...


16

Use \renewcommand{\labelenumii}{\theenumii} \renewcommand{\theenumii}{\theenumi.\arabic{enumii}.} to change the way nested enumerations are set (without brackets ()) and in a sub-enumeration form that is \arabic: \documentclass{article} \renewcommand{\labelenumii}{\theenumii} \renewcommand{\theenumii}{\theenumi.\arabic{enumii}.} \begin{document} ...


16

Here's a little example: two "outer" nodes, each one containing a graph (formed with "inner" nodes) and some edges and arrows connecting outer nodes to outer nodes, and inner nodes from one graph to inner nodes of the other; the remember picture option lets you access inner and outer nodes at any time: \documentclass{article} \usepackage{tikz} ...


16

Have a look for example at the easylistpackage. It simplifies the process by defining one active character whose number of occurences defines the level of this specific list item. \documentclass{article} \usepackage{easylist} \begin{document} \begin{easylist} § First level §§ Second level §§§ Third level §§§ Again third level §§§§ Now fourth level § First ...


15

The csquotes package might be helpful. For nested quotings just nest \enquote{} like this: \documentclass[english]{article} \usepackage{csquotes} \begin{document} \enquote{outer and \enquote{inner}} \end{document} It is also very useful for non-english quotation marks: \documentclass[naustrian,german]{article} \usepackage[utf8]{inputenc} ...


15

I can't say for sure with ordinary LaTeX, but if you use the showlabels package (very useful when in draft mode) then the label is shown in a different place for the two. Code: \documentclass{article} \thispagestyle{empty} \usepackage{graphicx} \usepackage{showlabels} \begin{document} \begin{figure} \includegraphics{vignettes} \caption{This is a ...


15

Use four #s in the second nesting level: \documentclass{article} \begin{document} \newcommand{\one}[1]{% \newcommand{\two}[1]{% \newcommand{\three}[1]{#1, ##1, ####1}% } } \one{a} \two{b} \three{c} \end{document} The following quote from TeX by Topic gives an explanation (further details in section ...


15

this is certainly a bug, and has already been reported as such to tech-support@ams.org. it has been added to the list for the next overhaul of the amsmath package. here are two additional small tests that provide useful information: \documentclass[11pt]{article} \usepackage[]{amsmath} \begin{document} \[ \breve{\breve{T} v} \] \end{document} this results ...


15

The packages bigfoot and manyfoot have this functionality. See this example from the bigfoot documentation: Unfortunately, the customization of footnotes in bigfoot is not well documented (David calls this "expert options" and suggests reading the code). Here is an example: \documentclass{article} \usepackage[ruled]{bigfoot} \DeclareNewFootnote{A} ...


14

Yes, you can nest standalone files, however, as with any other document which \inputs standalone files you need to load the standalone package also in this case. Another issue is that you can't use floats like table and figure environments in normal standalone files, because of the used preview mode used. You need either switch it off using the class option ...


13

Not exactly an answer, but the nearest I can get. TeX's approach to grouping means that you cannot easily isolate the 'inner' environment from the 'outer' one. The best approach is therefore to typeset the inner code first, by storing it in a box, then using the box in the 'outer' code \newsavebox{\mybox} \sbox{\mybox}{% \begin{tikzpicture} % Inner ...


13

Maybe nested definitions: \documentclass{article} \newcommand{\enparent}[1]{{% \def\enparent##1{{\def\enparent####1{\{####1\}}[##1]}}(#1)% }} \begin{document} \noindent \enparent{My outer layer \enparent{my inner lever \enparent{my innermost level}}}\\ \enparent{My outer layer \enparent{my inner lever \enparent{my innermost level}}} \end{document}


12

\documentclass{article} \usepackage{amsmath} \setlength\delimitershortfall{0pt} \begin{document} \[ M = \left\{ x \in X : \begin{cases} p(x) > 0 \\ q(x) > 0 \end{cases} \right\} \] \end{document} As shown that is a global setting, it can be set locally within a single expression (or a single {} group) if needed. Also you can ...


12

The shapes.multipart library of TikZ can be helpful (refer to Section 48.6 Shapes with Multiple Text Parts of the pgfmanual); a little example: \documentclass{article} \usepackage{tikz} \usetikzlibrary{shapes.multipart} \begin{document} \begin{tikzpicture}[ double/.style={draw, anchor=text, rectangle split,rectangle split parts=2}, ...


12

The following is crude, and perhaps better done using a matrix, but it's here to demonstrate how to use a fitted box in the background. \documentclass[10pt]{article} \usepackage{tikz} \usetikzlibrary{backgrounds,fit} \begin{document} \begin{tikzpicture}[outer sep=0.05cm,node distance=0.8cm,] \tikzstyle{bigbox} = [draw=blue!50, thick, fill=blue!10, rounded ...


12

It's logic, captain, but not as we know it. The crucial fact to remember is that every time beamer sees a + then beamerpauses is incremented. Here's what I see, with the value of beamerpauses (in italics) evaluated at lots of occasions. First, the actual code I ran (beamerpauses coloured to make it stand out). {\color{green}\thebeamerpauses} ...


11

Solution 1 One smashing way would this be, although the spacing isn't that great. Code \documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation*} function = \begin{cases} case1 & \mbox{if } n = 0 \\ ...



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