title: Problem with caption, hyperref and algorithm2e

text: I'm trying to mix the `caption`, `hyperref`, and `algorithm2e` packages, but I am having some issues. Here is a MWE.               \documentclass[12pt]{book}     \usepackage{float}     \usepackage[footnotesize,bf,center,figurename=Fig]{caption}     \usepackage{amsmath}     \usepackage{xpatch}     \usepackage[vlined,ruled]{algorithm2e}     \xpretocmd{\algorithm}{\hsize=\linewidth}{}{}     \usepackage[colorlinks,citecolor=green!90!black,draft=false,pdfencoding=auto]{hyperref}     \usepackage{cleveref}     \begin{document}     \listoffigures     \newpage     \begin{algorithm}[H]     \DontPrintSemicolon     \renewcommand\figurename{Algorithm}     \captionof{figure}{FOO.\label{alg:foo}}         \KwIn{}     \end{algorithm}     \begin{figure}[H]     ~     \caption{Consistent numbering between figures and algorithms.}     \end{figure}     \newpage     \captionsetup{list=no}     \begin{algorithm}[H]     \DontPrintSemicolon     \renewcommand\figurename{Algorithm}     \captionof{figure}{BAR.\label{alg:bar}}         \KwIn{}     \end{algorithm}     \captionsetup{list=yes}     \begin{algorithm}[H]     \DontPrintSemicolon     \renewcommand\figurename{Algorithm}     \captionof{figure}{FOOBAR.\label{alg:foobar}}         \KwIn{}     \end{algorithm}     Ref: \ref{alg:foobar}.     \end{document}      There are two problems:   1. algorithm BAR is in the list of figures, while it is not supposed to because of `captionsetup`.   2. the reference to algorithm FOOBAR links to algorithm FOO, both in the list of figures and in page 3. Thank you for looking.


title: How to avoid widow lines after displayed equations

text: If a displayed equation is close to the bottom of the page, TeX likes to insert a page break even if the current paragraph contains only one more line after the equation, as e.g. in               ... it follows that     \[       a_n = ...     \]     for all $n\in\N$.      (And this happens although there is enough space in the current page.) The problem appears to be that TeX doesn't regard a widow line following a displayed equation as a widow. Since I don't like this behaviour, I came up with the following workaround: I write `\avoidbreak` before the closing `\]`, where `\avoidbreak` is defined by               \newcommand{\avoidbreak}{\postdisplaypenalty=100}      Of course it's a nuisance that now I have to write `\avoidbreak` at every instance of a possibly "bad" page break. I don't want to globally define `\postdisplaypenalty=100` since this would discourage page breaks after displayed equations even at the end of a paragraph: For a _new paragraph_ right after the display it is quite alright if it starts on the next page (even if it consists of only one line, see also the MWE below). Now my question: Is there a clean solution that works without having to manually add something like `\avoidbreak`? I'd appreciate some code that I can just add to my preamble.               \documentclass{article}     %Remove the following % to get "one line of text" onto the first page:     %\postdisplaypenalty=100     \setlength\textheight{3.65cm}     \setlength\textwidth{4cm}     \begin{document}     Two lines of text followed by a formula     \[a=b\]     Two lines of text followed by a formula     \[a=b\]     %With my code, there will be no change if you put an empty line at this place!     %If "one line of text" below starts a new paragraph, then     %that paragraph should be allowed (even encouraged) to start on a new page.     %I only want to try and avoid the page break if no new paragraph is started here.     one line of text          New paragraph     \end{document}      (Let me mention that TeX has a `\displaywidowpenalty` parameter, but this one is about widows _before_ displayed equations.)


title: move margin of pages for bookbinding

text: \documentclass[a4paper,12pt,openright,twoside]{book}      \usepackage[utf8]{inputenc}      \usepackage{indentfirst}           \usepackage{fancyhdr}      \usepackage{booktabs}            \pagestyle{fancy}\addtolength{\headwidth}{14pt}       \renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}       \renewcommand{\sectionmark}[1]{\markright{\thesection \ #1}{}}            \rhead[\fancyplain{}{\bfseries\leftmark}]{\fancyplain{}{\bfseries\thepage}}       \lhead[\fancyplain{}{\bfseries\thepage}]{\fancyplain{}{\bfseries\rightmark}}            \begin{document}      I'd like to move the left margin for odd pages a bit more to the right, vice versa for even pages, right margin moved a bit more the left. I need more space in the sides of the bookbinding, with this configuration is centered so the binding takes space and the result is visually asymmetrical and difficult to browse. How should I do?


title: Package hyperref conflicts with counter inside section title

text: The following minimal document               \documentclass{article}          \usepackage{hyperref}          \newcounter{projno}     \newcommand{\proj}{%     \stepcounter{projno}%     \theprojno}               \begin{document}          \section{Project \protect\proj }          \end{document}      produces the error               ! Missing \endcsname inserted.     <to be read again>                         \csname\endcsname     l.14 \section{Project \protect\proj }      The error disappears when I comment out `\usepackage{hyper ref}`. Does anyone see a way out of this dilemma ?


title: How can I make this equation fit on a single line?

text: I want to make this equation fit on one line. I've tried to use `\small`, but it doesn't work. What should I do?               \begin{equation}     1^{st}integral= \int_{0}^{\infty}{\frac{2 \pi \zeta}{\alpha} t^{(\frac{-2}{\alpha}-1)}e^{- \pi t^{\frac{-2}{\alpha}} \sum_{i\in K}{\frac{\lambda_i P_i ^{\frac{2}{\alpha}} \rho(D_i\hat{T}_i,\alpha)}{D_i\hat{T}_i^{\frac{2}{\alpha}}}}}  e^{- \pi \zeta t^{\frac{-2}{\alpha}}}dt}     \nonumber       \end{equation}


title: EPS figures have misaligned text when imported

text: I have a manuscript with two-dimensional .eps figures generated by Gnuplot 4.6.3. When I examine these .eps figures directly (e.g., via OS-X's preview app), they appear fine. They're also fine under a certain LaTeX class file/set of packages/options/etc. However, after changing my manuscript to a different class file (sig-alternate-10pt.cls, e.g., from here, I'm having the following problem: The ytic and xtic labels, as well as the text (not the symbols) in the keys are being shifted to the right (it looks like the ytic/key labels may just be forced to center-aligned instead of right-aligned, as they should be), so that, for example, the ytic labels overlap with the yaxis. In case this is related, the set of packages being used by the document are: array caption cite color epsfig graphicx longtable multirow pslatex setspace soul subcaption tabularx url xspace.               $ latex -v     pdfTeX 3.1415926-2.5-1.40.14 (TeX Live 2013)     ...     Compiled with libpng 1.6.1; using libpng 1.6.1     Compiled with zlib 1.2.7; using zlib 1.2.7     Compiled with xpdf version 3.03      The gnuplot terminal is: post eps enhanced. I was able to partially get around this by using manual "offset" and "width" keywords for the tics and keys, respectively, but this is really annoying (I have many graphs in this manuscript), and not a true solution. Searching has not yielded any clues.


title: Formatting the headings

text: SX I'm still fairly new to latex and hoping to get some help on how to do the formatting of the font for chapters and headings. I've been looking around the forum for hours now, trying to see if I could piece it together myself but had to give up in the end. I basically have two problems. **1\. Desired format** 1 Chapter 1.1 Section 1.1.1 Subsection 1.1.1.1 Subsubsection I found this possible with:               \usepackage{titlesec}     \titleformat{\chapter}{}{}{0em}{\bf\LARGE\thechapter.~}      However this also puts a 0. in my Abstract chapter, which I don't know how to remove. It also creates double numbering in the ToC. Is there a way around this so I can keep the numbering except for Abstract and not have double numbering in ToC? **2\. Change Font** I found out how to change the font for the entire document. I simply used:               \usepackage[T1]{fontenc}     \usepackage{ebgaramond}     \usepackage[ebgaramond]{mathdesign}      I only wish to use Garamond as the normal text while using another font (http://surl.dk/e1e/ from this list most likely) for headings. How do I go about changing the fonts of the headings? I'm on Mac OSX 10.9.4 using TeXworks. ![screenshot of example](http://i.stack.imgur.com/L3UHs.png) I appreciate any help. Full code:               %% Preamble start          %%%% --- Basic ---          \documentclass[12pt,twoside]{report}     \usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}               %%%% --- Typography ---          \usepackage[T1]{fontenc}     \usepackage{ebgaramond}     \usepackage[english]{babel}     \usepackage{csquotes}     \setlength\parindent{0pt}     \usepackage{titlepic}          %%%% --- Headings ---          %     % ?????     %          %%%% --- Math and Chem specifics ---          \usepackage[ebgaramond]{mathdesign}     \usepackage{amsmath,amssymb}     \usepackage[version=3]{mhchem}  %Easier to write chem compounds ie. \ce{H2O} and \ce{PO4^2-}          %% Preamble end          \title{Report Ex}     \author{John Smith}          \begin{document}     \maketitle     \chapter{Abstract}     Lorem ipsum dolor sit amet, consectetur adipiscing elit.\\     \tableofcontents     \chapter{Introduction}     \section{Background}     Lorem ipsum dolor sit amet, consectetur adipiscing elit.\\     %     \subsection{Details}     Lorem ipsum dolor sit amet, consectetur adipiscing elit.\\     %     %     \section{History}     Lorem ipsum dolor sit amet, consectetur adipiscing elit.\\     %     \section{Analysis}     Lorem ipsum dolor sit amet, consectetur adipiscing elit.     \end{document}


title: How to convert external graphics automatically to black&white

text: For the last ten week me and 9 other students have worked on a report. And the final version of the report needs to be printed in black&white (so no color). The easiest method is use the grey setting of the printer. However, many picture in the report are now unclear. Therefore, I would like to ask you guys the following question: "Is there an option in latex which automatically prints the pdf in black&white?" This is the following setup I use for latex               \documentclass[a4paper,11pt,oneside]{scrbook}     \usepackage{geometry}       \geometry{a4paper}         \geometry{width=0.7\paperwidth,height=0.8\paperheight}     \usepackage{graphicx}     \usepackage{rotating}                  \usepackage{epsfig}     \usepackage{amsmath}     \usepackage{epstopdf}     \usepackage{fullpage}     \usepackage{url}      \usepackage[parfill]{parskip}     \usepackage{float}     \usepackage{pdfpages}     \usepackage{titlesec}                            \usepackage{multirow}     \usepackage{eurosym}                                 \usepackage{gensymb}                                 \usepackage{appendix}                            \usepackage{titlesec}     \usepackage{booktabs}                            \bibliographystyle{unsrt}           \usepackage[monochrome]{color} % if I use this I get an error: option clash for package color.     %%%%%%%%%%%      and if I put in behind the documentclass like               \documentclass[a4paper,11pt,monochrome]{scrbook} % it still prints the pdf in color.      I hope one of you guys can help with this.


title: Tikzpicture graph position

text: I've got problem with positioning of a graph. The graph is shown on page 3 instead of page 2 (where it clearly should fit). I've tried to change the scale to 1.2 (from 1.3). But at when it's less than 1.25, the graph is getting positioned in the middle of a text (Not behind or in front of). Here is the code:                \documentclass[12pt]{article}          \usepackage{fancyhdr}     \usepackage[swedish]{babel}     \usepackage[utf8x]{inputenc}     \usepackage{amsmath}     \usepackage{graphicx}     \usepackage[colorinlistoftodos]{todonotes}     \usepackage{pgfplots}     \usepackage{tikz}          \title{Examination, Grunder i LaTeX, MA1426}     \author{Kristoffer Westring}     \rhead{Kristoffer Westring 199401316899}     \setlength{\parindent}{1cm}     \pagestyle{fancy}     \headheight 15pt          \rhead{Kristoffer Westring 940131-6899}          \begin{document}     \rhead{Kristoffer Westring 940131-6899}     \maketitle          \pagebreak     En funktion är i matematikens värld en typ av regel som tar ett värde som stoppas in i regeln. Ofta ändras invärdets utvärde. \\     Antag att vi har funktionen \\     $f(x)=3x+2$\\     $f$     är funktionens namn. Den kan heta vad som helst, men ett vanligt namn på funktioner är      $f$.     Det värde som står innanför paranteserna, i detta fall $x$, kallas för \textit{invärdet}. Invärdet (även kallat \textit{argument}) är det värde som ska genomgå funktionen och komma ut som \textit{utvärde}. Utvärdet är i vårt fall är $f(x)$. \\     Om vi då ser vilket värde $f(x)$ har när $x=2$. Då skriver man $f(2)$ och byter ut de $x$ i funktionen mot $2$. \\     $x=2$ ger oss då att\\     $f(2)=3*2+2=8$\\     Detta kallas för en kontinuerlig funktion. Den har varken slut eller början och linjen är hela tiden kontinuerlig, den bryts aldrig.     \\     \indent     För att tillverka en funktion som kan brytas, kan man ange villkor till en funktion. Vi börjar med att göra två funktioner, $f(x)$ och $g(x)$.\\     Antag att $f(x)=x-3$.\\     Antag att $g(x)=x+3$.\\     Vi har nu två funktioner som kommer att ge oss två parallella linjer. Nu ska vi göra en funktion som har en brytning när $x=0$. Vi använder oss av ytterligare av en funktion $h(x)$.\\     Antag att     $h(x)=f(x), \text{då } x<0$.\\     Antag att      $h(x)=g(x), \text{då } x\geq 0$\\     \indent     I dessa funktioner har vi villkor. Villkoren är det som efter 'då'.\\ $h(x)$ är alltså lika med $f(x)$ endast när $x$ har värdet $0$ eller högre.\\     För att göra det tydligare brukar man ofta skriva funktioner med villkor på det här sättet.     \\     \[         h(x)=      \begin{cases}         f(x),& \text{då } x\geq 0\\         g(x),              & \text{då } x<0     \end{cases}     \]     För att vara ännu tydligare kan man även skriva funktionen $h(x)$ genom att skriva ut funktionerna $f(x)$ och $g(x)$. Då ser det istället ut så här.\\     \[         h(x)=      \begin{cases}         x-3,& \text{då } x\geq 0\\         x+3,              & \text{då } x<0     \end{cases}     \]     \pagebreak     Grafer är ett annat sätt att visa vilket värde $h(x)$ får när $x$ antar ett visst värde. En fördel med att visa hur det ser ut grafiskt är att man får en bra översikt över vilka värden $h(x)$ får.      \\     \indent     En nackdel är att det är på många $x$ är svårt att se vilket värde $h(x)$ antar.\\     \indent     Om du tittar på \textit{graf 1} så ser du att när $x$ är heltal, är det lätt att se vilket värde $h(x)$ får. Vill du däremot veta vilket värde $h(x)$ får, när $x$ inte är ett heltal är det inte alltid enkelt att se det, genom att bara titta på en graf.           \begin{figure}     \begin{tikzpicture}[scale=1.125, >=latex]     \draw[very thin, color=black, dotted, step=1 cm] (-5,-5) grid (5,5);     \draw[->] (-5.5,0) -- (5.5,0) node[right] {\scriptsize $x$};     \draw[->] (0,-5) -- (0,5.5) node[above] {\scriptsize $h(x)$};     \foreach \x in {-5,-4,...,5} \draw (\x, 1pt) -- (\x,-3pt) node[anchor=north] {\tiny \x};     \foreach \y in {-5,-4,...,5} \draw (1pt,\y) -- (-3pt,\y) node[anchor=east] {\tiny \y};     \draw[color=red, very thick, domain=-1.9:0.0, samples=100]   plot (\x,{(\x)-3})       node[right] {\large $f(x)$};          \draw[color=green, thick, domain=0.0:2.2, samples=100]   plot (\x,{(\x)+3})         node[right] {\large $g(x)$};                    \foreach \Point in {(0,3)}{         \node at \Point {\textbullet};     }          \foreach \Point in {(0,-3)}{         \node at \Point {$\circ$};     }     \node [green] at (0,3) {\textbullet};     \node [red] at (0,-3) {$\circ$};     \end{tikzpicture}          \caption{Graf som visar funktionen $h(x)$.}     \label{fig:label}     \end{figure}     \end{document}


title: Explanation of beamer theme matrix

text: I am trying for themes given in the beamer theme matrix but when I am changing the theme of my presentation like `PaloAlto` or `CambridgeUs` it was changing accordingly but when I was trying with the `beetle` or `whale` or any of the theme given in top row of that matrix it was coming with the error as follow: > ! LaTeX Error: File `beamerthemebeetle.sty' not found. > > Type X to quit or to proceed, or enter new name. (Default extension: sty) > > Enter file name: Can anyone tell me where can be the problem ?


title: Math accents and Greek letters in glossary name (equation description)

text: I have many equations, where I need to use special characters `\dot` `\bar` and Greek letters like `\tau`. In the equation everything works nice but when I try to write the description `\mathgloss` I receive an error: `Missing \endcsname inserted \mathgloss{$\dot{b}$}{bbb}{BBB}` Below you can find my code,where I tried using `$ $` and `\ensuremath{ }` MWE:               \documentclass{report}     \usepackage{enumitem}          \usepackage{glossaries}     \makeglossaries          \newcommand{\mathgloss}[3]{%       \newglossaryentry{#1}{name={#1},description={#2},symbol={#3}}%       \begin{description}[labelwidth=3em]%        \item[\gls{#1}]#2 (\textbf{#3})%       \end{description}%     }          \begin{document}          \begin{equation}     a = \dot{b} *c(\tau)     \end{equation}     in which     \mathgloss{$\dot{b}$}{bbb}{BBB}     \mathgloss{ensuremath{c(\tau)}}{ccc}{CCC}          \printglossary[style=index]          \end{document}


title: biblatex: Switching languages for *citations* according to the bibentry's "hyphenation" field

text: Quoting from section 3.1.2.1 of the `biblatex` manual: > [The `babel`] option controls which language environment is used if the > `babel` package is loaded and a bibliography entry includes a hyphenation > field [...]. Note that `biblatex` automatically adjusts to the main document > language if `babel` is loaded. In multilingual documents, it will also > continually adjust to the current language as far as citations and the > default language of the bibliography is concerned. This option is for > switching languages on a per-entry basis within the bibliography. Suppose that, in a text with the main language "ngerman", I cite a bibentry with the hyphenation field "english". By default, the _in-text-citation_ will use the hyphenation pattern for _"ngerman"_. That is, if the citation style uses author names, titles or even full bibliographic data, hyphenation of these items is prone to be wrong. Case in point: The author William A. Fischel (an American) should be hyphenated "Fis-chel", but German hyphenation patterns will result in "Fi-schel". My current workaround is to include any such author in TeX's hyphenation exception list, but this is clumsy and error-prone for longer texts. (Manually enclosing every citation in an appropriate `otherlanguage` environment is not an option for the same reasons.) My envisaged solution is to use the "hyphenation" field to automatically switch to the correct language _in-text_ for every citekey. `biblatex` provides an `\AtEveryCitekey` hook (to be used only in the preamble), so this should be possible in principle. In the following example, I show that switching languages on a one-time basis is possible using `\AtNextCitekey`.               \documentclass{article}          \usepackage[english,ngerman]{babel}          \usepackage[style=authoryear,babel=hyphen]{biblatex}          \usepackage{filecontents}          \begin{filecontents}{\jobname.bib}     @book{Fis85,       hyphenation = {english},       author = {Fischel, William A.},       year = {1985},       title = {The economics of zoning laws: A property rights approach to American land use planning},       location = {Baltimore},       publisher = {Johns Hopkins University Press},     }     \end{filecontents}          \addbibresource{\jobname.bib}          \textwidth=290pt          % My current workaround: Include author names in the hyphenation exception list     % \hyphenation{Fis-chel}          % My envisaged solution: At every citekey, switch to the language defined in the bibentry's     %     "hyphenation" field. This doesn't work because babel strips away the escape character "\"     %     from "\thefield{hyphenation}"     % \AtEveryCitekey{\selectlanguage{\thefield{hyphenation}}}          \begin{document}          Dies hier ist ein Blindtext zum Testen von Textausgaben \autocite{Fis85}.          % The following code line shows that my envisaged solution (see above) would work if     %     "\thefield{hyphenation}" would be expanded to (in this case) "english"     %     (Note: "\AtNextCitekey" is the "one-time" variant of  "\AtEveryCitekey"     \AtNextCitekey{\selectlanguage{english}}          Dies hier ist ein Blindtext zum Testen von Textausgaben \autocite{Fis85}.          Dies hier ist ein Blindtext zum Testen von Textausgaben \autocite{Fis85}.          \printbibliography          \end{document}      So why doesn't my envisaged solution work? Trying               \AtEveryCitekey{\selectlanguage{\thefield{hyphenation}}}      results in the the following error message: > Package babel Error: You haven't defined the language thefield{hyphenation} That is, instead of expanding `\thefield{hyphenation}` to "english" (as I naively assumed), `babel` strips away away the escape character `\` from `\thefield{hyphenation}` and then complains about an unknown language. (According to section 7 of the `babel` manual, this stripping away is done for reasons of compatibility with the `german` package (which uses the syntax `\selectlanguage{\german}`.) Sifting through `biblatex.sty`, I found the following code snippet that patches internal `babel` commands. It may well reveal what needs to be done to properly expand `\thefield{hyphenation}` to "english" in my above example -- but to be honest, I have no clue what this code snippet does exactly.               \def\blx@mkbabel{%       \patchcmd\bbl@set@language         {\select@language}         {\blx@langsetup\languagename\select@language}%         {\ifdef\blx@thelangenv            {\def\blx@beglang{%               \blx@clearlang           \begingroup               \blx@imc@iffieldundef{hyphenation}                 {}                 {\blx@hook@initlang              \def\blx@endlang{%                    \blx@hook@endlang                    \csname end\blx@thelangenv\endcsname                    \endgroup}%                  \csname\blx@thelangenv\expandafter\endcsname                    \expandafter{\abx@field@hyphenation}}}}            {}%          \blx@langsetup\bbl@main@language}         {\blx@err@patch{'babel' package}%          \blx@mknobabel}}      Long story, short question: How can I make my envisaged solution work, i.e. automatically switch languages for _citations_ according to the bibentry's "hyphenation" field?


title: captionof increases count by 2

text: I face a similiar problem like the one described here. I created a command that will output a caption besides an image (in this example replaced by simple text).               \documentclass[a4paper,12pt]{scrartcl}      \usepackage[ngerman]{babel}         \usepackage[T1]{fontenc}            \usepackage[utf8]{inputenc}      \usepackage{graphicx}     \usepackage{vwcol}       \usepackage{caption}          \captionsetup{format=plain,width=0.7\textwidth}          \begin{document}     \newcommand{\yasfig}[3]     {\begin{vwcol}[widths={0.3,0.7},      sep=.8cm, justify=flush,rule=0pt,indent=0em]     #1          \begin{minipage}{0.68\linewidth}     \captionof{figure}{#2}     \label{#3}     \end{minipage}     \end{vwcol}}          \yasfig{Gel}{Bla}{fig:Gel}     \yasfig{Blot}{Bla}{fig:Blot}          \end{document}      This will output the desired layout but increase the figure count by 2 each time the command is called. I'm guessing it has something to do with the minipage but I'm at a loss here.


title: Package PGF Math Error: Unknown operator `o' or `of'

text: I am getting a weird error while trying to place a node above another node using the `below=` syntax.               \documentclass{article}     \usepackage{tikz}     \begin{document}     \begin{tikzpicture}       \node[] (node1) at (0, 0) {Node 1};       \node[         below = 5pt of node1       ] (node2) {Node 2};     \end{tikzpicture}     \end{document}      The error message is:               Package PGF Math Error: Unknown operator 'o' or 'of' (in '5pt of node1').      How can I place nodes in relation to other nodes without getting an error message?


title: amsart, setspace, and footnotes

text: When I use the `setspace` package in an `amsart` document, the indentation of footnotes is messed up: the first-line indent is lost, with everything pushed to the left. Sample document:               \documentclass{amsart}     \usepackage{setspace}     \begin{document}     Hello.\footnote{There.}     \end{document}      Compare the placement of the footnote text when the second line is included vs. excluded. This does not occur in the `article` class, for which the inclusion of `setspace` appears to make no difference. I experience the issue on both MacTeX (from MacPorts) on Max OS 10.6, and on MikTeX on a Windows XP machine. How can I keep `setspace` from messing up the footnote indentation when using `amsart`?


title: Grouping objects and applying operation to the group

text: Forgive me for my perhaps naive questions, I am beginning to discover Tikz potentials. To ease certain operations as moving objects or transforming them, I want to know if there is a mechanism in Tikz that I can group certain operations and give a name to this grouping and use that name in doing operations on the whole collection of objects that are grouped. My first guess was perhaps **scope** will do this. But could not see how I can refer collectively to the scoped operations and/or objects. The best analogy, for give me to mention it, is the grouping operation in Power Point. Thanks for your help. Artimess


title: How can I completely suppress ligatures?

text: The `microtype` package allows to completely suppress ligatures. However, this feature requires pdfTeX 1.30 or newer. That's unfortunate if I'm using LaTeX or XeLaTeX while having to avoid ligatures. Is there any other way to disable ligatures for a complete document or just an environment?


title: Can LuaTeX do something to alter linebreaks inside math inline automatically?

text: This is kind of a follow up to this question. Consider the sample code:               \documentclass{minimal}     \begin{document}     A text with an inline equation which is broken in to two parts     but is not wanted right here $v_{initial} = 11111$.     \end{document}      Without any modification, `TeX` splits the inline formula after the `=` sign. One can modify the code adding braces around the content of the inline math: `${v_{initial} = 11111}$`, then `TeX` does not split the formula, thus it runs in the right margin and `TeX` complains with an `overfull box`. Now comes `LuaTeX` and its callback that can alter the paragraph building algorithm (`post_linebreak_filter`). Would it be possible to add some lua code, triggered when `TeX` enters an inline math expression, that would see that   * `11111` is "too" short to come up alone in the next line   * `v_{initial}` is not that "long" so it could be pushed to the next line without leaving "too much" blank on the line   * and that it would be worth adding some glue _before_ the inline math so that the whole inline math would be at the beginning of the second line?


title: PDF hyperlinks to a given page.

text: I would like a command that takes two arguments: a page number and a block of text. I would like the command to create a PDF hyperlink around the text that will jump to the given page. I see that the undocumented `\hyperpage{}` command from the hyperref package will create a link to the given page, however, I don't see how it can be used to make a link for arbitrary text. I took a look at the underlying code in hyperref.sty but I can't really figure it out. I do realize that I could use `\hyperlink{}{}`, but that requires I put a `\hypertarget{}{}` on each of the pages to be linked. In my case, I only know the numerical number of the page to be linked.


title: How can I give active characters definitions with expl3?

text: It's very much glossed over in `texdoc interface3`…               \documentclass{article}     \usepackage{xparse}     \ExplSyntaxOn     \NewDocumentCommand \Digits { m m }{       \group_begin:         \char_set_catcode_active:N ;         \char_set_catcode_active:N .              \def;{,\;}         \def.{\dots}              \langle #1 \rangle \sb #2       \group_end:     }     \ExplSyntaxOff          \begin{document}     Desired syntax:       $\Digits{1,2,3;4,5,6;.;,7}{8}$          Desired output:       $\langle 1,2,3, \; 4,5,6, \; \dots, \; 7 \rangle_8$     \end{document}      I will be doing fancy things with the comma list at a later point (using `l3clist`), but I'd like to get this syntax working first. I imagined that this should work based on the UK TeX FAQ article, but I keep getting the following error: > >     ERROR: Missing control sequence inserted. >   >     --- TeX said --- >     <inserted text> >                     \inaccessible >     l.18 $\Digits{1,2,3;4,5,6;.;,7}{8} >                                       $ >     --- HELP --- >     This is probably caused by a \newcommand, \renewcommand, \newlength, >     or \newsavebox command whose first argument is not a command name. >   * * * Per cgnieder's comment, perhaps the following approach would work:               \NewDocumentCommand \Digits { s m m } {       \group_begin:         \seq_set_split:Nnn           \l_digit_seq           { #2 }           { \IfBooleanTF { #1 } { } { , } }              \char_set_catcode_active:N ;         \char_set_catcode_active:N .              \def;{,\;}         \def.{\dots}              \real_digits:nn     }          \cs_new:Npn \real_digits:nn #1 #2 {       \langle #1 \rangle \sb #2       \group_end:     }     \ExplSyntaxOff      but alas, it does not.


title: More layers of sectioning in article class

text: I'm using LaTeX for a university assignment and my professor has some strange formatting rules: There are 7 layers of sectioning, which all have to appear in the table of contents. This is more then I can archive with `\section`, `\subsection`, `\subsubsection`, `\paragraph` and `\subparagraph`. Is there a way to define new commands to add new sectioning layers? The counting of the sections is also quite unusal: A. I. 1. a) aa) (1) (a) So, it's capital letters, roman numbers, numbers, letters, double letters, numbers in brackets and letters in brackets. Can anybody help me out on this?


title: \ifnum conflict with appendix

text: Was helped briliantly before, here's another small problem I do not get fixed: Using the fancyhdr package I get, as promised, fancy headers. However, a chapter in the frontmatter gets a 0. Chaptername and the Table of Contents simply Table of Contents. So, the aim is to get rid of everything with a zero in my make-up. I redefine the chaptermark command as follows:               \renewcommand{\chaptermark}[1]{\markboth{ \ifnum\thechapter>0 \thechapter.\space\fi #1}{}}}      But having Appendices, numbered A, B, C etc. this gives an error as follows: > `Missing number, treated as zero.` Well, to be expected. How to solve this decently?


title: Printing the bibliography heading in uppercase but showing it as sentence case in the ToC

text: At my class I am supposed to write a report where the chapter headings are always in uppercase, but have to printed in sentence case in the table of contents. For regular chapters I have achieved this by using               \chapter*{EXAMPLE}     \addcontentsline{toc}{chapter}{Example}      but I cannot figure out how to achieve the same result for the bibliography. I have used               \renewcommand\bibname{REFERENCES}     \addcontentsline{toc}{chapter}{References}      but then the bibliography heading is printed twice in the table of contents. Is there any way to force the table of contents to print the references heading once? Here is the preamble for the document               \documentclass[a4paper, 12pt]{report}      \usepackage{apacite}     \usepackage{graphicx}     \usepackage{anysize}     \usepackage{setspace}     \usepackage{lscape}     \usepackage{parskip}     \usepackage{float}     \usepackage[utf8]{inputenc}     \usepackage{url}     \usepackage{times}


title: Beamer themes and bidi problems

text: I'm trying to write a Hebrew beamer presentation. I found some very nice template that actually worked from the box (which you can find in this very link, source and author's compiled output) but there are two problems, where my compiled output disagrees with the above:   1. The first is that the list is flushed to the left (even if it aligned to the right), and this doesn't change even if I enclose it in a `flushright` environment.   2. The theorem (second frame) shows up with the title "Theorem" or its Hebrew counterpart defined there. Regardless to any modification and removal of words. However, if I disable the theme (`Warsaw`, and other similar to it) then it works out just peachy (It also works with `Hannover`-like themes). But there is no box to contain the theorem as usual. Is there an easy way to overcome this (except not preparing Hebrew presentations with Beamer)? If it's any relevance, I'm using Arch Linux and texlive; but the problem persists on my Windows 8.1 tablet with MiKTeX (latest). * * * I managed to correct the second issue by using the `Rochester` theme. But I'd like to understand how this can be solved for other themes like the `Warsaw` theme. The first issue is somewhat more adamant.


title: String test, with complicated arguments

text: I have a command `\mycom{}` which takes 1 argument. The command should perform a test on the argument and do something accordingly. For simple arguments, I can use `\ifthenelse`, but I need to consider more general arguments, e.g. containing commands or environments. The following MWE follows a solution for a more robust string test, which was given in this post:               \documentclass{article}     \makeatletter     \newcommand{\strtest}[2]{%     \ifnum\pdfstrcmp{#1}{#2}=\z@       \expandafter\@firstoftwo     \else       \expandafter\@secondoftwo     \fi}     \makeatother          \newcommand{\mycom}[1]{%     \strtest{#1}{}%     {content :  empty}%     {content : #1}%     }          \begin{document}     \mycom{}          \mycom{coucou}     \end{document}      This works. But if i try to call `\mycom{\textbf{coucou}}`, then the compilation fails.


title: How BibTeX reads the aux file

text: Is it possible to control how BibTeX reads the aux file? As far as I know, BibTeX reads the citation keys used in a document via the `\citation` commands in the aux file(s). I want BibTeX to extract from the aux file other information that can be used by the bst file. The aim is to customize each instance of `\cite`, so that how an item appears in the bibliography not only depends on what the citation key is, but can also depend on how it was `\cite`d in the document. There may be other (dirtier?) ways to achieve this aim, but (for me) it is interesting to know whether this particular way is possible.


title: How can I draw an ellipse with a rainbow color?

text: I need to draw a rainbow-colored (hue colormap) ellipse in tikz. Something like this but then in an ellipse shape, and in tikz. I've thought about drawing to ellipses, one with rainbox filling, the other white, but I don't know how to fill a shape with a rainbow. I have looked at questions relating to paths and colormaps, but that won't do unless I really split the ellipse in many parts, which seems like it could be done a lot easier.


title: Incorrect page number position on ToC page 2 only

text: I am having an issue where my Table of Contents is so long that it goes onto a second page, but the page number then mysteriously jumps from the bottom center of the page to the upper right corner for JUST the second page of my ToC. I can't have just that one page's number there. It needs to be in the bottom center like the others. The biggest issue that I have is that I have to use a unique document class type for my university's thesis requirements. This is the section of the code from that class' document about the toc.               \def\tableofcontents{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn      \fi\chapter*{\centerline{Table of Contents}      \@mkboth{TABLE OF CONTENTS}{TABLE OF CONTENTS}}     % \contentsline{chapter}{\underline{Section}}{\underline{Page}}      \@starttoc{toc}\if@restonecol\twocolumn\fi}      My actual thesis document code simply looks like this:               \pagenumbering{roman}%%% Begin Roman Numeral Numbering     \include{MyAbstract}%Abstract Page     \newpage     \tableofcontents % Table of Contents Page      Why is it suddenly doing this for only the second page of the ToC?


title: Plot a square grid with a subset of squares marked using pgfplots

text: Recently I have discovered pgfplots and I am impressed by the capabilities of this package. There is however one type of plots which I cannot figure out how to define conveniently using pgfplots. Basically I would like to plot a square grid with a subset of squares marked (I'm sorry, as a new user I'm not allowed to post images). I am aware that I can follow/modify the example from the manual in which a closed shape is drawn:               % Preamble: \pgfplotsset{width=7cm,compat=1.6}     \begin{tikzpicture}     \begin{axis}     \addplot+[fill] coordinates     {(0,1) (1,2) (0,3) (-1,2)} --cycle;     \end{axis}     \end{tikzpicture}      But I'm wondering - is it possible to define such plot passing only the **integer coordinates of squares** to mark, rather than lists of four precise corners of each square?


title: Table reference not compiling correctly

text: I'm hoping for some guidance on why LaTeX isn't properly referencing this table.               \begin{table}[ht]      \caption*{Table 2 \\ Number and Percentage}\label{tab:table2}      \centering     \begin{tabular}{rrrrrr}     \hline      & \# & \# & \# & \% & \% \\        \hline       A  & 446 & 105 & 42 & 23.54 & 9.42 \\        B  & 389 & 6 & 69 & 1.54 & 17.74 \\        C  & 355 & 8 & 79 & 2.25 & 22.25 \\        D  & 343 & 21 & 107 & 6.12 & 31.20 \\        \hline     \end{tabular}     \end{table}          In Table~\ref{tab:table2} ...      I've tried compiling multiple times and moving the label inside the caption, but neither of those has worked; I still get "In Table ??" as output. Why might this be happening? Thanks for any help!


title: Installing TexLive with custom-maked binaries

text: I'm going to install TexLive2014 with my own-compiled binaries (with shared libs). # 0\. I have read this:               https://www.tug.org/texlive/doc/tlbuild.html     https://www.tug.org/texlive/build.html     https://tug.org/texlive/doc/texlive-en/texlive-en.html     http://www.linuxfromscratch.org/blfs/view/svn/pst/texlive.html      # 1\. Build binaries: In sources dir:               > $ mkdir Work && cd Work $ ../configure \     > --prefix=/opt/texlive/2014 \     > --bindir=/opt/texlive/2014/bin/custom \     > --datarootdir=/opt/texlive/2014 \     > --includedir=/usr/include \     > --infodir=/opt/texlive/2014/texmf-dist/doc/info \     > --libdir=/usr/lib \     > --mandir=/opt/texlive/2014/texmf-dist/doc/man \     > --disable-native-texlive-build \     > --disable-static \     > --enable-shared \     > --with-system-libgs \     > --with-system-poppler \     > --with-system-freetype2 \     > --with-system-fontconfig \     > --with-system-libpng \     > --with-system-icu \     > --with-system-graphite2 \     > --with-system-harfbuzz \     > --with-system-xpdf \     > --with-system-cairo \     > --with-system-pixman \     > --with-system-zlib \     > --with-banner-add=" - shared"      > $ make      > $ make check      > $ make install      At the end of this I was taking binaries in /opt/texlive/2014/bin/custom and some files around there (in texmf-dist). # 2\. Install TexLive dist (tree): In untarred dist dir:               $ ./install-tl -custom-bin /opt/texlive/2014/bin/custom/      (As I understand that will install full tree of TexLive using my pre-installed binaries for 'custom' platform.) Than add '/opt/texlive/2014/bin/custom' to my $PATH and '/opt/texlive/2014/texmf-dist/doc/info' to $INFOPATH, '/opt/texlive/2014/texmf-dist/doc/man' to $MANPATH.               $ fmtutil-sys --all     $ updmap-sys      # ?. Questions:   * Is key '-custom-bin' tells to installer that it should using bins in this directory directly or should copying them?   * There are no some additional executables (maybe scripts? or/and symlinks?) in bin directory, so some commands (such as 'latex', 'pdflatex') not found. Where it is and how to install it?   * Installer script installed another copy of manpages to bin/custom/man directory. Is it differs of manpages that comes with own-making binaries? How to prevent of install these mans correctly ( _perfectionism style_ )?   * Any comments to my sequence?


title: compiler complains about apacite

text: I use the following packages in my document:               \documentclass[a4paper,12pt,twoside,BCOR=10mm]{scrbook}     % Packages     \usepackage{ucs}     \usepackage[utf8x]{inputenc}     \usepackage[icelandic, english]{babel}     \usepackage{t1enc}     \usepackage{graphicx}     \usepackage[intoc]{nomencl}     \usepackage{enumerate,color}     \usepackage{url}     \usepackage[pdfborder={0 0 0}]{hyperref}     \usepackage{appendix}     \usepackage{eso-pic}     \usepackage{amsmath}     \usepackage{amssymb}     \usepackage[nottoc]{tocbibind}     \usepackage[sort&compress,authoryear]{natbib}     \usepackage[sf,normalsize]{subfigure}     \usepackage[format=plain,labelformat=simple,labelsep=colon]{caption}     \usepackage{placeins}     \usepackage{tabularx}     % Configurations     \graphicspath{{figs/}}      When I add               \usepackage{apacite}      I get a bunch of errors, starting with:               ! Undefined control sequence.     l.1203 \st@rtbibchapter      Note that apacite should be correctly included in my system as I use it without problems on another document. Do you have any idea where is the problem?


title: Place chapter numbers in the margin and center chapter titles

text: This is follow up question from Section Numbering in "Convex Optimizaion" by Boyd et. al. with Koma Script. Is it possible, using the `scrbook` class, to place the chapter (section) numbers in the margin and center the chapter (section) titles?


title: Delete .aux file in order to successfully compile

text: From time to time I need to prepare presentations, and I use the `beamer` class plus the `minted` package. I would like to know why sometimes I need to delete the `aux` file generated by `pdflatex` to successfully compile. Is there any additional step aside from invoking `pdflatex`?


title: How do I install context modules in the ubuntu distribution of ConTeXt

text: Tonight, right before I started trying to compile my dissertation, ConTeXt ate itself. I have determined that the maintained version of ConTeXt in the ubuntu distribution is of appropriate vintage to probably work. My only problem is that I use the "simplefonts" module and I'm not sure how to install it within the ubuntu context. What mechanisms exist for adding third party modules to this distribution of ConTeXt?


title: Hyphenatable material enclosed in group braces

text: I have text that I need to repeat quite a few times:               \newcommand{\repeatme}{text to repeat that is somewhat long and verbose}      I'd like to underline this text and have it not cause hbox overflow errors. Thus I try (using the soul package, as if I use ulem or underline it'll hbox):               Blah blah blah, \ul{\repeatme}      This gives this error:               I came across hyphenatable material enclosed in group braces,     which I can't handle. Either drop the braces or make the material     unbreakable using an \mbox (\hbox). Note that a space     also counts as possible hyphenation point. See page 4 of the manual.      My current workaround is this:               \newcommand{\repeatmeul}{\ul{text to repeat that is somewhat long and verbose}}      and               Blah blah blah, \repeatmeul      But that fails... wrong. Surely there's a more elegant way!


title: Possible values for \fontseries and \fontshape

text: What are the possible values for `\fontseries` and `\fontshape`? I'm aware of               \fontseries{m}     \fontseries{bx}          \fontshape{n}     \fontshape{it}      But I'm sure there're more of them.


title: How to set two backgrounds?

text: `background` package defines a background with absolute position in preamble, but how to set two independent backgrounds at different positions? Consider we have two backgrounds as               \SetBgColor{red}     \SetBgPosition{0,0}     \SetBgContents{content1}          \SetBgColor{blue}     \SetBgPosition{1cm,5cm}     \SetBgContents{content2}


title: How do I include labels using Tikz's fit?

text: I'm creating a graph using TikZ. It's working fine, but when I try to use the `fit` to make a background, it's not quite large enough: ![](http://i.stack.imgur.com/AhGJN.png) Notice that the green doesn't cover the labels Gateway and Root. I figure that if there's a way to reference the node's labels (similar to the way I can do `node.north`, etc), that should work. Here's the code I'm using:               \usepackage{tikz}     \usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri}          \begin{tikzpicture}         [gateway/.style={circle, fill=blue!20!white, draw=blue, thick, inner sep=0pt,                          minimum size=6mm, label=below:Gateway},          root/.style={circle, fill=red!20!white, draw=red, thick, inner sep=0pt,                       minimum size=6mm, label=below:Root},          node/.style={circle, fill=gray!20!white, draw=gray, thick, inner sep=0pt,                       minimum size=6mm, label=below:Node},          every edge/.style={<->, semithick, draw},           ]         \node[gateway] (gateway_1) at ( 0, 0) {};         \node[root]    (root_1)    at (10, 0) {};         \node[node]    (node_1)    at ( 5, 5) {}              edge node [auto] {connect} (root_1)              edge (gateway_1);              \begin{pgfonlayer}{background}             \node [fill=green!20!white, fit=(gateway_1) (root_1) (node_1)]{};         \end{pgfonlayer}     \end{tikzpicture}      So of course as the title says, how do I include the labels in the background? Thanks!


title: ngerman.sty not found

text: Whenever I try to compile my `.tex` file, I get the following error: > ! LaTeX Error: File `ngerman.sty` not found. Type `X` to quit or to proceed, > or enter new name. (Default extension: `sty`) Enter file name: ! Emergency > stop. l.3 `\begin` Here's a MWE:               \documentclass[a4paper,12pt]{article}     \usepackage{ngerman}     \begin{document}     xyz     \end{document}      This happens even though the `ngerman.sty` package can be found in the following directories:   * `/usr/share/texlive/texmf/tex/latex`   * `/usr/share/texmf/tex/latex` I also tried running the `texhash` command.


title: How to align mdframed inside another frame?

text: I tried to create a child frame inside a parent frame by `mdframed` as               \documentclass{article}     \usepackage{mdframed}     \usepackage{lipsum}          \begin{document}          \begin{mdframed}[frametitlerule=true,frametitlerulewidth=1pt,frametitle=Parent]     \begin{mdframed}[frametitlerule=true,frametitlerulewidth=1pt,userdefinedwidth=150pt,align=right,frametitle=Child]     \lipsum[1]     \end{mdframed}     \lipsum     \end{mdframed}          \end{document}      ![enter image description here](http://i.stack.imgur.com/aLktm.png) **Question1:** How to wrap text around the child frame? Filling the empty space on the left with the text of parent frame. **Question2:** The child frame title will conquer the parent frame title. Thus, we will not have the parent frame title, but an induced copy of the child frame title. How to keep the frame titles independently?


title: Trouble aligning partial header in table

text: I want the "n" to be centered over the 50? How can I achieve this?                 \begin{tabular}{lccc}         \hline         \multicolumn{4}{c}{Condition Numbers} \\         \multicolumn{3}{r}{n} \\         Correlation Structure    & 30 & 50 & 100 \\         \hline         Gnat                     & per gram    & 13.65     & 100    \\                                  & each        & 0.01      & 100  \\          Gnu                      & stuffed     & 92.50      & 100 \\         Emu                      & stuffed     & 33.33      & 100\\         Armadillo                & frozen      & 8.99       & 100\\         \hline       \end{tabular}


title: Block quote with big quotation marks and opening quote on bottom

text: I wanted to adapt Block quote with big quotation marks to languages like my natural language German, but also some other mainly Germanic and Slavic languages (c.f. Wikipedia: Non-English usage of quotation marks), where the opening quote is placed on the bottom. Based on Andrew Stacey’s answer there and Werner Grundlingh’s idea for the quote signs in How do you create pull quotes? I came to the solution shown below. My question is:   How can I improve this code? As it stands, all amounts have to be changed on a font change, and there is sometimes manual correction necessary, that must be found empiric; to see some strange effects, comment out the optional values for the `question` environment below _(this is not related to the use of`\blindtext`; I had this also in real use cases and this was in fact the cause for introducing the correction value)_. Also the amount for shifting in `above` and `below` keys must be different. And at least the opening quote seems not to be placed exactly the same allways, cf. the first and second example. Perhaps you also have an idea based on a different approach. For instance maybe there is a way with `mdframed`, since I use it anyway? The name for the environment comes from the fact, that the original use is only for questions.               \documentclass{article}          \usepackage[T1]{fontenc}     \usepackage[utf8]{inputenc}          \usepackage{kpfonts}% package with fonts of Kepler project     % loads also package "textcomp"          \usepackage[ngerman]{babel}% new German spelling          \usepackage[svgnames]{xcolor}       \definecolor{framecolor}{named}{SteelBlue}       \colorlet{framebgcolor}{PowderBlue!50!White}       \definecolor{quotesignclr}{named}{LightSlateGrey}          \usepackage{changepage}% not needed with "memoir" and KOMA-Script classes or package "scrextend"          \usepackage{calc,etoolbox,environ,graphicx}          \usepackage[pangram]{blindtext}% for dummy text, needs "babel"          \usepackage{showframe}% just for showing the text margins          \usepackage{tikz}       \usetikzlibrary{backgrounds,positioning}          % based on answer of Andrew Stacey in http://tex.stackexchange.com/a/28418/9237     % model for quotes: Werner Grundlingh in http://tex.stackexchange.com/a/45828/9237     \newlength{\bodywidth}     \newlength{\testwidth}     \newlength{\nodewidth}     \newcommand*{\openingquote}{\llap{\smash{\makebox[1em][r]{\quotedblbase\hspace*{0.1em}}}}}     \newcommand*{\closingquote}{\rlap{\smash{\makebox[1em][l]{\hspace*{0.1em}\textquotedblleft}}}}     %-----%     \NewEnviron{question}[1][0pt]%     {\begingroup     \settowidth{\bodywidth}{\itshape\BODY}     \setlength{\testwidth}{2.5em+0.6pt+\bodywidth}% 2.5em = 2*inner frame xsep;                                                   % 0.6pt = 2*line width+2*inner sep     \begin{adjustwidth}{3em}{3em}% with KOMA-Script use environment "addmargin" instead     \ifdimcomp{\testwidth}{<}{\linewidth}% "\ifdimcomp" provided by "etoolbox"       %true:       {\setlength{\nodewidth}{\bodywidth}\addtolength{\nodewidth}{-#1}}%       %false:       {\setlength{\nodewidth}{\linewidth}\addtolength{\nodewidth}{-2.5em-0.6pt-#1}}     \begin{tikzpicture}         [background rectangle/.style={draw=framecolor,line width=0.2pt,fill=framebgcolor,rounded corners},          show background rectangle,inner frame xsep=1.25em,inner frame ysep=0.5em]     % body text       \node[text width=\nodewidth ,align=justify,inner sep=0.1pt] (TXT) {\itshape\BODY};     % opening quote       \node[overlay,scale=2,text=quotesignclr,inner sep=0.1pt,above=0.25ex of TXT.south west]            (OpQ) {\openingquote};     %closing quote       \node[overlay,scale=2,text=quotesignclr,inner sep=0.1pt,below=2.75ex of TXT.north east]            (ClQ) {\closingquote};     \end{tikzpicture}     \end{adjustwidth}}[\endgroup]          \begin{document}          % German quote signs --> German dummy text          \begin{question}     % text is extracted from package "blindtext"     Dies hier ist ein Blindtext zum Testen von Textausgaben.     Wer diesen Text liest, ist selbst schuld.     \end{question}          \begin{question}     \blindtext[1]     \end{question}          \begin{question}[-0.7em]     \blindtext[1]     \end{question}          \begin{question}[-5em]     \blindtext[1]     \end{question}          \begin{question}     \blindtext[1]     \end{question}          \begin{question}[10.6em]     \blindtext[1]     \end{question}          \end{document}


title: How to reformat Algorithm in memoir document class?

text: I'm trying to typeset algorithms in the memoir class. I'm using the algorithmic package with a custom environment as this was the only way I could get the list of algorithm to display correctly in the table of content, and the algorithm to be listed correctly in the list algorithms. As shown in the following images, ![table of content correct](http://i.stack.imgur.com/3mHJ2.png) ![list of algorithms correct](http://i.stack.imgur.com/MjPKY.png) Currently the algorithm is displayed as follows, ![algorithm display](http://i.stack.imgur.com/HCPmq.png) How to I reformat the algorithms environment to look more like the following? ![example one](http://i.stack.imgur.com/11XiB.png) ![example two](http://i.stack.imgur.com/pOc6l.jpg) I don’t need the exact formatting, just something more professional. I would ideally like line numbering, the vertical lines, the horizontal lines, and some form of left and right indentation that is less than the text width. My current code is,               \documentclass[]{memoir}     \usepackage[utf8x]{inputenc}     \usepackage{amssymb}     \usepackage{amsmath}     \usepackage{amsfonts}     \usepackage{algorithmic}          \newcommand{\algorithmname}{Algorithm}     \newcommand{\listalgorithmname}{List of Algorithms} \newlistof{listofalgorithms}{loa}{\listalgorithmname}     \newfloat{algorithm}{loa}{\algorithmname}     \newfixedcaption{\falgcaption}{algorithm}     \newlistentry{algorithm}{loa}{0}          \begin{document}     \tableofcontents     \newpage     \listoffigures     \listoftables     \listofalgorithms          \newpage     \chapter{Example Chapter}     \section{Example Section}          \begin{algorithm}[htbp]     \hrulefill     \caption{An Algorithm Template}     \label{alg1}     \hrulefill     \begin{algorithmic}     \REQUIRE $n \geq 0$     \ENSURE $y = x^n$      \STATE $y \leftarrow 1$     \STATE $X \leftarrow x$     \STATE $N \leftarrow n$      \WHILE{$N \neq 0$}      \IF{$N$ is even}     \STATE $X \leftarrow X \times X$     \STATE $N \leftarrow N / 2$     \ELSE[$N$ is odd]      \STATE $y \leftarrow y \times X$     \STATE $N \leftarrow N - 1$     \ENDIF     \ENDWHILE     \end{algorithmic}     \hrulefill     \end{algorithm}     \end{document}


title: Make \chapter* same as unnumbered \chapter (using memoir) ?

text: I'm producing a book, using the `memoir` class. The book has numbered chapters 1-8, but also has a chapter before ("Introduction") and a chapter after ("Conclusion"). These are all in the main matter; I mean there are also other unnumbered chapter-level sections in front- (Acknowledgements) and back-matter (Endnotes and Index). I thought it would be simple to use `\chapter*` for Introduction and Conclusion, and use `\chapter` for chapters 1-8. Not so... it seems the numbering part is not the only difference. Does anyone know of all the differences and what is needed to make them equivalent? So far I've found:   1. chapter titles do not appear in table of contents. Solution: after `\chapter*`, add `\addcontentsline`   2. footnote numbers (pagenote in this case) do not reset to 1. Solution: ???   3. heading text (`\createmark{chapter}...`) not being updated. Solution: ??? Any other suprpises that I'll find out later ? Alternative, any other approach to tackle the problem would be welcome.


title: Long Division with Boxes

text: I need to make a division worksheet for a specific student with ADHD. He often gets confused with the placement of the digits so this worksheet has to have boxes aligned in a very precise way. There are no available printed worksheets out there that have what I need. I've tried out a code for long division with boxes on my own, but it does not give me the desired image. I need to create an image similar to the one below with horizontal lines and minus signs. ![enter image description here](http://i.stack.imgur.com/U6Vv5.jpg) I tried so far:               \documentclass[11pt]{article}     \begin{document}     \newcommand\divspace{\,}     \[ \arraycolsep=0em     \begin{array}{r@{\divspace}c@{\divspace}lllll}            &       & \multicolumn{1}{r}{15} &  \\ \cline{2-6}         15 & \big) & \multicolumn{4}{l}{225}          &  \\            &       & \fbox{1} \fbox{5}      &   &  &  &  \\ \cline{3-4}            &       & \fbox{7}\fbox{5}       &   &  &  \\            &       & \fbox{7}\fbox{5}       &   &  &  \\ \cline{3-5}            &       &                        & 0 &  &  \\     \end{array}     \]     \end{document}


title: Why does natbib conflict with sbc.bst?

text: I'm always loading the package sbc-template. When I load `natbib` and use bibliography style `apalike`, no problem; when I use style `sbc` instead, compilation crashes. How to fix this? `Apalike` is pretty OK to me, but I unfortunately need to submit the paper with bibliography style `sbc` ... MWE:               \documentclass[12pt]{article}     \usepackage{sbc-template}     \usepackage[utf8]{inputenc}     \usepackage{graphicx,url}     \usepackage{natbib}         \sloppy         \begin{document}         \section{Section}     \cite{author2013test}          \bibliographystyle{sbc}     \bibliography{bib}          \end{document}      URL for template and style: http://www.sbc.org.br/index.php?option=com_jdownloads&Itemid=195&task=view.download&catid=32&cid=38 Sample bib file:               @BOOK{author2013test,       title = {Title},       publisher = {Publisher},       year = {2013},       author = {Author}     }      Ps: I'm sorry if it _looks_ too much... I don't know to how to (or if possible to) upload a MWE with all files needed (beginner in the forum here :)


title: dialogue environment beginning with \direct fails

text: I am using the `dialogue` environment, and I want to start a dialogue with a setting, using the `\direct` command. However, the following code does not compile:               \documentclass{article}          \usepackage{dialogue}          \begin{document}          \begin{dialogue}       \direct{This is a setting.}            \speak{John Doe} I am speaking.     \end{dialogue}          \end{document}      I get the following error message:               ! LaTeX Error: Something's wrong--perhaps a missing \item.          ....          l.10 \speak{John Doe}                              I am speaking.      This doesn't happen when I start with `\speak`. What should I do to get around this apparent bug in the package?


title: How to draw a many edges loop above - tikz

text: im try to draw many edges loop above in the same node, i have writing :               \documentclass{report}     \usepackage{tikz}     \usetikzlibrary{arrows,positioning,automata,shadows,fit,shapes}          \begin{document}          \begin{tikzpicture}[shorten >=1pt, auto,thick,initial text=,minimum size=0pt]     \node[state, accepting]            (0)                          {0};           \path[->]      (0)  edge  [loop above]    node      {$a:\varepsilon | 1$}   ();          \end{tikzpicture}      \end{document}      i want some thing like this (the picture is not pretty ): ![enter image description here](http://i.stack.imgur.com/cV9Hs.png)


title: How to label a code section in Sweave

text: I'm new to sweave and was wondering what is the appropriate way to label a code section. For example, if I have:               <<echo= true>>=     x<-5     y<-x+5     @      How would I get it to put a either above it or below it, with something like "Code Example 1". I would like something similar to how you can label figures or tables in LaTeX.


title: Using amsart, make running heads title of the current section?

text: Using the `amsart` document class, how can I replace all the running heads with the title of the current section? Is there a way to do this natively in the class, or am I looking at needing `fancyhdr`, or something? What even is the command which fills in the name of the current section, and is it available in `amsart`? Thanks so much.


title: Backreferences for equations

text: I'd like to put a list of pages, hyperlinked to the position of the `\eqref` or `\cref` that point to it in the margin of each `\label`ed equation, like `backref` does for bibliographies and `\cite`. Both this answer for `\ref` and this one for a figure list don't support `hyperref` links, deduplication and ranges like `backref`. ( _Edit:_ see below and first comment, turns out to not be that hard). _Edit:_ so my main problem is displaying text in the margin next to an equation's tag. _Edit 2:_ posted my current solution as an answer _Edit 3:_ It doesn't work with `cleveref` because that patches `\label{X}` in a way that `\df@label` now contains `{X}` instead of just `X` as before which breaks `\refsto`. No idea how that happens, or how I could remove the `{}`. _Edit 4:_ actually it's when `amsmath` is loaded before `cleverref`. But it must be loaded before, because `\cref` can't be used to refer to equations otherwise. _Edit 5:_ found a way to remove `{}` if present, is there a builtin command for this?               \def\maybeWithBraces{foo} % this     \def\maybeWithBraces{{foo}} % or this     \def\@identity#1{#1}     \def\@@identity#1{\@identity#1}     \edef\withoutBraces{\expandafter\@@identity\maybeWithBraces}     % \withoutBraces→foo in both cases.


title: Chapter title in TOC on two lines when using \addcontentsline

text: I am having a problem when adding an unnumbered chapter to the TOC. The section in question is the list of symbols which is in the preliminary pages, before the beginning of the Introduction. The chapter is (title is in french) :               \chapter*{Liste des symboles}     \addcontentsline{toc}{chapter}{Liste des symboles}     My list of symbols here      Now the problem I face is that the title of the chapter appears incorrectly. It appears on two lines like this:   L........................................i   ste des symboles...........viii Note : the i on the right is actually from the title and not the pages. Also, the title should have been all CAPS given the definition in the document class (all other chapter titles/introduction/conclusion appear in CAPS in the TOC. I think the root of my problem might be the fact that the chapters in the TOC are formatted to appear on two lines :   CHAPITRE I   CHAPTER TITLE.................5 but I want the list of symbols to appear on one line like the introduction and cocnlusion:   INTRODUCTION...................1 I tried including it in the full document :               \documentclass[11pt,oneside]{memoireuqam1.3}     \usepackage{graphicx}     \usepackage[french]{babel}     \usepackage[utf8]{inputenc}     \usepackage{amsmath}     \usepackage{float}     \usepackage{array}     \usepackage{multirow}      \usepackage{booktabs}     \usepackage{setspace}     \usepackage{xparse}     \NewDocumentCommand{\rot}{O{90} O{1em} m}{\makebox[#2][l]{\rotatebox{#1}{#3}}}          \begin{document}     \nocite{*}     \pagenumbering{roman}      \addtocounter{page}{1}          \include{thanks}     \tableofcontents     \listoffigures     \listoftables     \parindent=0ex     \include{symbols} %%%%%%%%%%%%%problem section%%%%%%%     \include{abstract}          \parindent=0ex           \include{Introduction}     \include{chapt1}     \include{chapt2}     \include{chapt3}     \include{conclusion}              \bibliographystyle{theseuqam}         \bibliography{biblio}          \end{document}      I am using a class provided by my university for the master's thesis (http://www.labmath.uqam.ca/latex/telecharger.php). Copied below is the part relevant to the TOC :               \newcommand\l@specialchapitre {\@dottedtocline{1}{0em}{0em}}          \renewcommand\tableofcontents{%         \thispagestyle{empty}         \baselineskip=\simpleinter         \if@twocolumn           \@restonecoltrue\onecolumn         \else           \@restonecolfalse         \fi         \chapter*{\MakeUppercase{\contentsname}}         \parskip=0ex         \vspace*{-1.5ex}         \@starttoc{toc}%         \noindent         \if@restonecol\twocolumn\fi         \baselineskip=\doubleinter         \parskip=2ex}          \renewcommand\l@chapter[2]{%       \ifnum \c@tocdepth >\m@ne         \addpenalty{-\@highpenalty}%         \vskip 1.0em \@plus\p@         \setlength\@tempdima{1.5em}%         \begingroup           \parindent \z@ \rightskip \@pnumwidth           \parfillskip -\@pnumwidth           \nopagebreak           \leavevmode %\bfseries           \hskip -\leftskip           \@dottedtocline{1}{0em}{2.3em}           #1\nobreak\hfil \nobreak\hbox to\@pnumwidth{\hss #2}\par           \penalty\@highpenalty         \endgroup       \fi}          \def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne                              \refstepcounter{chapter}%                              \typeout{\@chapapp\space\thechapter.}%                              \addtocontents{toc}{\protect\vspace{1.5ex}}                              \addcontentsline{toc}{specialchapitre}                         {\MakeUppercase{\@chapapp\protect\hskip 0.5em \numerochap} \vskip 0ex     \uppercase{#1}                          }%                         \else                           \addcontentsline{toc}{section}{#1}                         \fi     %                    \newcommand\numerochap{\Roman{chapter}}                         \chaptermark{#1}%      %                   \addtocontents{lof}{\protect\addvspace{10\p@}}%      %                   \addtocontents{lot}{\protect\addvspace{10\p@}}%                         \if@twocolumn                           \@topnewpage[\@makechapterhead{#2}]%                         \else                           \@makechapterhead{#2}%                           \@afterheading                         \fi                         }          \def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth          \let\@svsec\@empty\else          \refstepcounter{#1}\edef\@svsec{\csname the#1\endcsname\hskip     1em}\fi          \@tempskipa #5\relax           \ifdim \@tempskipa>\z@             \begingroup #6\relax               \@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty \@M     #8\par}%             \endgroup            \csname #1mark\endcsname{#7}             \ifnum #2<3              \addtocontents{toc}{\protect\vspace{1.5ex}}              \addcontentsline              {toc}{#1}{\ifnum #2>\c@secnumdepth \else                           \protect\numberline{\csname the#1\endcsname}\fi                         #7}\else             \def\@svsechd{#6\hskip #3\relax  %% \relax added 2 May 90                        \@svsec #8\csname #1mark\endcsname                           {#7}\addcontentsline                                {toc}{#1}{\ifnum #2>\c@secnumdepth \else                                  \protect\numberline{\csname     the#1\endcsname}\fi                            #7}}\fi             \fi          \@xsect{#5}}               \renewcommand\l@section      {\@dottedtocline{1}{0em}{2.3em}}     \renewcommand\l@subsection   {\@dottedtocline{2}{2.3em}{3.2em}}     \renewcommand\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}      I would very much appreciate your help. I hope I have provided all the needed information.


title: Two figures in a subfigure

text: I need to show a total of 8 figures in the same page, combining them in this way:                img1-a img1-b      img2-a img2-b        (a)  (b)           img1-c img1-d      img2-c img2-d        (c)  (d)      I tried subfigure,               \begin{figure*}[tpb]     \centering     \subfigure[]           {\label{fig:conn}           \includegraphics[width=0.48\columnwidth,keepaspectratio]{img1-a}           \includegraphics[width=0.48\columnwidth,keepaspectratio]{img1-a}}\hfill          \subfigure[]     //and so on....      but I do not understand how to combine two figures to stay on the same column (i.e. figure img1-a and img2-a). Maybe forcing the subfigure width? Any help will be appreciated!


title: Nested use of \ifcsname needs protection

text: I have a macro `\command` to ensure that the names of macros in my documentation are consistently formatted. Been work great, until I had an urge to procrastinate and had this _brilliant_ idea that I can easily catch most spelling errors of the macro names, by checking that the macro exists. Seems simple enough. So I added:               \ifcsname#1\endcsname%     \else%         \par\textbf{\textcolor{red}{\textbackslash#1} is not defined.}     \fi%      to the macro that does the formating, where `#1` is the name of the macro. This seems to work fine in the basic case as illustrated by the MWE below that produces: ![enter image description here](http://i.stack.imgur.com/Sn2Lb.png) and correctly tells me that `bfseriess` and `\foo` are not defined. However, if I attempt to use this in a nested fashion               \command{foo=\command{MyDef}}      I get the error message > >     Missing \endcsname inserted. >   >     <to be read again> >                   \protect >     l.25 \command{foo=\command{MyDef}} >   ## Question: I have a feeling that the solution is in the question listed in the references but I don't know exactly how to `\protect` things. So, what changes can I make to the `\command` macro so that I can uncomment the last line in the MWE and the proper error messages. ## Reference:   * What is the difference between Fragile and Robust commands? ## Code:               \documentclass{article}     \usepackage{xcolor}          %% The last line should not produce any error      %% messages (red text) if these two are defined.     %     %\newcommand*{\foo}{}%     %\newcommand*{\MyDef}{}%          \newcommand{\command}[1]{%         \textbf{\textbackslash#1}%         %% Since this is used to typeset macro names, we         %% can check for typos by ensuring the macro exists         \ifcsname#1\endcsname%         \else%             \par\fcolorbox{red}{red!20}{\textcolor{blue}{\textbackslash#1} is not defined.}         \fi%     }%               \begin{document}     To bold text use \command{textbf} or \command{bfseriess}.          A useful token is \command{foo}.          This token needs to be set with:      %\command{foo=\command{MyDef}}     \end{document}


title: Placement of graphics in a triangular orientation

text: How is it possible to import figures into a somewhat triangular orientation? By triangular orientation I mean having one figure and then a further two figures underneath where all figures have a different caption. I can place figures side by side with the following:               \begin{figure}[ht]     \begin{minipage}[b]{0.5\linewidth}     \centering     \includegraphics{Figures/fig1.pdf}     \caption{blah blah}     \label{fig:blah1}     \end{minipage}     \hspace{0.5cm}     \begin{minipage}[b]{0.5\linewidth}     \centering     \includegraphics{Figures/fig2.pdf}     \caption{blah blah}     \label{fig:blah2}     \end{minipage}     \end{figure}      I would now like to place another figure on top of this to give this triangular orientation I mentioned. How can this be achieved?


title: How do I set the gamma correction of a full LaTeX document?

text: I will be holding a presentation with a PDF generated by LaTeX `beamer`. Projectors in general need a gamma correction of about 2.0, however, my laptop doesn't enable me to set the gamma correction of the signal sent to a projector. So, I want to set the gamma correction or change it in the generated PDF document. One work-around I could use in the worst case is to only change the gamma of the images, but that won't affect the other colors in the presentation. I also tried running imagemagick on the PDF, which currently has been crunching away at it for 15 minutes without completing. EDIT: imagemagick finally finished, but had converted everything to bitmaps. Might work as a work-around if I let it render to the full screen size, but I'm afraid that I will lose important meta-data, like page titles.


title: Beamer: problem with \framezoom and XeLaTeX

text: I have a problem getting the `\framezoom` command to work when compiling with XeLaTeX, using fully updated MikTeX 2.9. Here is an example:               \documentclass{beamer}     \usepackage{mwe}     \begin{document}     \begin{frame}<1>[label=zoom]         \frametitle<1>{Test zoom}         \framezoom<1><2>[border](1cm,1cm)(3cm,2cm)         \includegraphics[width=0.5\textwidth]{example-image-a.png}     \end{frame}     \againframe<2->[plain]{zoom}     \end{document}      This works fine with pdfLaTeX and LuaLaTeX, but not with XeLaTeX: there, it creates the two slides as expected, but both the hyperlinks and the border on frame 1 are missing. I have checked the log-file and the hyperref uses the hxetex driver, i.e. the same as if I pass the option `xetex` to hyperref manually. Any idea how to fix this? (For some reasons, I need to use XeLaTeX.) Thanks PS: I hade to use a PNG version of the picture, as with PDF-version I run into a pdf-version problem and the picture is not shown at all.


title: How to check if a datatool db has an existing member

text: I would like to suppress duplicated entries in a list. The lists are comma separated lists defined in a macro as in my earlier question on Sorting Comma Separated Lists defined with, or without macro. My current approach is to use the `datatool` package. The most obvious method to me seemed to use `\DTLgetlocation`. But, that yields the following error if the member does not exist (uncommenting the commented lines in the MWE to see this): > Package datatool Error: There is no element `XYZ` in database `duplicates` Perhaps I should not be using the `datatool` package for this and use an entirely different approach? ## Update: The code below has been updated to do an additional test via a `\foreach` loop (with and without a macro defined list). This also necessitated the addition of `\dtlexpandnewvalue` in the `\IfIsInDB` macro. ## Code:               \documentclass{article}     \usepackage[paperheight=15in]{geometry}% so output fits on "one" page     \usepackage{datatool}     \usepackage{pgffor}%   Added for expanded test          \newcommand*{\DBKey}{Value}%          \newcommand*{\InitalizeDuplicatesDB}[1]{%          % #1 = name to be used for this duplicate's DB         \DTLifdbexists{#1}%             {\DTLcleardb{#1}}% DB exists, so just clear it             {\DTLnewdb{#1}}%   DB does not exist, so create it     }%     \newcommand*{\AddMemberToDB}[2]{%         % #1 = name of DB         % #2 = member to be added to DB         \DTLnewrow{#1}%         \DTLnewdbentry{#1}{\DBKey}{#2}%     }%     \newcommand*{\IfIsInDB}[4]{%         % #1 = name to be used for this duplicate's DB         % #2 = member to check if in DB (gets added if not)         % #3 = code to execute if member is in DB         % #4 = code to execute if member is not in DB         %         \dtlexpandnewvalue% Added in update.         %         \DTLgetlocation{\RowIndex}{\ColIndex}{#1}{#2}%         %row=\RowIndex \quad col=\ColIndex\par         \ifnum\RowIndex>0\relax%             #3%         \else%             #4%             \AddMemberToDB{#1}{#2}         \fi%     }%          \begin{document}     \InitalizeDuplicatesDB{duplicates}     \AddMemberToDB{duplicates}{ABC}     \AddMemberToDB{duplicates}{DEF}          Current db:\par     \DTLdisplaydb{duplicates}          \medskip     \IfIsInDB{duplicates}{ABC}{ABC is a duplicate}{ABC added DB}\par     \IfIsInDB{duplicates}{DEF}{DEF is a duplicate}{DEF added DB}\par     %\IfIsInDB{duplicates}{XYZ}{XYZ is a duplicate}{XYZ added DB}\par          \medskip     Current db (before foreach - no macro):\par     \DTLdisplaydb{duplicates}          %% Following tests added in update.     %\medskip\par\noindent     %Testing with a non-macro defined list (ABC, DEF should not be ``added", and MMM should only be ``added" once):\par     %\foreach \x in {ABC, DEF, ABC, MMM, MMM, JHM}{%     %    \IfIsInDB{duplicates}{\x}{\x~is a duplicate}{\x~added DB}\par     %}%     %     %Current db (after foreach - no macro):\par     %\DTLdisplaydb{duplicates}     %     %\medskip\par\noindent     %Testing with a macro defined list: (ABC, DEF should not be "added", and NNN should only be ``added" once)\par     %\newcommand*{\ListMembers}{ABC, XXX, DEF, NNN, NNN, YYY}%     %\foreach \x in \ListMembers {%     %    \IfIsInDB{duplicates}{\x}{\x~is a duplicate}{\x~added DB}\par     %}     %     %Current db (after foreach - macro defn):\par     %\DTLdisplaydb{duplicates}     \end{document}


title: Why are some macros undefined inside an if case?

text: I'm trying to check if a string is only of one char, and I ran into this problem: LaTeX complains that `\StrLeft` in the comparison takes and additional argument:               ! Argument of \@secondoftwo has an extra }.     <inserted text>                      \par      l.11 \IfStrEq{A}{\StrLeft{AB}{1}}                                      {True}{False}      However, it doesn't in the first one.               \documentclass[english]{article}     \usepackage[T1]{fontenc}     \usepackage[latin9]{inputenc}     \usepackage{xstring}     \begin{document}          \StrLeft{AB}{1}          \IfStrEq{A}{A}{True}{False}          \IfStrEq{A}{\StrLeft{AB}{1}}{True}{False}          \end{document}      I know I could take an additional third input and set a variable, but why is it not possible to use it like this?


title: How do I get an uppercase ordinal to number with memoir class?

text: The `memoir` class has a number of macros for converting a number to words. For example                \numtotoname{113}      will print one hundred and thirteen. Is there an equivalent macro for all caps? Alternatively can one define one? I am trying to define:                  \def\thechapter{\textsc{\numtoname{\@arabic\c@chapter}}}      This works,                  \textsc{\numtoname{\@arabic\c@chapter}},      but not this one:                  \def\chaptername{chapter}        \def\thechapter{\textsc{\numtoname{\@arabic\c@chapter}}}      ![enter image description here](http://i.stack.imgur.com/GAphs.jpg) **Note:** I am trying to convert chapter numbers to words. My guess is the answer probably need a number of `\expandafters`, which currently they evade me.


title: Superscripts and bold math

text: I'm writing the transpose of a matrix that is denoted by a bold capital letter. This looks fine when the matrix is denoted by B, but when the matrix is denoted by A, the transpose superscript is too far away from the letter A. Here is a MWE to show what I mean:               \documentclass{article}     \usepackage{amssymb}          \begin{document}     \newcommand\T{{\hspace{-2pt}\intercal}}     \[     \mathbf{A}^\intercal,     \mathbf{B}^\intercal,     \mathbf{A}^\T,     \mathbf{B}^\T     \]     \end{document}      The output is: ![enter image description here](http://i.stack.imgur.com/VsvIc.png) One way to deal with this is to use `\hspace` to move the transpose superscript a little bit to the left, but this does not look good for B (as shown in the MWE). I could define two different transpose commands, one of which I would use for the transpose of A, and one for the transpose of B. But is there no more elegant and more efficient way of dealing with this?


title: Programming simple functions using TikZ arithmetic?

text: How do you do program simple functions using the TikZ arithmetic engine? I love the idea of using TikZ in order to “program” my pictures, being able to write code once and reuse, get precise coordinates and intersections, being able to change just one number and get the whole picture to automagically update whatever depended on that number. That is amazing. However, maybe because I am extremely used to more traditional programming languages, and I _think_ in a more procedural (rather than a “macro expansion _y_ ” way), I tend to get quickly frustrated as soon as I need even basic stuff such as an `if` or a `while` loop. I got hold of the TikZ `\foreach` command which works wonders; but why aren't similar commands for `if` and `while` defined? (Or there are, but I'm missing them?) You will probably point me to other packages that _do_ define such commands, but I find it non-trivial (and headache producing) to write the correct code to switch between TikZ arithmetic expressions and strings, tokens, (un)expanded macros or whatever the hell these packages do actually compare in their conditionals. This is what I think should be essential to have:   * `\ifmath{expr}{true}{false}` — evaluates `expr` and if true (e.g. not 0), continues executing the code in the `true` part; otherwise it continues with the `false` part.   * `\whilemath{expr}{code}` — repeatedly executes `code` while the `expr` yields a true value. I had sort of written versions of these, but I would like to see what you can come up with. Now, that was the basic, but what I would really really be able to do, is to easily define new functions that can be also used within an `expr`. For example, suppose that I want to write a wee tiny function that simply takes two numbers and returns their gcd. This is some simple pseudocode of what I want to write:               function gcd(a, b) {       while (b) {         t = b;         b = a mod b;         a = t;       }       return a;     }      How would I go about to write such kind of code in TikZ to compute gcd, and furthermore, being able to write things like `4 + gcd(15,6)` as further TikZ expressions? Please note, I'm not asking how to write some token-expansion magic to compute the gcd of two numbers; I'm asking whether if it is possible to actually _write_ simple functions such like this one (using plain if's, while's and assignments). And now that I'm in the mood of wishing for everything, how do you deal with variables? In TikZ examples I've seen its common to simply store values inside macros, and TikZ expressions seem to be pretty happy working with those. However, I also had to write my own command to evaluate a TikZ `expr` and store the result in a macro of my choosing (`\pgfmathsetmacro` didn't work as expected, for example `\pgfmathsetmacro{\a}{int(0)}\a` produces `0.0` rather than `0`). Furthermore, by using just plain macro names, like `\v`, I worry all the time that I might accidentally redefine some important pre-existing macro; but I don't want to call all my variables `\mya`, `\myb`, `\myc`. Sometimes I feel temped to change the cat code of `:` so that `:a`, `:b`, `:c` become macro names... but experience tells me that every time one messes with cat-codes everything breaks.


title: Variable number of arguments for newcommand, to create a set containing all of them

text: I am relatively new to LaTeX and I am trying to come up with a way of a creating a command, call it `\Set`, such that               \Set{#1,#2, #3, ... #N} outputs \tau_{#1} = \{ #2, #3, ... #N \}      Any help would be appreciated, thanks


title: let operation vs tkz-euclide

text: Before put my question to give some explanation of why I do this question. When I started to use the TeX a matter of luck that I started working with LaTeX (xelatex) and not with LuaTex for example. But now as little more experienced user does not want to leave things to luck. **Well my question:** Because I want to create several similar shapes and I do not want to go back and to fix them can you tell me in your opinion which method - pack of those presented to this question arc that passes from (B) having a center on (A), automatically calculates (AB) distance offers me more possibilities - options. The method with **let operation** or the method **tkz-euclide** of course there is the method with **PSTricks** (although I did not use it but it is never too late) I do not know if I put my question correctly because **let** operation is not package ... but I hope you understand. I would like namely to tell me the advantages and disadvantages of each method (I do not want to hurry to give myself my own right choice but I want the users through their vote to decide). **I know my question is rather general and perhaps closed ... but my concern is real** (because my English does not help me if you understand the meaning of my question please correct where necessary to have better sense) * * * **1ο update:** To clarify ... my concern is mainly on the possibilities of **let** operation and **tkz-euclide** and not on features differences between tikz and PSTricks, I think this is covered on the links you indicated


title: Problem when using \nocite together with the standalone package

text: Given:               \documentclass{minimal}     \usepackage{standalone}     \begin{document}     \input{inclusion}     \nocite{*}     \bibliographystyle{plain}     \bibliography{test}     \end{document}      With:               \documentclass{minimal}     \begin{document}     Hello World!     \end{document}      And:               @book{Bateman.1906,      author = {Bateman, Newton and Selby, Paul and Short, William F.},      year = {1906},      title = {Historical encyclopedia of Illinois},      address = {Chicago},      publisher = {Munsell Pub. Co.}     }               @book{Beckett.1966,      author = {Beckett, J. C.},      year = {1966},      title = {The making of modern Ireland, 1603-1623},      address = {London},      publisher = {Faber}     }      I get the following error:               ! LaTeX Error: Cannot be used in preamble.          See the LaTeX manual or LaTeX Companion for explanation.     Type  H <return>  for immediate help.      ...          l.5 \nocite{*}     ?      Yet if I comment out either `\input{inclusion}` or `\nocite{*}` the test compiles without error. I'm running a command line of `latexmk -xelatex test` on Win7 Ultimate. TeX courtesy of MikTeX. So either I'm doing something egregious or there is something wrong with standalone? Suggestions and brickbats welcome.


title: How should I read the current TikZ "label distance"?

text: I decided that I don't like the behaviour of the label functionality of TikZ. I want to get labels that are positioned using the anchor opposite the specified label angle. So for example if the label would be stated in the node options list as `[..., label = {210: my label}, ...]` then the label should be positioned at angle 210 using its (the label's) `30` anchor (210 +/- 180 is 30 modulo 360). (The TikZ label positioning logic doesn't do this. Instead (per the 3.00 manual) it chooses one of the 8 anchors `north`, `north east`, `east`, ..., `north west` for the label, dependent upon the angle.) Since the labelled nodes are going to be created inside a macro and not by actually typing TikZ code directly, it seemed that it would be simple enough to just create the label node myself without actually using the "label" functionality. However, one still has to get the `label distance` right. And I want the label distance to respond to changes to the TikZ key `label distance`, just like real TikZ labels do. However, there doesn't seem to be a /tikz/ or /pgf/ key that stores the `label distance`. There's `/tikz/label distance`, but that's seemingly used for setting the label distance rather than storing it; if you try to read from it using `\pgfkeysgetvalue`, you get `\relax`. Looking through the code for TikZ, it seems that the current label distance is stored in a macro called `\tikz@label@distance`. So I tried code that copies the value of this macro and uses it to position the ersatz label, and it appears to work correctly. My question is, is this the way that I "should" be determining the label distance? By this I mean that what I'm doing here is looking "under the hood" of Tikz/PGF and tinkering with its internals. If a later version of TikZ/PGF renames the `\tikz@label@distance` macro or starts using, say, a PGFkeys key to store it, my code will break. Is there a better way?


title: Use numbers in every level of enumeration?

text: Is it possible to use only numbers on front of every item? Something like this:   1. ABC   2. DEF      * abc     * def        * xyz But only with numbers.


title: longtable changes the page heading

text: Consider the following MWE:               \documentclass{article}     \usepackage{kantlipsum}          \pagestyle{headings}          \usepackage{longtable}          \begin{document}     \section{First}     \kant[1]          % using this longtable changes the header from "1 First" to "2 Second":     % \begin{longtable}{ll}     %  bla & blub \\     %  bla & blub     % \end{longtable}          \section{Second}     \kant[2]          \end{document}      Curiously adding the `longtable` environment changes the page heading from _»1 First«_ to _»2 Second«_. Am I missing something obvious? Does anybody know where to look for the cause?


title: Starting point for getting more familiar with TeX/LaTex etc

text: **Background** : I've been using what _I_ would call LaTex for ~4 yrs to typeset assignments, reports, essays and tutorial notes. I have been using "TexShop" (for Macs) - mostly because it was simple when I was first starting. **Situation** : I was recently prompted to search out the possibility of using Tex/Latex/[Appropriate name here] to typeset Arabic, but have found that I am completely unable to understand any of the jargon or technical language, and so can't make any use of the documentation found here and elsewhere on the web. While I'm not exactly brimming with excitement at the prospect of reading hundreds of pages of technical details about the typesetting program I use, I really would like to be able to start to get a more sophisticated grasp of the topic. **Question(s)** : **1)** where can I find an _accessible_ , well-structured and accurate introduction to Tex/LaTex/ConTex etc. that would serve as a solid foundation for learning about more advanced features (e.g. typesetting in Arabic; adding La/Tex capabilities to a program, forum or website; generating technical images w/ Texs of all sorts; etc.)? **Clarification** : I am very familiar with _typesetting in LaTex_ (I've typed 100s of pages of math, with all the fixings), but I couldn't tell you what the difference between Tex and LaTex is or _what_ ConTex is or any of the "Tex" story and how it fits together. So, as far as I can tell, the linked thread on "what intro book for LaTex would you recommend" (sry for imprecise quote, I can't view the title while writing this), for example, doesn't really address the question. This is meant as clarification, not criticism - thanks to all who have responded so far. While it is a subjective question, I'd also be interested to know from those who answer the above: **2)** if they would actually _recommend_ heading down this road. **3)** I also wondered if there was a community similar to this one that had assembled instructional _videos_ or even problem sets on the topic? Ps. I tried to add useful tags to this, but was not allowed; perhaps someone else with correct permissions could do so? e.g. "readings" "intro" "basics" "beginner" etc.


title: error during pdflatex; geometry-eps-converted-to.pdf' not found

text: When running pdflatex the following errors occurred:"               ! Package pdftex.def Error: File `geometry-eps-converted-to.pdf' not found.     ! Package pdftex.def Error: File `force-eps-converted-to.pdf' not found."      Do I need to install a separate package or is there an other way to solve this? Where do I find these files?


title: Passing a TikZ matrix to a TeX macro

text: When I pass code containing a TikZ matrix to a TeX macro it prints the following error message: `! Package pgfbasematrix Error: Single ampersand used with wrong catcode.`               \documentclass{article}     \usepackage{tikz}          \def\identity#1{#1}          \begin{document}     \begin{tikzpicture}         \identity{             \matrix {                 \node {1}; & \node{2};\\                 \node {3}; & \node{4};\\             };         }     \end{tikzpicture}     \end{document}      Why does this happen? Is there any way to make this work? * * * Rationale: _I use such macros to create exercise sheets for my students. I like the answers to be embedded in the source code but naturally do not want them to show up on the exercise sheet. Thus I mark up my code with macros like`\problem{}` and `\answer{}` which are then suitably defined in the document header depending on whether I want to compile the exercise sheet or the reference solution._ _The probably best way (I guess) would be to replace my markup macros with environments that use`\iftrue` or `\iffalse` to include or skip parts of the document, but currently I'm not ready to convert all my files. That's why I'm looking for a short term solution to that problem (that, and I'm curious)._


title: Repeating part of document on every page

text: I want to creat a document which has following structure > Header > > * * * > > Name, Date of birth, Address <\-------- This will be written by persons > (before the document is compiled) who do not understand LaTex and will be > repeated on every paper > > * * * > > contents ... > > * * * > > footer Is this possible ?


title: Breaking equation - Problem with brackets

text: I want to break a long equation in LaTex. I have tried multline and align but I always get errors with the brackets.               \begin{equation}     \dfrac{dr_{ij}}{dt} = \frac{1}{2r_{ij}} \left[ 2 \left( x_{i}-x_{j} \right) \left( \dfrac{dx_{i}}{dt} - \dfrac{dx_{j}}{dt} \right) + 2 \left( y_{i}-y_{j} \right) \left( \dfrac{dy_{i}}{dt} - \dfrac{dy_{j}}{dt} \right) + 2 \left( z_{i}-z_{j} \right) \left( \dfrac{dz_{i}}{dt} - \dfrac{dz_{j}}{dt} \right) \right]      \end{equation}      I want to break it in a way, so that all the three "2"s are below each other. How can I do that without getting an error with the brackets?


title: Language sensitive italicized quotation with csquotes

text: In what follows:               \documentclass[fontsize=11pt]{book}     \usepackage{microtype}     \usepackage{times}     \usepackage{csquotes}     \usepackage[frenchb]{babel}     \frenchbsetup{IndentFirst=false}     \begin{document}     text in French \foreignblockquote{english}[][.]{quotation in English} text in French text \blockquote[][.]{quotation in French}     \end{document}      I would like to have the quotation in English italicized. It is obviously possible to use `\renewcommand{\mkblockquote}[4]{\emph{#1}#2#4#3}` but it will affect all the block-like quotations. I had a quick look in the `csquotes.sty` file but it is too complicated for me. I also had a look at the conditional statements available in the package but none are language-related.


title: Tikz diagram with bold text

text: I'm trying to make a diagram using `Tikz`, however I have trouble combining; fixed text widths, centered text and `font=[\large,\bf` , etc]. When the font command is used the text has a slight offset to the right. the only idea I had, `font=\noindent` has no effect. MWE:               \documentclass[a4paper,landscape]{article}     \usepackage{tikz}     \usetikzlibrary{shapes,shadows,arrows,positioning,graphs}          \begin{document}     \centering     \begin{tikzpicture}     \thispagestyle{empty}     \tikzstyle{fontbf} = [draw,rectangle,text width=11em,text centered,font=\bf]     \tikzstyle{textbf} = [draw,rectangle,text width=11em,text centered]     \node[fontbf] (1) {centered bold text};     \node[textbf, below of=1] (2) {\textbf{centered bold text}};     \end{tikzpicture}     \end{document}


title: Change chapter formatting with TeX4ht and memoir

text: Using htlatex/tex4ht, it seems that the chapter heading style set by memoir is over-ridden when generating HTML output. How can you customize the style of the chapter headings generated by tex4ht? I've tried using the built in functions and page styles provided by the memoir class, however these seem to have no effect. I've also tried modifying memoir.4ht, and book.4ht, but could not work out what to change here.