title: How to Align systems

text: I am having a hard time of getting my texts and equations aligned. Idk what pack to use. Sorry the way I listed the codes are not the very best. This is my first time going on to this forum. Here's a picture of how my ended pdf look like: ![enter image description here](http://i.stack.imgur.com/5beVR.png) Here are my codes for the picture:               \documentclass{article}     \usepackage{amsmath}     \begin{document}          \begin{enumerate}     \item{     \begin{equation}     \begin{aligned}      & x-2x+4-6x                                                    \\      & = x-2x-6x+4           & \text{Rearrange the terms}           \\      & = -x-6x+4             & \text{Subtraction (for x)} \nonumber \\      & = -7x+4               & \text{Subtraction (for x)}     \end{aligned}        \end{equation}}          \item{     \begin{equation}     \begin{aligned}          & 2x-5(5+2)^2+3x                                               \\      & = 2x+3x - 5(5+2)^2    & \text{Rearrange the terms}           \\      & = 5x-5(5+2)^2         & \text{Addition (for x)}              \\      & = 5x-5(7)^2           & \text{Parantheses} \nonumber         \\      & = 5x - 5(49)          & \text{Exponent}                      \\      & = 5x - 245            & \text{Multiplication}     \end{aligned}         \end{equation}}          \item{     \begin{equation}     \begin{aligned}          & 6x+5x+11x+12+14x                                             \\      & = 6x+5x+11x+14x+12    & \text{Rearrange the terms}           \\      & = 11x+11x+14x+12      & \text{Addition (for x)}              \\      & = 22x + 14x +12       & \text{Addition (for x)}              \\      & = 36x +12             & \text{Addition (for x)} \nonumber    \\     \end{aligned}         \end{equation}}          \item{     \begin{equation}     \begin{aligned}         & 5+12+5x-15x+10                                               \\      & = 5x-15x+5+12+10      & \text{Rearrange the terms}           \\      & = -10x+5+12+10        & \text{Subtraction (for x)}           \\      & = -10x+17+10          & \text{Addition}                      \\      & = -10x+27             & \text{Addition} \nonumber            \\     \end{aligned}         \end{equation}}          \end{enumerate}     \end{document}


title: \string command behavior - Plain TeX

text: I would like to learn Plain TeX and I'm reading Knuth's "The TeXBook". At Chapter 7, Knuth talks about the `\string` command and how it converts control sequences into lists of characters tokens. Why when I typed `\string\TeX`, I got `"TeX`, but when I wrote `{\tt \string\TeX}` I got `\TeX` ? I guess it's something related to `\escapechar`, because when I changed that control sequence the output changed too:               \escapechar=`^     \string\TeX      it generates `^TeX`.


title: The biblatex has problems with \par having \prevdepth

text: Russian paragraphs have not too short last lines as the `\Arussian` substitution for `\par` does. But this approach creates conflicts with `biblatex` package. Is there any method to make it run? Here is a short example of the problem:               \documentclass{article}          \usepackage{biblatex}          \let\origpar\par          % Donald Arseneau, [in:]     % Peter Wilson, Glisterings     % TUGboat, Volume 28 (2007), No. 2     \def\Arussianpar{\ifhmode \unskip       \strut\vadjust{}\nobreak       \discretionary{}%         {\hbox{\hskip2\parindent                \vrule depth 273sp                width 0sp height \ht\strutbox}}%         {\hbox{\hskip\parindent}}%       \hskip-2\parindent minus 2\parindent       \hskip\hsize minus\hsize       \kern0pt\parfillskip0pt       \origpar       \ifdim\prevdepth=273sp         \nobreak         \vskip-2\baselineskip         \hbox{\strut}%       \fi       \fi}          \let\par\Arussianpar          \begin{document}     x     \end{document}      The `pdflatex` crashes with:               ! Improper \prevdepth.      \par ...arfillskip 0pt \origpar \ifdim \prevdepth                                                        =273sp \nobreak \vskip -2\...


title: Section based linguistic example numbering with brackets

text: I would like to have examples in my document look like this: > **Section 2** > > (2.1) This is an example. > > This is a reference to example (2.1). That is:   * the section number appears both next to the example and in the reference to it   * both the labels and references to examples have brackets around them: I shouldn't have to do a whole lot of manual bracketing of \ref, i.e., not example (\ref{myexample}) for every single reference to every single example.   * have the example numbers reset to 1 at the beginning of each section   * ideally I want to use `cleveref` in order to minimise typing too :) So far the closest I've got is with the `linguex` package:               \documentclass{article}     \usepackage{linguex}     \renewcommand{\theExNo}{(\thesection.\arabic{ExNo})}     \usepackage{cleveref}     \crefname{ExNo}{example}{examples}     \let\oldsection\section     \renewcommand{\section}{\setcounter{ExNo}{0}\oldsection}          \begin{document}          \section{First section}          \ex. Example the first.\label{ex1}          I'd like to refer to \cref{ex1}.          \section{Second section}          \ex. Example the second.\label{ex2}          I'd like to refer to \cref{ex2}.          \end{document}      However the output of this looks like: > **1 First section** > > (1) Example the first. > > I’d like to refer to example (1.1). > > **2 Second section** > > (1) Example the second. > > I’d like to refer to example (2.1). That is, I've got the automatic bracketing in the references, the counter resetting, but the examples themselves are marked (1) rather than (1.1) and (2.1). I am presently agnostic regarding the various linguistic example packages, so if you know how to make this work with a different one, I would be grateful for that too.


title: Encoding issue when writing Greek in fancy ToC using TikZ

text: I am creating a fancy ToC using TikZ. My code is               \documentclass{book}     \usepackage{kerkis}     \usepackage{pifont}     \usepackage[explicit]{titlesec}     \usepackage{tikz}     \usepackage{epigraph}     \usepgflibrary{qrr.shapes.openrectangle}          \definecolor{mybluei}{RGB}{0,173,239}     \definecolor{myblueii}{RGB}{63,200,244}     \definecolor{myblueiii}{RGB}{199,234,253}          \tikzset{     mynode/.style={       rounded corners=30pt,       shape=open rectangle,       open rectangle fill=myblueii,       open rectangle sides=#1,       }     }          \titleformat{\chapter}[display]       {\normalfont\huge\sffamily}       {}       {20pt}       {%       \begin{tikzpicture}[remember picture,overlay]       \node[         anchor=west,         rectangle,         minimum height=4cm,         text width=\paperwidth,         xshift=-\the\dimexpr\oddsidemargin+1in\relax,         outer sep=0pt,         fill=myblueiii] (titlerect) {};       \node[         anchor=south west,         xshift=2cm,         text width=\textwidth]          at ([yshift=5pt]titlerect.south west) {\fontsize{30}{36}\selectfont#1};       \node[         mynode=nw,         anchor=south east,         fill=myblueii,         inner xsep=1.5cm,         outer sep=0pt,         font=\color{white},         minimum height=30pt]          at (current page.east|-titlerect.north)          {\bfseries\MakeUppercase{\chaptertitlename}\ \thechapter};       \end{tikzpicture}%       }     \titleformat{name=\chapter,numberless}[display]       {\normalfont\huge\sffamily}       {}       {20pt}       {%       \begin{tikzpicture}[remember picture,overlay]       \node[         anchor=west,         rectangle,         minimum height=4cm,         text width=\paperwidth,         xshift=-\the\dimexpr\oddsidemargin+1in\relax,         outer sep=0pt,         fill=myblueiii] (titlerect) {};       \node[         anchor=south west,         xshift=2cm,         text width=\textwidth]          at (titlerect.south west) {\Huge#1};       \end{tikzpicture}%       }     \titlespacing*{\chapter}       {0pt}{-20pt}{60pt}          \usepackage[margin=2.8cm]{geometry}          \usepackage{titletoc}     \usepackage{xpatch}               %-------------------This for fancy ToC---------------------          \contentsmargin{0cm}     \titlecontents{chapter}[0pc]     {\addvspace{30pt}%     \begin{tikzpicture}[remember picture, overlay]%     \draw[fill=myblueii,draw=myblueii, rounded corners] (-4,-.1) rectangle (-0.5,.5);%     \pgftext[left,x=-2.7cm,y=0.2cm]{\color{white}\Large \chaptertitlename\ \thecontentslabel};%     \end{tikzpicture}\color{myblueii}\large\bfseries}%     {}     {}     {\hspace*{6pt}\titlerule\hspace*{6pt}\large\bfseries \thecontentspage     \begin{tikzpicture}[remember picture, overlay]     \draw[fill=doc!25,draw=myblueii, rounded corners=0pt] (2pt,0) rectangle (6,0.1pt);     \end{tikzpicture}}%     \titlecontents{section}[2.4pc]     {\addvspace{1pt}}     {\contentslabel[\thecontentslabel]{2.4pc}}     {}     {\hfill\small \thecontentspage}     []     \titlecontents{subsection}[4.8pc]     {\addvspace{1.0pt}}     {\contentslabel[\thecontentslabel]{2.4pc}}     {}     {\hfill\small\thecontentspage}     []          \makeatletter     \renewcommand{\tableofcontents}{%     \chapter*{%     \vspace*{-20\p@}%     \begin{tikzpicture}[remember picture, overlay]%     \pgftext[right,x=15cm,y=0.2cm]{\color{myblueii}\Huge \contentsname};%     \draw[fill=myblueii,draw=myblueii, rounded corners=15pt] (13,-.75) rectangle (20,1);%     \clip (13,-.75) rectangle (20,1);     \pgftext[right,x=15cm,y=0.2cm]{\color{white}\Huge \contentsname};%     \end{tikzpicture}}%     \@starttoc{toc}}     \makeatother               \begin{document}     \tableofcontents     \chapter{First}     \DoPToC     \chapter*{Κεφάλαιο χωρίς αρίθμηση}     \DoPToC     \chapter{Δεύτερο Κεφάλαιο}     \DoPToC     \section{A simple section}     \section{Another simple section}     \subsection{A simple subsection}     \subsection{Another simple subsection}     \subsubsection{A simple subsubsection}          \end{document}      My output when using greek language is the following ![enter image description here](http://i.stack.imgur.com/ZW8Wy.png) I can't seem to understand why those weird symbols appear! Any idea on what might be wrong?


title: help about macro \uparrowfill

text: Is there in plain TeX a macro similar to `\leftarrowfill` but vertically oriented, something like `\uparrowfill`? I know it exists in LaTeX, but I'm interested only in plain TeX.


title: Did one manage to get the new dvisvgm driver from PGF 3.0 to work?

text: Background: PGF 3.0 added a new, direct way to create SVG. It now has a dvisvgm driver (pgfsys-dvisvgm.def) which has fewer (claimed) limitations than the pgfsys-tex4ht.def driver. Except it doesn't seem to work at all with the current version (1.8) of dvisvgm itself. The PGF/TikZ manual gives the following example:               \documentclass[dvisvgm]{minimal}     \usepackage{tikz}     \begin{document}     Hello \tikz [baseline] \fill [fill=blue!80!black] (0,.75ex) circle[radius=.75ex];     \end{document}      This doesn't render any graphics for me with MikTeX. Only the "Hello" word appears in the output SVG. I did check that the dvi file generated contains actual dvisvgm specials like `dvisvgm:raw <g fill="rgb(0.0%,0.0%,80.0003%)">` which is probably the color for the blue dot/circle. If I remove `[dvisvgm]` from the code above, I get the blue circle in the resulting SVG, but the intermediate DVI is using PostScript specials instead; it's full of `grestore`, `gsave` and so forth. And of course you need ghostscript for it to actually get processed properly by dvisvgm, whereas the new, direct dvisvgm driver doesn't need ghostscript. So, question: did anyone manage to get the PGF 3.0 dvisgm _driver_ working with the actual dvisgm? If so, how? If not, does anyone have a clue where the interfacing bug is? For the experts, here are the "disassembled" dvi files (with DVItype):   * the one using the new dvisvgm driver: http://pastebin.com/mKb6fCWM   * the one using the classic PostScript specials: http://pastebin.com/iLwpCyjp **Fairly important update:** Another interesting issue is that although the DVI using PostScript specials is considerably longer than the one using dvisvgm specials (as you can probably tell from disassemblies above), the working SVG that results via PostScript that is actually a bit shorter then non-working one using the new, direct driver...   * SVG generated using PostScript specials as intermediary http://pastebin.com/M8yw8Gbu   * SVG generated using the new dvisvgm specials as intermediary http://pastebin.com/8Er3AkC0 And the diff between these two: http://pastebin.com/NZxu9bpR It seems the viewBox and viewport are different, smaller for the direct method and there's some extra "junky" stuff generated by the "direct" method.   * PS/old viewbox ends with: 32.0864 6.89265' width='32.0864pt'   * direct/new viewbox ends with: 22.3323 6.89265' width='22.3323pt' Luckily the junky stuff doesn't matter, if I just copy the old viebox and width over the new, direct-method SVG it displays fine the blue dot/circle! But I still don't know if it's the driver that resulted in the bad (too short) viewbox or if it's a bug added in a newer version of dvisvgm itself, and if so in which version... I did see the comment below that the older version from TeXLive 2014 works fine, so I'm guessing this is most likely a regression in dvisvgm itself. By the way, you have to be careful how interpret what Inkscape shows, because unlike web browsers, it displays stuff in SVGs that's outside the viewbox too! But Inkscape does draw the viewbox. Compare the two screenshots here: http://imgur.com/a/1JPmW **Attepted`\--bbox` workaround** Given that the only real issue turned out to be the SVG viewport (only `width` in this example) and view box (`viewBox`), the fix with the current version of dvisvgm (1.8) would seem to be to invoke it with `\--bbox=none`, which omits adding `width`, `height` and `viewBox` to the resulting SVG, so all of it gets displayed in web browsers. However this only works if you display the SVG separately. If you include it in a web page with other elements, all browsers I tried (IE 11, Chome 36, Firefox 31) leave large amounts of space around it, while that doesn't happen with the SVGs that have a specified vieport & viewBox; those get tightly packed. None of the other options for `\--bbox` do any better. `\--bbox=min` seems to be the default and gets the same results as no parameter, with or without `\--exact`. The other choice, `\--bbox=dvi` puts a huge box around the output, so it's basically centered on the page. I googled a bit, but i haven't found any easy way to get the SVG viewport/viewbox right with other software. Inkscape for instance doesn't even let you edit/specify the viewbox unless you use a plug-in that doesn't even ship with it (http://pernsteiner.org/inkscape/viewbox/). And that's not really an automated solution. **Update again (after Martin's reply) ** Yeah, I've now noticed that the dvisvgm's manual says that `dvisvgm:bbox` needs to be updated by the DVI when using dvisvgm's own specials. But the DVI output of PGF using its dvisvgm driver doesn't output _any_ `dvisvgm:bbox` calls (see the DVI linked above for exmaple). So the driver couldn't possibly work right as it stands, unless Martin decides he wants to treat uniformly dvisvgm and PostScript specials for the purpose of calculating bboxes. I was actually typing this as a feature request on his launchpad when I noticed he replied here. If dvisvgm treated both dvisvgm and PostScript specials uniformly as input, that would also allow him to do some optimizations on the incoming dvisvgm specials instead of just passing them though, because PGF's output is rather more verbose...


title: Why I can't see the references?

text: This seems very simple, but I can't figure out why it doesn't show citation? I do have two files: test.tex, and test.bib               \documentclass[12pt]{article}          \usepackage{graphicx}           \usepackage{amsmath}          \usepackage{caption}          \usepackage{cite}          \begin{document}          \section{Introduction}          bla bla .... \cite{tets}               \bibliography{test}     \bibliographystyle{plain}          \end{document}      and here is the bib file:               @article{test,               title={Molecular biology for computer scientists},       author={Hunter, L.},       journal={Artificial intelligence and molecular biology},       pages={1--46},       year={1993},       publisher={AAAI Press/MIT Press, Menlo Park, CA}     }      Any suggestion please?


title: How to improve a tikZ diagram?

text: I am a beginner in LaTeX, tentatively trying to use it for industrial documents. I am trying to show graphically some of the drawbacks (vs LaTeX) of a solution using a professional publishing software. These tools are expensive and complicated to learn, therefore typically restricted to a single station and operator, while a pool of "writers" submit their drafts, receive them edited, require correction, etc: a very slow and inefficient process (due to the number of iterations) where bottlenecks and frustration are virtually permanent.   1. Borrowing someone else's code and modifying it, I have come up with a diagram. However I did not find any way to separate all the lines reaching the edition station. (the black ones overlap the blue ones, etc)    2. Moreover, I welcome any tip to make the illustration convey the idea of the "numerous iterations" and "bottleneck" as efficiently as possible.   3. Any tip to make the diagram more attractive visually is welcome also, as this one is not yet very satisfactory.               \documentclass[11pt]{article}     \usepackage{tikz}     \usetikzlibrary{calc}     \usetikzlibrary{matrix}          \begin{document}     \begin{figure}[H]     \begin{tikzpicture}[>=latex, scale =1]     \node[draw,rectangle,inner sep=0.5cm] (y) at (0,6) {Writer 1};     \node[draw,rectangle,inner sep=0.5cm] (k) at (0,0) {Writer 2};     \node[draw,rectangle,inner sep=0.5cm] (p) at (0,-2) {Writer 3};          \matrix[matrix of nodes,nodes in empty cells,rectangle,draw] (d) at (0,3)     {       & & & & \\[3 mm]       & &EDITING & &\\[3 mm]       & &STATION & & \\[3 mm]       & & & & \\[3 mm]       & & & & \\[3 mm]     };          \foreach \z in {1,...,5}     {       \draw[<-<, color=red!70, thick] let \n1={\z * -2 mm -10mm} in           (y.west) -| ([xshift=\n1] d.west |- y.west) |- (d.west |- d-\z-\z.south);      \draw[<-<,color=red!70,  thick] let \n1={\z * 2mm + 5 mm} in         (d.east |- d-\z-\z.east) -| ([xshift=\n1] d.east |- y.east) |- (y.east);     }          \foreach \z in {1,...,5}     {       \draw[>->, color=blue!70,thick] let \n1={\z * -2mm - 6 mm} in           (k.west) -| ([xshift=\n1] d.west |- k.west) |- (d.west |- d-\z-\z.north);       \draw[>->,color=blue!70,thick] let \n1={\z * 2 mm + 2mm} in           (d.east |- d-\z-\z.south) -| ([xshift=\n1] d.east |- k.east) |- (k.east);     }          \foreach \z in {1,...,5}     {       \draw[>->, color=black!70,thick] let \n1={\z * -2mm - 2 mm} in           (p.west) -| ([xshift=\n1] d.west |- p.west) |- (d.west |- d-\z-\z.west);       \draw[>->,color=black!70,thick] let \n1={\z * 2 mm + 0mm} in           (d.east |- d-\z-\z.south) -| ([xshift=\n1] d.east |- p.east) |- (p.east);     }          \end{tikzpicture}     \caption{Centralized document editing station and associated flux of corrections}     \end{figure}     \end{document}      ![Diagram generated by above code](http://i.stack.imgur.com/TDPMw.png)


title: footmisc package - remove star from footnote symbols

text: I'm using `footmisc` package for handling footnotes. I want to remove the star (*) from the symbol list? I tried all the combination of               \DefineFNsymbols*{}{}      and               \setfnsymbol{}      except the correct one!:) Could someone be so kind to point me to the correct command? Thanks!


title: Automatic generation of tikzfading

text: I have a question similar to TikZ Fading Speed and defining a fading-style directly in the fill command but I can't figure out how to get a nice solution. I would like to, given a list of increasing integers from 0 to 100, generate the following piece of code:               \documentclass[10pt]{article}     \usepackage[utf8]{inputenc}     \usepackage[T1]{fontenc}     \usepackage{tikz}     \usetikzlibrary{positioning,fit,calc}     \usetikzlibrary{shapes.arrows,chains,decorations.pathreplacing,fadings}     \begin{document}         \tikzfading[name=fade right0,left color=transparent!0, right color=transparent!70]     \tikzfading[name=fade right1,left color=transparent!70, right color=transparent!100]     \begin{tikzpicture}[start chain=1 going right,node distance=-0.15mm]         \node [on chain=1] at (-1.5,-.4) {\ldots};         \node [draw,dashed,on chain=1] {};         \node [draw,dashed,on chain=1] {};         \node [draw, dashed, path fading=fade right0, on chain=1] {};         \node [draw, dashed, path fading=fade right1, on chain=1] {};     \end{tikzpicture}     \end{document}      Here, obviously my list is {0, 70, 100}. I would like to use a `foreach` loop inide my `tikzpicture`, but I can't place the `\tikzfading` inside the `tikzpicture`, and I didn't suceed in using the answer from the above- mentioned post, could someone help me out ? Thanks


title: TikZ/PGF: Simple function is not plotted. Where is the mistake?

text: I'm just starting to learn `TikZ/PGF`. I would like to draw a simple function, `f(x) = x²` to start with.               \documentclass{article}          \usepackage{tikz}     \usepackage{pgfplots}               \begin{document}     \begin{tikzpicture}     \begin{axis}          \draw [thick, domain=0:1] plot  (\x,  {\x*\x});               \end{axis}     \end{tikzpicture}     \end{document}      This is the most minimal example I can think of. Substituting the `\x*\x` with something else to exclude a syntax error does not work either. Where am I making the mistake?


title: Custom shapes in TikZ

text: I am trying to define a new shape in TikZ following the instructions of section 75.5 of the manual. Reading the question Drawing mechanical systems in LaTeX, I started to think that a "mechanical" library is really missing in TikZ, and it shouldn't, because it's useful just as libraries for circuits or diagrams. So I started in reproducing the symbol of a mechanical constraint: ![enter image description here](http://i.stack.imgur.com/vgiZL.png) (forget the vertical dashed line in the center) with the aim to recreate a set of symbols useful to draw mechanical systems and structures. That is what I've done:               \documentclass[a4paper]{article}          \usepackage{pgfplots}     \makeatletter     \pgfdeclareshape{carr}{%       \inheritsavedanchors[from=circle]       \inheritanchor[from=circle]{center}       \inheritanchor[from=circle]{north}       \inheritanchor[from=circle]{south}       \inheritanchor[from=circle]{east}       \inheritanchor[from=circle]{west}       \backgroundpath{%         % center         \centerpoint \pgf@xa=\pgf@x   \pgf@ya=\pgf@y         % west triangle corner         \radius      \pgf@yb=-5\pgf@y \centerpoint \advance\pgf@yb by\pgf@y           \pgf@xb=-2\pgf@x         % east triangle corner         \radius      \pgf@yc=-5\pgf@y \centerpoint \advance\pgf@yc by\pgf@y           \pgf@xc=4\pgf@x         % draw triangle..         \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}%         \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yb}}%         \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}%         \pgfpathclose         % central circle (from pgflibraryshapes.geometric.code.tex)..         \pgf@process{\radius}         \pgfutil@tempdima=\pgf@x%         \pgfutil@tempdimb=\pgf@y%         \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%           \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%           \advance\pgfutil@tempdima by-\pgf@xb%         \advance\pgfutil@tempdimb by-\pgf@yb%         \pgfpathellipse{\centerpoint}{\pgfqpoint{\pgfutil@tempdimb}{0pt}}{\pgfqpoint{0pt}{\pgfutil@tempdimb}}%         % and lower circles         \pgf@xa=1pt % the radius:should be a parameter         \pgfutil@tempdima=\pgf@xb \advance\pgfutil@tempdima by\pgf@xa         \pgfutil@tempdimb=\pgf@yb \advance\pgfutil@tempdimb by-\pgf@xa         \pgfpathcircle{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdimb}}{\pgf@xa}         \pgfutil@tempdima=\pgf@xb \advance\pgfutil@tempdima by-\pgf@xa         \pgfutil@tempdimb=\pgf@yb  \advance\pgfutil@tempdimb by-\pgf@xa         \pgfpathcircle{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdimb}}{\pgf@xa}     }}     \makeatother          \begin{document}     \begin{tikzpicture}       \node[shape=carr,draw] at (3,0) {a};       \node[shape=carr,draw] at (5,0) {}; % missing triangle       \draw[shape=carr] (7,0); % nothing shown     \end{tikzpicture}     \end{document}      Looking at the code of other libraries, this seems to be the right way to procede, but correct me if I'm wrong. As you can see from the resulting pdf, the two lower circles in the figures are misplaced a lot, and I don't understand why. The code used to draw the upper circle is taken from the definition of the ellipse in tikz. In addition, I don't know why, if I use an empty label in the node, the rectangle is missing. The last line of code (`\draw[shape=carr....`) is just an experiment. I would like to be able to write such a thing and see in the pdf just the reproduced shape, but I don't know if this is possible. How to change the code to achieve the desider result? Do you think that this is just a waste of time? Suggestions on any direction are welcomed


title: Make Latexdiff work on big, complex project

text: I'm making final corrections to my thesis and, as others (e.g. here and here, on this site) have mentioned, showing the changes you've made from one file to the next to supervisors/examiners is extremely useful. Unfortunately, my files seem too big and complex for latexdiff to work. I have tried using `latexFlatten` and creating a ld.cfg file, both solutions mentioned in the above links. I have also tried using sed to remove all caption, listing and equation environments as these seem to be causing the problems. But I simply cannot make it work and am thinking: there must be a simpler solution actually involving latexdiff and some intelligent tag. So I've created a reproducible example (apologies it is not simple): my old project can be downloaded from here; my new one can be downloaded here. Assuming you unzip the files in a Unix home directory and start in the directory of the new thesis (`cd ~/thesisNew/`), the following should reproduce my problems:                  latexdiff --flatten ../thesisOld/Thesis.tex Thesis.tex > dif.tex      As you will see dif.tex does not compile, and much of the text is garbled. I'm at my wit's end with this and hoping it'll be of use to others tearing their hair out at the performance of latexdiff with big projects like theses.


title: Node below and left of another node in TikZ

text: I am using TikZ to make flowchart kind of diagrams. I want to get a node below and to the left of another node. Please see the following example. I want the replicate the sort of relationship between nodes `revealed` and `WTP measurement`. I have done that by creating an empty node directly below `WTP measurement` and then creating node `revealed` to the left of it. Is there an easier way? As you see in the code, I tried                  \node [level3, below left=of revealed, node distance=2in] (marketdata) {Market Data};      but that does not work. The node `marketdata` is not placed below and to the left of node `revealed`. In fact, it appears above it.               \usemodule[tikz]     \usetikzlibrary[shapes,arrows]          \starttext          % Define block styles     \tikzstyle{level1} = [rectangle, draw, fill=green!40!blue!20,          text width=4in, text centered, inner sep=1pt,          minimum height=4em]     \tikzstyle{level2} = [rectangle, draw, fill=blue!20,          text width=2in, text centered, rounded corners, minimum height=3em]     \tikzstyle{level3} = [rectangle, draw, fill=blue!10,          text width=2in, text centered, rounded corners, minimum height=3em]          \starttikzpicture           % Place nodes         \node [level1] (start) {\color[white]{WTP measurement}};         \node [below of = start, node distance=1in] (blank) { };         \node [level2, right of = blank, node distance=2in] (stated) {Stated Preference};         \node [level2, left of = blank, node distance=2in] (revealed) {Revealed Preference};         \node [level3, below left=of revealed, node distance=2in] (marketdata) {Market Data};                   % Draw edges         \path [line] (start) -- (stated);         \path [line] (start) -- (revealed);         \stoptikzpicture          \stoptext


title: pgfplotsinvokeforeach using parameter

text: The following code works in the minimal example but not in my document               \documentclass{article}     \usepackage{tikz}     \usepackage{pgfplots}     \begin{document}       \pgfplotsinvokeforeach{1,2,...,10} {         \edef\nursery{#1}         \nursery       }     \end{document}      i get the error               ! Illegal parameter number in definition of \pgffor@body.     <to be read again>                         1     l.143 }      somebody knows this problem?


title: How to plot f(x)=sin(x), k(x)=cos(x) and u(x)=x² with TikZ

text: How can we plot the following three functions   * f(x) = sin(x)   * k(x) = cos(x)   * u(x) = x² for x ∈ [0,1] on a single plot with the help of TikZ?


title: Position tikz pictures at left margin of a listing code block

text: I'm trying to finish my attempt at having good looking unlimited line annotations for the listing environments, using tikz. The original problem was that indentation caused shifts in the positioning, so I changed the code to use the overlay feature. My original question is here: How to add numerical (ala No Starch Press) listing notes without XeTeX? Unfortunately, I'm still unable to figure out how to properly align them: **Update** : the code is merged with Werner's version.               \documentclass{article}     \usepackage{libertine}     \usepackage[log-declarations=false]{xparse}     \usepackage[quiet]{fontspec}     \setromanfont[Ligatures={Common,TeX}]{Linux  Libertine O}     \setmainfont[Ligatures={Common,TeX}]{Linux  Libertine O}     \setmonofont[SmallCapsFont={Latin Modern Mono Caps}]{Latin Modern Mono Light}     \setsansfont{Linux Biolinum O}     \usepackage{xunicode}     \usepackage[x11names, rgb]{xcolor}     \usepackage{tikz}     \usetikzlibrary{snakes,arrows,shapes}     \usepackage{amsmath}     \usepackage{listings}          \newcommand{\mynumold}[1]{{\oldstylenums{#1}}}          \newcounter{lstNoteCounter}          \newcommand*\lnnum[2][,]{\tikz[baseline=(char.base), overlay]{                 \node[shape=circle,draw,inner sep=0.8pt,                         fill=black, text=white, #1] (char) {\rmfamily\bfseries\footnotesize#2};}}          \newcommand*{\lnote}{\stepcounter{lstNoteCounter}\llap{{\lnnum{\thelstNoteCounter}}\hskip 4em}}     \newcommand*{\linenum}[1]{%       \setbox0=\hbox{\rmfamily\bfseries\footnotesize#1}%       \lnnum[anchor=west]{#1}\hspace*{\dimexpr1ex+\wd0\relax}%     }     \lstnewenvironment{annotatedcsource}[1][]     {         \setcounter{lstNoteCounter}{0}             \lstset{                 basicstyle=\ttfamily,                 frame=lines,                 framexleftmargin=0.5em,                 framexrightmargin=0.5em,                 basicstyle=\ttfamily\footnotesize,                 numberstyle=\normalsize\itshape\mynumold,                 backgroundcolor=\color{LemonChiffon1},                 showstringspaces=false,                 numbers=left,                 numbersep=2.5em,                 escapeinside={(*@}{@*)},#1}             }     {}          \begin{document}     \pagestyle{empty}          \begin{annotatedcsource}[caption={RC4 blues}]     void     rc4_init(struct rc4_state *const state, const u_char *key, int keylen)     {         u_char j;         int i, k;              /* Initialize state with identity permutation */         for (i = 0; i < 256; i++)             (*@\lnote@*)state->perm[i] = (u_char)i;          state->index1 = 0;         (*@\lnote@*)state->index2 = 0;              /* Randomize the permutation using key data */         for (j = i = k = 0; i < 256; i++) {             j += state->perm[i] + key[k];              (*@\lnote@*)swap_bytes(&state->perm[i], &state->perm[j]);             if (++k >= keylen)                 (*@\lnote@*)k = 0;         }     \end{annotatedcsource}          Some source code doing whatever \linenum{1}, with line numbers and annotations \linenum{2}.          \begin{annotatedcsource}[caption={Hello blues}]     void hello(int times)     {         int i;              (*@\lnote@*)if (times > 4) {             printf("Feeling chatty today?\n");             return;         }              /* foobar */         (*@\lnote@*)for (i = 0; i < times; i++) {             printf("Hello %d!\n", i);         }              printf("Adios!\n");              (*@\lnote@*)return;     }     \end{annotatedcsource}          Some source code doing whatever \linenum{1}, with line numbers and annotations \linenum{2}.          \end{document}      Output: ![incorrectly aligned output makes soze a sad panda](http://i.stack.imgur.com/N1d6k.png) Desired output:   * Properly aligned circled numbers to the left or right margins along the line numbers.      * In other words, the circled numbers must appear outside of the code block box, to the right or left of the line numbers.   * Any kind of source code listing should work fine, no indentation assumptions (please).   * Properly spaced circled numbers for the actual references embedded in the text. Like this: ![enter image description here](http://i.stack.imgur.com/QFGOT.png)


title: Building own letterhead

text: I'm building my own letterhead with LaTeX. I would have:   * a first page with header and footer   * from second page ahead, just header, but different from first page. I've already built a one page letterhead with fancy class (I have a header and a footer with images and text) But, what I'm unable to do is to change the footer and header starting from the second page of the document. So, I think I should understood when first page end, and the use a new header formatting. Isn't it? How can I do that?


title: Is there a way to rotate all pages in XeLaTeX?

text: I known there is a `landscape` command to set horizontal pages, but this is not I want. My purpose is to typeset vertical CJK with `XeLaTeX`. The general approach is using `\rotatebox{-90}` get a vertical paragraph in a box. It works for a single paragraph in one page; The disadvantage is that it can not deal with more complex situations such as multiple pages. I am wondering if there is a way to rotate the all pages?


title: How to seamlessy color the background of a series of \items

text: I need to change the background of a number of (full) `\item`s in a numbered list. I saw the answers to How to highlight an entire paragraph? and (naively) tried to do the following:               \documentclass[12pt,a4paper]{article}     \usepackage[T1]{fontenc}     \usepackage[utf8]{inputenc}     \usepackage[framemethod=tikz]{mdframed}     \newcommand{\blob}{A text which is long, but not so long  as a       \texttt{\textbackslash lipsum}  paragraph and show the       problem about changing the background color}     \begin{document}     \begin{enumerate}       \item \blob       \begin{mdframed}[hidealllines=true,backgroundcolor=blue!20]       \item \blob       \item \blob       \end{mdframed}       \item \blob       \item \begin{mdframed}[hidealllines=true,backgroundcolor=blue!20]             \blob   \end{mdframed}      \end{enumerate}     \end{document}      Unfortunately, that does not work. The first `mdframed` simply stop the listng, and the second way of using it has a strange effect: ![Example rendering](http://i.stack.imgur.com/hzeGV.png) I would like to have just the background change, without changing the list spacing. The change of background _will_ happen sometime across a page break. I tried to use the method proposed in Box around a few items in an itemize environment, but that method has two shortcomings for my application:   * (minor) it can just highlight one section in the list --- if I need a couple of them it doesn't work;   * (major) does not work if the highlighted text cross a page boundary. Next I tried to suspend and resume the list, but it gave me other problems:               \documentclass[12pt,a4paper]{article}     \usepackage[T1]{fontenc}     \usepackage[utf8]{inputenc}     \usepackage{enumitem}     \usepackage{framed,xcolor}     \colorlet{shadecolor}{blue!20}     \newcommand{\blob}{A text which is long, but not so long  as a       \texttt{\textbackslash lipsum}  paragraph and show the       problem about starting and resuming lists multiple times}          \begin{document}       \begin{enumerate}         \item \blob       \end{enumerate}     \begin{shaded}       \begin{enumerate}[resume]         \item \blob         \item \blob       \end{enumerate}     \end{shaded}       \begin{enumerate}[resume]         \item \blob         \item last one       \end{enumerate}     \end{document}      It seemed a good idea, but intermixing the `shaded` environment mangles the `[resume]` option (probably due to locality of definitions into the `shaded` environment): ![Other failed try...](http://i.stack.imgur.com/ZnJ9Q.png)


title: I have included verbatim to show a small section of code, how can I add a comment/caption for this verbatim?

text: I am writing some documentation on a tool I am using at work and I have included some code that has a comment to explain what a particular line is there for, this comment runs off the page if I leave it in the verbatim (which I'm sure is bad practice in it's own right). My question is how can I include this close to my verbatim and make it obvious that it pertains to the verbatim if not the specific line?               \begin{verbatim}     *** Settings ***     Documentation     A test suite with a single test for valid login.            Resource          AdminResource.txt     \end{verbatim}     \caption{The textit{Documentation} is the description that will be shown in the reports generated by RF and at run time when this test suite is running.}


title: Where can I find file latex.tex?

text: Where can I find file latex.tex? I don't have it in my tex distribution. I have only file latex.ltx on my system.   By the way, I'm using Texlive 2010.


title: Centering column in alignat environment?

text: How do I center the contents of each cell in the middle column? I am approximating it with `\phantom`, but there's got to be a better way.               \begin{alignat*}{3}       &E&\quad&\mathrm{par}&&\quad\Sigma,\\       &\Psi&\quad&\phantom{p}\mathrm{"}\phantom{r}&&\quad\frac{\epsilon V}{1+4\pi\epsilon F},\\       &\Psi&\quad&\phantom{p}\mathrm{"}\phantom{r}&&\quad\frac{(1+4\pi\epsilon F)^2}{\epsilon}.     \end{alignat*}      thanks


title: Bibliography problem [LyX & Jabref]

text: I'm an Ubuntu beginner. I'm using LyX to write a paper. For my bibliography I imported a .bib file created with Jabref. I'm facing 2 problems regarding the rendering of the bibliography.   1. While I'm using Jabref I have problems with the "author field". I want to visualize the author in the format "last name, first letter of the first name" but I'm not able to do it. For instance, if I insert "Harrison, J." in the final references it appears "J. Harrison, title of the book" (the letter of the name is before the last name and it should be the opposite). I thought that I could reverse the two and I typed "J., Harrison" in the field box but, while this solves the problem in the References section, it creates a new problem for the citation because instead of appearing the last name of the author it appears just the first letter of the name (instead of "Harrison 2001" it appears "J. 2001").   2. I'm not able to set the order in which the fields has to appear in the References section. I need a format like this: "Last name, first letter of the first name, year, title, editor" but instead i have "last name, first letter of the first name, title, editor, year". Is there a way to change the position of the different fields? I've tried to look in LyX user's guide, in Jabref help section and in a bunch of forums but I haven't been able to find a solution.


title: grid of figures, caption to the left of each row

text: I think the title says it all: I took photos of 5 object from 3 different angles. So for each object there are 3 pics. I would like to display them so there's a row per each object, and in that row the 3 images of that object are displayed. I know I can do this using subfigure\subcaption, but I want a few extra things I don't know how to achieve:   1. I want to remove the labels from below the figures   2. I want to have the object's name to the left of each row, centered vertically. How can I achieve this?


title: Adding multiple paragraphs between aligned equations

text: Some people have asked about how to add multiple paragraphs (when `\intertext` and `\shortintertext` no longer work), a fix was proposed by Peter Grill here: He wrote: > My first thought was to hack apart the result of an `align` and dole out the > lines one-by-one wherever you want them. Alas, `align` produces a list of > considerable complexity and it is not worth the effort to unravel it (if > that's even possible). > > So I made my own alignment environment that, as far as I can tell, does what > you'd want `align*` to do but produces a very simple list. My macro > `\ALineAgain` then picks that list apart and drops the lines one at a time > wherever you ask. > > Because the lines are not printed where the alignment is actually given, it > makes no sense to have an `AlignAgain*`; it never prints equation numbers. > Instead, the `\ALineAgain` macro takes a star that suppresses the addition > of an equation number. The problem with this code is that the equation numbers seem to be messed up once you try referencing them. Below, I've added only a few lines to Peter's code (notably: `\numberwithin{equation}{section}`, two section commands, and then a single line at the very end that attempts to reference the two equations). Rather than printing (1.1) and (1.2), it prints (1.1) and (1.1). There seems to be something wrong with the equations portion of the code. Can anybody spot the problem?               \documentclass{article}     % \usepackage{showframe}     \usepackage{amsmath}          \numberwithin{equation}{section}          % It's like {align}, but simple!     \newenvironment{SimpleAlign}     {%      \let\\=\cr      \tabskip 0pt plus 1fil\relax      \halign\bgroup       &\hfil$\displaystyle ##$\tabskip 0pt\relax       &$\displaystyle {}##$\hfil\tabskip 0pt plus 1fil\relax\cr     }     {%      \crcr\egroup     }          % Saves its contents typeset like SimpleAlign.  You can give it a name.     \newenvironment{AlignAgain}[1][AlignBox]     {%      \expandafter\let\expandafter\AlignAgainBox\csname #1\endcsname      \setbox\AlignAgainBox=\vbox\bgroup\SimpleAlign     }     {%      \endSimpleAlign\egroup      \ReBox\AlignAgainBox     }     \newbox\AlignBox          % Prints the lines from {AlignAgain} one-by-one, with or without equation numbers as starred.  If you named the {AlignAgain}, use it here.     \makeatletter     \newcommand\ALineAgain{%      \@ifstar       {\AlignAgainStartrue\@ALineAgain}       {\AlignAgainStarfalse\@ALineAgain}%     }     \newcommand\@ALineAgain[1][AlignBox]{%      \expandafter\let\expandafter\AlignAgainBox\csname #1\endcsname      \begin{equation*}       \PutFirstBox\ifAlignAgainStar\AlignAgainBox      \end{equation*}     }     \makeatother     \newif\ifAlignAgainStar          % Reboxes a box in the format: {[1][2]...[n]} -> {[1]{[2]{...}[n]}}     % {...} = \hbox     \newcommand{\ReBox}[1]     {%      % To enter internal vertical mode, where \lastbox is valid      \setbox0=\vbox{%       \unvbox#1\relax       \global\setbox#1=\hbox{\hbox{}}       \loop        \unskip        %\box0 is the box currently at the end of #1        \setbox0=\lastbox       \ifvoid0\relax       \else        \global\setbox#1=\hbox{\box0\box#1}%       \repeat      }%     }          % Puts the first box in a nested-box list into the display, saving the rest back in #1     % Optionally places an equation number     \newcommand{\PutFirstBox}[2]{%      \hbox to \displaywidth{%       \unhbox#2\relax       \global\setbox#2=\lastbox       \setbox0=\lastbox       \unhbox0%       #1\else\refstepcounter{equation}\llap{(\theequation)}\fi      }%     }          \begin{document}          \section{First section}     \subsection{A subsection}     Hello     \begin{AlignAgain}      a &= b & c &= d \label{firsteqn} \\      f(x) &= g(x) & h(x) &= e^{-1/x^2} \label{myeqn} \\     \end{AlignAgain}          This is a paragraph with a lot of redundant words whose only purpose is to extend it onto a new line or two so it's dramatic when I display this equation:     \ALineAgain     and then follow it with a bunch more text.          And also a new paragraph, just for good measure.  I wonder if the two equations will line up?  I sure hope so!     \ALineAgain     This is sort of fun.           Can we reference equations by section? Try (\ref{firsteqn}) and (\ref{myeqn}).          \end{document}


title: What are .gf and .pk font files?

text: I've recently read this very interesting thread: How (La)TeX makes use of font related files, i.e., .fd, .map, .enc, .def,etc when selecting fonts?. In the meantime, I've been playing with compiling (for fun) MetaFont `.mf` files found in my MiKTeX distribution. For example, I've compiled the file `cmr10.mf` and it has produced the file `cmr10.2602gf`, which seems to have one of the filetypes mentioned in the above thread (`.gf`, or something similar). Now, given that `.gf` files are the output of MetaFont (or not?),   1. what are they used for? are they only useful for being converted to `.pk` files through `gftopk`?   2. what are exactly `.pk` files and what are they used for? (egreg's answer doesn't mention this filetype)   3. how do I obtain `.tfm` or `.vf` font metric files from MetaFont output, since I seem to understand from that thread that these are the "real" font files searched by LaTeX?


title: How to write an m*n matrix in LaTeX?

text: I tried using the below code but it works only for 2*2 matrix.                \[        M=       \left[ {\begin{array}{cc}        1 & 2 \\        3 & 4 \\       \end{array} } \right]     \]      Now the following doesn't work for me:               \[       M=       \left[ {\begin{array}{cc}        1 & 2 & 3 & 4 & 5\\        3 & 4 & 5 & 6 & 7\\       \end{array} } \right]     \]


title: Notepad++ highlighted code into LaTeX?

text: I want to export my Notepad++ highlighted code into LaTeX. Is it possible? Note that my codes are PHP codes.


title: Redefining \\ within tabu environment to be overlay-aware

text: # Background I would like to "`alert`" each row of a table, one row at a time, using Beamer overlays. Using Martin Scharrer's answer to Why can't I wrap \rowcolor in \only? (Beamer), I came up with the following code:               \documentclass{beamer}     \usepackage{tabu}          \makeatletter     \newcommand{\rowonly}{%         \noalign{\ifnum0=`}\fi         \@rowonly     }     \newcommand<>{\@rowonly}[1]{%         \only#2%             {\ifnum0=`{\fi}#1{\ifnum0=`}\fi}%         \ifnum0=`{\fi}%         \ignorespaces     }     \makeatother          \newcommand*{\alertrow}{\rowonly{\rowfont{\color{red}}}}          \begin{document}     \begin{frame}{}       \onslide<+->       \begin{tabu}{ll}         \rowfont{\itshape\color{structure}}                      Fruit    & Price \\         \alertrow<+> Apples   & \$1 \\         \alertrow<+> Bananas  & \$2 \\         \alertrow<+> Cherries & \$3       \end{tabu}     \end{frame}     \end{document}      Eventually I'd like to package this kind of table into a custom environment, say `alertedfruitprices`, so that it can be reused cleanly. In this environment, it might be nice to redefine `\\\` to function just as `\\\ \alertrow` does above. That is, it might be nice for the following to behave as the above `tabu` does.               \begin{frame}{Example}       \onslide<+->       \begin{alertedfruitprices}         \\<+> Apples   & \$1         \\<+> Bananas  & \$2         \\<+> Cherries & \$3       \end{alertedfruitprices}     \end{frame}      # Problem Unfortunately, I am having trouble getting this to work. Ignoring the `alertedfruitprices` environment and sticking to a direct use of `tabu` for the moment, I tried to use `\let` and `\def\\\` within the first column's preamble, adapting from the answers to how to redefine the `\\` in a tabular environment?.               \documentclass{beamer}     \usepackage{tabu}          \makeatletter     \newcommand{\rowonly}{%         \noalign{\ifnum0=`}\fi         \@rowonly     }     \newcommand<>{\@rowonly}[1]{%         \only#2%             {\ifnum0=`{\fi}#1{\ifnum0=`}\fi}%         \ifnum0=`{\fi}%         \ignorespaces     }     \makeatother          \newcommand*{\alertrow}{\rowonly{\rowfont{\color{red}}}}          \begin{document}     \begin{frame}{Example}       \onslide<+->       \begin{tabu}{>{\let\oldcr\\%                      \def\\{\oldcr\alertrow}}                    ll}         \rowfont{\itshape\color{structure}}               Fruit    & Price         \\<+> Apples   & \$1         \\<+> Bananas  & \$2         \\<+> Cherries & \$3       \end{tabu}     \end{frame}     \end{document}      For some reason, this code does not appear to properly redefine `\\\`, as evidenced by no overlays and the printing of `<+>` at the beginning of each row: ![enter image description here](http://i.stack.imgur.com/zrtTf.png) # Question Can someone please explain why the `\def\\\` is not in effect within the `tabu`?


title: Raggedright and caption package

text: I am trying to format my tables and figures' captions with the `caption` package. What I want is the caption label separated from the caption text by a new line and both of them completly to the left margin. Here is my attempt (and MWE):               \documentclass[a4paper,10pt]{article}     \usepackage[english]{babel}     \usepackage{fontspec}     \usepackage{xunicode}     \usepackage{xltxtra}     \usepackage{threeparttable,booktabs}     \usepackage{lipsum}          \usepackage{ragged2e}     \usepackage{caption}     \captionsetup{%        labelsep=newline,        justification=raggedright,        labelfont=bf     }          \begin{document}     \lipsum[1]     \begin{table}[htpb]\centering     \caption{Title.}     \begin{tabular}{@{}ccc@{}}\toprule       abc & abc & abc \\       abc & abc & abc \\     \bottomrule     \end{tabular}     \end{table}     \lipsum[1]     \end{document}      And this is the output: ![Caption with options enabled](http://i.stack.imgur.com/OkQnY.jpg) This only way to do what I want is to created a long title: ![Long title with option disabled](http://i.stack.imgur.com/cJZXV.png) Then the `raggedleft` option works: ![Long title with raggedleft](http://i.stack.imgur.com/FSXrD.png) Am I missing something ? Why don't `raggedright` and `raggedleft` options work for a sort caption ?


title: TikZ two-blocks matrix

text: I would like to get a plot like the one I sketched below, basically two blocks of the same matrix with arrows going up and anti-diagonally for the red block and arrows going up for the green one. The dots in the middle of the green one means to repeat the same pattern .... And I have as starting point the TikZ code below but I am not sure which would be the easiest way to do ... I struggle still to get conditions in the for loops of TikZ with the complicated markup. ![enter image description here](http://i.stack.imgur.com/up0gc.jpg) As starting point I have this including a commented attempt to create the upper triangular effect omitting the arrows for elements below the diagonal but can't get this code to work.               \begin{figure}[!h]     \centering         \begin{tikzpicture}[scale=1.5]         \clip (-0.3,-1.3) rectangle (8.3,4.3);     %   \foreach \x in {0,...,8} {     %       \foreach \y [evaluate=\y as \z using int(4-\y)] in {0,...,4} {     %           \pgfmathtruncatemacro{\myresult}{\x<\z ? 1 : 0}     %           \ifnum\myresult=0%     %           \node at (\x cm,\y cm) (g-\x-\y) {$a_{\x,\z}$};\fi     %       }     %   }         \foreach \x in {0,...,8} {           \foreach \y [evaluate=\y as \z using int(4-\y)] in {0,...,4} {             \node at (\x cm,\y cm) (g-\x-\y) {$a_{\x,\z}$};           }         }         % vertical dependency         \foreach \x in {0,...,8} {           \foreach \y in {0,...,3} {             \draw[->,shorten <=2pt,shorten >=7pt] (g-\x-\y) -- +(0,20pt);           }         }         % horizontal         \foreach \x in {0,...,7} {           \foreach \y in {0,...,4} {             \draw[<-,shorten >=2pt,shorten >=7pt] (g-\x-\y) -- +(20pt,0);           }         }         % diagonal         \foreach \x in {1,...,8} {           \foreach \y in {0,...,3} {             \draw[->] (\x-.3,\y+.3) -- (\x - .6, \y+.6);           }         }         \end{tikzpicture}     \caption{Triangularize}     \label{fig:triangularize1}     \end{figure}      and the generated image in this case is (but actually I dont need the horizontal arrows): ![enter image description here](http://i.stack.imgur.com/uK6Gq.png)


title: Thumbnails of other frames in beamer

text: I would like to make a presentation with beamer, and have a few frames (at the start or the end) containing thumbnails of the other frames, hyperlinked to them, with something like 4x3 or 5x4 thumbnails per slide. The aim would be to allow easy and quick navigation (just press the `home` or `end` key of the keyboard, and click on the frame you want to go to). # Result of take 3 ## The whole document ![Animated version of the 28 frames generated by the code below](http://i.stack.imgur.com/LdnWa.gif) ## The thumbnails slide Note that if there are too many thumbnails, they nicely spill across several slides. ![The slide 11, with the first part of the thumbnails](http://i.stack.imgur.com/Ysuec.png) ![The slide 12, with the second part of the thumbnails](http://i.stack.imgur.com/eslFd.png) ## `thumbs-3.tex` Compile with:               rm -f thumbs-3-copy.pdf     cp thumbs-3.pdf thumbs-3-copy.pdf     pdflatex thumbs-3.tex      Source:               \documentclass{beamer}     \usepackage{thumbs-3}          \begin{document}          \showthumbs[Welcome]          \begin{frame}\Huge 1\end{frame}          \begin{frame}{With frame title}\Huge 2\end{frame}          \section{Example slides}     \begin{frame}\Huge 3\end{frame}          \subsection{Subsection slides}     \begin{frame}\Huge 4\only<2>{.1}\end{frame}          \subsubsection{Subsubsection slides}     \begin{frame}\Huge 5\end{frame}          \begin{frame}{Subsubsection slide with frame title}\Huge 6\end{frame}          \def\thumbframetitle{Title just for thumbnail}     \begin{frame}{Subsubsection slide with frame title and thumbnail title}\Huge 6\end{frame}     \def\thumbframetitle{}% Stop using a special frame title for thumbnails.          \showthumbs          \section{Random slides}     % Generate some random slides     \begin{onethumb}[2]       \foreach \i in {7,...,10} {         \begin{frame}           \begin{center}             \begin{tikzpicture}               \foreach \c in {0,...,3} {                 \pgfmathsetmacro\r{0.6*rnd+0.3}                 \pgfmathsetmacro\g{0.6*rnd+0.3}                 \pgfmathsetmacro\b{0.6*rnd+0.3}                 \definecolor{CircleColor}{rgb}{\r,\g,\b}                 \node[circle, fill=CircleColor, minimum size=rnd*2cm] at (rnd*5cm-2.5cm, rnd*4cm-2cm) {};               }               \node at (0,0) {\Huge\i};               \path[use as bounding box] (-3.5cm,-3cm) rectangle (3.5cm,3cm);             \end{tikzpicture}           \end{center}         \end{frame}       }     \end{onethumb}          \foreach \i in {11,...,18} {       \begin{frame}{Random slide \i}\Huge\i\end{frame}     }          \begin{frame}[allowframebreaks]{Testing allowframebreaks}       \begin{itemize}       \item A       \foreach \i in {1,...,20} {         \item Very \i       }       \item Long       \item List       \end{itemize}     \end{frame}          \showthumbs[Any questions?]          \end{document}      ## `thumbs-3.sty`               \usepackage{morewrites}     \usepackage{graphicx}     \usepackage{tikz}     \usepackage{etextools}     % http://tex.stackexchange.com/q/40297/5699     \newcommand\addtofrml[1]{%       \write\@auxout{\noexpand\@writefile{frml}{\noexpand #1}}%     }     \newcommand{\loadframelist}{\ifx\thumbtitles\undefined\xdef\thumbtitles{}\fi\@starttoc{frml}}     \newcounter{thumbid}     \setcounter{thumbid}{0}     \newif\ifaddthumb     \newif\ifaddcomma\addcommafalse     \def\testaddthumb{\addthumbtrue}     % Hook at the end of each frame (could work if hooked at the beginning I guess).     \let\thumbframetitle\empty          \setbeamertemplate{background}{%       \addtocounter{thumbid}{1}%       \testaddthumb%       \ifaddthumb%       % Get either the frametitle, current (sub)(sub)section title, or just "Frame 42"       \xdef\thumbtitle{}%       \ifx\thumbtitle\empty\ifx\thumbframetitle\empty\else\xdef\thumbtitle{\thumbframetitle}\fi\fi%       \ifx\thumbtitle\empty\ifx\beamer@frametitle\empty\else\xdef\thumbtitle{\beamer@frametitle}\fi\fi%       \ifx\thumbtitle\empty\ifx\subsubsecname\undefined\else\xdef\thumbtitle{\subsubsecname}\fi\fi%       \ifx\thumbtitle\empty\ifx\subsecname\undefined\else\xdef\thumbtitle{\subsecname}\fi\fi%       \ifx\thumbtitle\empty\ifx\secname\undefined\else\xdef\thumbtitle{\secname}\fi\fi%       \ifx\thumbtitle\empty \xdef\thumbtitle{Frame \arabic{thumbid}}\fi%       % Append ",42/Frame Title" to \thumbtitles       \ifaddcomma%       \addtofrml{%         \xdef\noexpand\thumbtitles{\noexpand\thumbtitles,\arabic{thumbid}/\thumbtitle}%       }%       \else%       \addtofrml{%         \xdef\noexpand\thumbtitles{\arabic{thumbid}/\thumbtitle}%       }%       \global\addcommatrue%       \fi%       \fi%     }          % Should take an overlay specification, but I don't know how to handle these.     \newenvironment{onethumb}[1][4]{%       \gdef\onethumbcount{0}%       \gdef\onethumbgoal{#1}%       \gdef\testaddthumb{%         \count@=\onethumbcount%         \advance\count@ by 1%         \xdef\onethumbcount{\the\count@}%         \ifnum\onethumbcount=\onethumbgoal\relax\addthumbtrue\else\addthumbfalse\fi%       }%     }{%       \gdef\testaddthumb{\addthumbtrue}%     }          \newenvironment{nothumbs}{       \gdef\testaddthumb{\addthumbfalse}     }{       \gdef\testaddthumb{\addthumbtrue}     }          \newcommand\showthumbs[1][]{       {         \setbeamertemplate{frametitle continuation}{}         \begin{nothumbs}           \begin{frame}[allowframebreaks]{#1}             \pgfmathsetmacro\thumbwidth{0.2*\linewidth}             \pgfmathsetmacro\thumbheight{\thumbwidth/\paperwidth*\paperheight}             \loadframelist             \begin{center}               \foreach \thid/\thtitle in \thumbtitles {%                 \hyperlink{page.\thid}{%                   % http://tex.stackexchange.com/a/39601/5699                   \begin{tikzpicture}[baseline={([yshift={-\ht\strutbox}]current bounding box.north)}]                     \node[draw, inner sep=0pt] (thumb) {                       \IfFileExists{\jobname-copy.pdf}{%                         \includegraphics[width=\thumbwidth pt, height=\thumbheight pt, page=\thid] {\jobname-copy.pdf}                       }{%                         \begin{minipage}[t][\thumbheight pt]{\thumbwidth pt}\vfill No thumbnail\vfill\end{minipage}                       }%                     };                     \node[anchor=north, font=\tiny, inner xsep=0pt, inner ysep=0.1cm, yshift=-0.05cm, text width=\thumbwidth pt, align=center] at (thumb.south) {\thtitle};                   \end{tikzpicture}%                 } % space here, outside of hyperlink               }%             \end{center}           \end{frame}         \end{nothumbs}       }     }      # Take 1 Here's a first ( _a posteriori_ , added long after the question was asked) attempt :   * Use tikz's `\foreach` loop to produce a series of `\includegraphics` including pages of the PDF generated by the previous compilation.   * ~~The`totcount` package should help knowing the range of frames (pages) to include.~~( **edit** : Instead I wrote the titles and frame numbers of each frame that has a thumbnail.)   * `\hyperlink{page.42}{\includegraphics...}` should turn those thumbnails to hyperlinks (from this TeX.SX answer). `thumbs-1.tex`:               \documentclass{beamer}     \usepackage{thumbs-1}          \begin{document}      `\showthumbs` inserts one or more frames containing thumbnails of the other frames, hyperlinked to the actual frame. It can be called at the beginning of the document:               \showthumbs      Some slides with and without `\frametitle`s, inside and outside of various levels of (sub)(sub)sections:               \begin{frame}\Huge 1\end{frame}     \begin{frame}{With frame title}\Huge 2\end{frame}     \section{Example slides}     \begin{frame}\Huge 3\end{frame}     \subsection{Subsection slides}      A frame with an ovelay:               \begin{frame}\Huge 4\only<2>{.1}\end{frame}     \subsubsection{Subsubsection slides}     \begin{frame}\Huge 5\end{frame}     \begin{frame}{Subsubsection slide with frame title}\Huge 6\end{frame}     \section{Random slides}      `\showthumbs` can be called multiple times, and in the middle of the document:               \showthumbs      Some random slides, with a single thumbnail (for the second in the group):               \begin{onethumb}[2]       \foreach \i in {7,...,10} {         \begin{frame}           \begin{center}             \begin{tikzpicture}               \foreach \c in {0,...,3} {                 \pgfmathsetmacro\r{0.6*rnd+0.3}                 \pgfmathsetmacro\g{0.6*rnd+0.3}                 \pgfmathsetmacro\b{0.6*rnd+0.3}                 \definecolor{CircleColor}{rgb}{\r,\g,\b}                 \node[circle, fill=CircleColor, minimum size=rnd*2cm] at (rnd*5cm-2.5cm, rnd*4cm-2cm) {};               }               \node at (0,0) {\Huge\i};               \path[use as bounding box] (-3.5cm,-3cm) rectangle (3.5cm,3cm);             \end{tikzpicture}           \end{center}         \end{frame}       }     \end{onethumb}      Other dummy slides, with one thumbnail each:               \foreach \i in {11,...,20} {       \begin{frame}{Dummy slide \i}\Huge\i\end{frame}     }      `\showthumbs` can be called multiple times, and at the end of the document:               \showthumbs          \end{document}      ## `thumbs-1.sty`:               \usepackage{graphicx}     \usepackage{tikz}     \usepackage{etextools}      Using information from this question, write a list of frame numbers and frame titles to the aux file:               \newcommand\addtofrml[1]{%       \write\@auxout{\noexpand\@writefile{frml}{\noexpand #1}}%     }     \newcommand{\loadframelist}{\ifx\thumbtitles\undefined\xdef\thumbtitles{}\fi\@starttoc{frml}}     \newcounter{thumbid}     \setcounter{thumbid}{0}     \newif\ifaddthumb     \def\testaddthumb{\addthumbtrue}      Hook at the end of each frame (could work if hooked at the beginning I guess):               \setbeamertemplate{background}{%       \addtocounter{thumbid}{1}%       \testaddthumb%       \ifaddthumb%      The thumbails are labeled with the `\frametitle`, `susubsection` title, `subsection` title, `section` title or "Frame ", in that order of preference:                 \xdef\thumbtitle{%         \ifx\beamer@frametitle\empty%         \ifx\insertsubsubsectionhead\empty%         \ifx\insertsubsectionhead\empty%         \ifx\insertsectionhead\empty%         Frame \arabic{thumbid}%         \else\insertsectionhead\fi%         \else\insertsubsectionhead\fi%         \else\insertsubsubsectionhead\fi%         \else\beamer@frametitle\fi%       }%      Append `,42/Frame Title` to the `\thumbtitles` macro:                 \ifaddcomma       \addtofrml{%         \xdef\noexpand\thumbtitles{\noexpand\thumbtitles,\arabic{thumbid}/\thumbtitle}%       }%       \else       \addtofrml{%         \xdef\noexpand\thumbtitles{\arabic{thumbid}/\thumbtitle}%       }%       \global\addcommatrue       \fi       \fi%     }      `\begin{onethumb}[42]…\end{onethumb}` allows one to have just one thumbnail (of the 42th frame in the group, one by default) for a group of frames. This should really use beamer's overlay specification, to allow having a thumbnail for frames 2 to 4 and 6 by typing `\begin{onethumb}<2-4,6>…\end{onethumb}`, but I haven't implemented that yet.               \newenvironment{onethumb}[1][5]{%       \gdef\onethumbcount{0}%       \gdef\onethumbgoal{#1}%       \gdef\testaddthumb{%         \count@=\onethumbcount%         \advance\count@ by 1%         \xdef\onethumbcount{\the\count@}%         \ifnum\onethumbcount=\onethumbgoal\relax\addthumbtrue\else\addthumbfalse\fi%       }%     }{%       \def\testaddthumb{\addthumbtrue}%     }      `\begin{nothumbs}…\end{nothumbs}` disables the creation of thumbnails for the enclosed frames.               \newenvironment{nothumbs}{       \def\testaddthumb{\addthumbfalse}     }{       \def\testaddthumb{\addthumbtrue}     }          \def\showthumbs{      The frames containig the thumbnails, generated by `\showthumbs`, are enclosed in `\begin{nothumbs}…\end{nothumbs}`, otherwise after the second compilation, they would contain a copy of themselves, and more recursively at each compilation, so the PDF would grow larger and larger.                 \begin{nothumbs}         \begin{frame}[allowframebreaks]           \pgfmathsetmacro\thumbwidth{0.2*\linewidth}           \pgfmathsetmacro\thumbheight{\thumbwidth/\paperwidth*\paperheight}           \loadframelist           \begin{center}      Loop over the `\thumbtitles` macro defined in the `.aux`/`.frml` file.                       \foreach \thid/\thtitle in \thumbtitles {%               \hyperlink{page.\thid}{%      Adjust vertical alignment of the tikzpicture containing the thumbnail and its label using this answer:                           \begin{tikzpicture}[baseline={([yshift={-\ht\strutbox}]current bounding box.north)}]      The framed and scaled thumbnail:                             \node[draw, inner sep=0pt] (thumb) {%                     \includegraphics[width=\thumbwidth pt, height=\thumbheight pt, page=\thid] {\jobname.pdf}%                   };      The label, below the thumbnail:                             \node[anchor=north, font=\tiny, inner xsep=0pt, inner ysep=0.1cm, yshift=-0.05cm, text width=\thumbwidth pt, align=center] at (thumb.south) {\thtitle};                 \end{tikzpicture}%      Insert a space between each thumbnail, but only one (the rest of the lines that matter swpace-wise end with a `%`). The space must be outside the `\hyperlink`, as explaind in this answer to my follow-up question.                         } % space here, outside of hyperlink             }%           \end{center}         \end{frame}       \end{nothumbs}     }      What I don't know is how to run the `\includegraphics` commands only if the PDF exists, like during first compilation. Running the `\includegraphics` commands then would cause an error, and no PDF would be generated because of the error… Chicken and egg problem :) . I'd appreciate a solution to this last problem (running `\includegraphics` commands only if the PDF exists), or any other approach to automatically generating those slides. # Take 2 With kurt's comment/answer, I can run \includegraphics commands conditionnally. I simply replace this code (at the end of the `.sty`):               \node[draw, inner sep=0pt] (thumb) {%       \includegraphics[width=\thumbwidth pt, height=\thumbheight pt, page=\thid] {\jobname.pdf}%     };      By this one:               \node[draw, inner sep=0pt] (thumb) {%       \IfFileExists{\jobname.pdf}{%         \includegraphics[width=\thumbwidth pt, height=\thumbheight pt, page=\thid] {\jobname.pdf}%       }{%         \begin{minipage}[t][\thumbheight pt]{\thumbwidth pt}\vfill No thumbnail\vfill\end{minipage}%       }%     };      I now have another problem: When `pdflatex` is generating the document, it overwrites the pdf from which `\includegraphics` will try to read. MWE:               \documentclass{beamer}     \usepackage{graphicx}     \usepackage{tikz}     \begin{document}          \begin{frame}\Huge 1\end{frame}     \begin{frame}\Huge 2\end{frame}     \begin{frame}\Huge 3\end{frame}     \begin{frame}\Huge 4\end{frame}          \begin{frame}       \foreach \i in {1,...,4} {         \IfFileExists{\jobname.pdf}{%           \fbox{\includegraphics[width=0.2\linewidth, page=\i] {\jobname.pdf}}%         }{No thumbnail}       }     \end{frame}          \end{document}      When I run the above example, I get the following error, since `\jobname.pdf` has already been opend for writing and truncated by `pdflatex`:               Error: PDF file is damaged - attempting to reconstruct xref table...     Error: Couldn't find trailer dictionary     Error: Couldn't read xref table          !pdfTeX error: pdflatex (file ./thumbs.pdf): xpdf: reading PDF image failed      # Take 3 If instead, I manually copy `\jobname.pdf` to `\jobname-copy.pdf` ( **edit** : changed `.copy.pdf` to `-copy.pdf` after Kurt said it failed for him with a dot, and it also faild for me sometimes) after each compilation, and use the following code in the `.sty`, it works fine:               \node[draw, inner sep=0pt] (thumb) {%       \IfFileExists{\jobname-copy.pdf}{%         \includegraphics[width=\thumbwidth pt, height=\thumbheight pt, page=\thid] {\jobname-copy.pdf}%       }{%         \begin{minipage}[t][\thumbheight pt]{\thumbwidth pt}\vfill No thumbnail\vfill\end{minipage}%       }%     };      Compilation needs to be done this way:               rm -f thumbs-3-copy.pdf     cp thumbs-3.pdf thumbs-3-copy.pdf     pdflatex thumbs-3.tex      When the number of frames in the document decreases, during the next (second) compilation, the `\includegraphics` shall fail, preventing the generation of the PDF. Then, the `thumbs-3-copy.pdf` file is removed, and a new copy fails to be created (because the PDF generation failed). So at the next (third) compilation, since the `thumbs-3-copy.pdf` file is absent, no`\includegraphics` is attempted, and the generation succeeds. At the next (fourth) compilation, the thumbnails are finally created. If you don't understand the above, try reducing the number of frames from 5 to 2 (for example), without running the `rm` command: compilation will fail permanently. With the `rm`, everything is settled after something like 4 compilations. # Take 4 I tried to automatically copy the pdf (using this TeX.SX question's answers), but even if I run the copy just after `\documentclass{beamer}`, the copy is still a truncated file (the code breaks if I move the copy code before the `documentclass`, but I don't think it will make a difference). Here's the code doing the copy:               \documentclass{beamer}     \newread\in%     \openin\in=\jobname.pdf%     \newwrite\out%     \immediate\openout\out\jobname-copy.pdf%     \endlinechar-1%     \loop \unless\ifeof\in%             \readline\in to\l%             \immediate\write\out{\l}%     \repeat%     \immediate\closeout\out%     \closein\in%     \usepackage{graphicx}     \usepackage{tikz}     \begin{document}          \begin{frame}\Huge 1\end{frame}     \begin{frame}\Huge 2\end{frame}     \begin{frame}\Huge 3\end{frame}     \begin{frame}\Huge 4\end{frame}          \begin{frame}       \foreach \i in {1,...,4} {         \IfFileExists{\jobname-copy.pdf}{\fbox{\includegraphics[width=0.2\linewidth, page=\i] {\jobname-copy.pdf}}}{No thumbnail}       }     \end{frame}          \end{document}      So I'd like to know if it's possible to tell (La)TeX to backup the old PDF file before generating a new one, using only (La)TeX code. # Take 5 Kurt and I thought this wasn't possible, as `pdflatex` had already opened and truncated the file by the time it is copied, which results in a copy containing a single newline byte. **We were wrong.** `pdflatex` doesn't open the output file until it has something to do with it, and it won't open it before the `\documentclass{beamer}` (actually, it doesn't even open it after a `\documentclass{article}`). So, by moving the copy code _above_ the `\documentclass{beamer}`, and by adding `\endlinechar13` to prevent beamer from breaking, one can copy the pdf file.               \newread\in%     \openin\in=\jobname.pdf%     \newwrite\out%     \immediate\openout\out\jobname-copy.pdf%     \endlinechar-1%     \loop \unless\ifeof\in%     \readline\in to\l%     \immediate\write\out{\l}%     \repeat%     \immediate\closeout\out%     \closein\in%     \endlinechar13%     \documentclass{beamer}     \usepackage{graphicx}     \usepackage{tikz}     \begin{document}          \begin{frame}\Huge 1\end{frame}          \end{document}      However, the copied PDF is damaged, because when `\read` reads a line, it drops any trailing spaces, which are important in this case. # Take 6 I asked how to read from a file including trailing spaces, but the answers are disapointing~:   * No hope with plain TeX.   * Pdf(La)Tex provides `\pdffiledump`, which solves the reading problem, but the way non-ASCII bytes are written (when you write to the copy) is implementation-dependant.   * One can perform the copy in lua, when using Lua(La)Tex, but not everybody uses Lua(La)Tex. # Conclusion So it seems the best solution when using `\includegraphics` is either to copy the PDF manually, or use Lua(La)Tex (wich is the future, but not as widespread as it "should" I guess, see this very interesting interview of Andrew Stacey on TeX.SX's [http://tex.blogoverflow.com/](community blog)). I have provided as an answer below a proof of concept that re-`\input`s the tex file, and generates the thumbnails without relying on the PDF from a previous compilation, but it's much more fragile than the `\includegraphics` version. # References (Non-exhaustive) list of stuff I used/didn't use while working on this:   * Overlay specifications:      * How to write overlay-specification–aware macros that work w/o the beamer class     * Extract the logically first slide in a Beamer overlay specification?   * Generating the list of slides:      * Create a list of beamer slides     * How to get the current (sub)(sub)section name: What variable current section name? on latex-community.org     * Choose between the frame title, (sub)(sub)section and default string: What is the difference between \empty and \@empty?     * Use a loop to generate a list for another (foreach) loop   * Alignment of the thumbnails (with their text): http://tex.stackexchange.com/a/39601/5699   * PDF hyperlinks to a given page     * And avoiding page breaks within links   * File copy:      * File copy without expansion     * Flush latex file io buffers     * Include binary data     * How to copy contents of one file to another?     * My own question: \read: trailing spaces are removed, with two excellent answers     * `\write` non-printable ASCII characters to a file     * In a desperate attempt, I wanted to change the `\jobname` half of the time, but it won't affect the PDF file name: How to influence the name of the pdf file created with pdfLaTeX (from within the source code)?   * Andrew Stacey's interview   * `\tracingall` (I keep forgetting the name of that one !)


title: \cite suddenly producing "Undefined control sequence"

text: My document was compiling correctly, including bibliography (in same directory as .tex file). Now all the citations are suddenly producing undefined control sequence errors. Also, some errors of \@year@ doesn't match its definition errors, still for citations. Looks like this:               \documentclass[jou,apacite]{apa6}     \usepackage{url}     \def\UrlBreaks{\do\/\do-}     \title{foo}     \shorttitle{bar}     \author{me}     \affiliation{Uni}     \rightheader{APA style}     \leftheader{me}     \begin{document}     \maketitle            Blabla~\cite{Author1979}.          \bibliography{BetterBibTex}     \end{document}


title: list of pdf pages

text: I need to add quite a few extra pdf files at the end of my report. Is there a way to create a list of these pages (named list of evidence) following the table of contents? Edit to question: I have realised how obscure it may all look now if you look at comments below. Let me clarify what it is that I'm after. I'm writing a report that needs numbered paragraphs. I also need to mark what paragraphs contain mention of evidence to statements in the report. This needs to be marked on the RHS in the margin (I'm doing that with the \ev command) The evidence needs to be added in a sequence of mention in the report at the end of the report. All of my evidence are pdf files (usually 1-5 pages long). So what I originally was after is a way to include a list of that evidence in the TOC (as sections), so that I can have a name of each evidence in section name to appear in the TOC and in the footer to identify it for the reader. I also don't want the evidence section heading to appear in the text (hence \invisiblesection). Hope this makes it a bit clearer now. Apologise for any confusion caused. The intended ToC should look something like that Contents   1. Section...................................2 1.1 Subsection..............................2 1.2 Subsection..............................3 1.2.1 Subsubsection...............4 .... .... List of Evidence Evidence 1....................40 Evidence 2.....................41 Evidence 3.....................46 .... Code EDIT#2               \documentclass[12pt,a4paper]{article}     \usepackage[utf8]{inputenc}     \usepackage[english]{babel}     \usepackage{amsmath}     \usepackage{amsfonts}     \usepackage{amssymb}     \usepackage{graphicx}     \usepackage{latexsym}     %\usepackage{fullpage}     \usepackage[a4paper,margin=1in,headheight=.4in,headsep=12pt,heightrounded]{geometry}     \usepackage{float}     \usepackage{indentfirst}     \usepackage[font=footnotesize,format=plain,labelfont=bf,up,textfont=it,up]{caption}     \usepackage{subfig}     \usepackage{booktabs}     \usepackage{appendix}     \usepackage{verbatim}     \usepackage{setspace}     \usepackage{rotating}     \usepackage{array}     \usepackage{multirow}     \usepackage{wrapfig}     \usepackage[parfill]{parskip}     \usepackage{pdfpages}     \usepackage{fancyhdr}                %to get para numbers in the margins          \usepackage{lipsum} % for dummy text     \usepackage{hyperref}           \newcounter{numpar}      \newcommand{\np}[1][]{%         \par       \refstepcounter{numpar}%       \noindent         \makebox[0pt][r]{%         \makebox[0pt][l]{\textbf{\thenumpar}}%         \qquad        }%       #1%        \ignorespaces      }           %evidence counter     \newcounter{evidence}     \newcommand{\ev}{%        \stepcounter{evidence}%        \marginpar{\textbf{EV\theevidence}}%      }           \pagestyle{fancy}      \lhead{\begin{footnotesize}      Headerline 1\\Headerline2      \end{footnotesize}}           \rhead{\begin{footnotesize}      headerline1      \end{footnotesize}}           \lfoot{\begin{scriptsize}      \leftmark       \end{scriptsize}}            \cfoot{}            \rfoot{Page \thepage}            \renewcommand{\headrulewidth}{0.4pt}       \renewcommand{\footrulewidth}{0.4pt}            \makeatletter       \newcommand\invisiblesection[1]{%       \refstepcounter{section}%       \addcontentsline{toc}{section}{\protect\numberline{\thesection}#1}%       \sectionmark{#1}}       \makeatother            \def\evidence#1{%#2{ %#3{%       \label{#1}}                 \begin{document}            \thispagestyle{empty}       \tableofcontents       \pagebreak       \pagenumbering{arabic}            \section{A sectoion}       \np text       \np text \ev       \np text \ev       \subsection{A subsection}     ....     ....     Main text of the report     ....     ....     End of text      \pagebreak               \evidence{evi:abstract}\invisiblesection{EV1}\includepdf[scale=0.92,pages=1,pagecommand=    {\pagestyle{fancy}}]{evidence1.pdf}            \evidence{evi:abstract}\invisiblesection{EV2}\includepdf[scale=0.92,pages=1,pagecommand={\pagestyle{fancy}}]{evidence2.pdf}                 \end{document}


title: Centering y-axis label

text: The question is, how to vertically align the label to the middle of the y-axis. It seems that the code above first rotate the label and then move it above. The complete example is pasted below. The code in question is:               \node[rotate=90, above=1] at (y axis mid) {long label};      ![enter image description here](http://i.stack.imgur.com/NIKLr.png)               \begin{tikzpicture}[scale=0.6]     \draw[help lines] (0,0) grid[xstep=1.5,ystep=1] (6,6);          % Axis     \draw[->,>=latex'] (0,0) -- coordinate (x axis mid) (6.5,0);     \draw[->,>=latex'] (0,0) -- coordinate (y axis mid) (0,6.5);          % Labels     \node[below=0.2] at (x axis mid) {long label};     \node[rotate=90,above=1] at (y axis mid) {long label};          \draw[red,very thick] (0,0) -- (0,3) -- (3,3) -- (3,6) -- (6,6);     \end{tikzpicture}


title: How label position and color can be modified in tikzpicture in posters?

text: I am working on a poster with fancytikzposter package, I cutted out the problematic part, it can be downloaded from here. I created a tikzpicture inside the poster and some problems occured:   1. labels are black and I want to change their colors to white, but I could not find out how   2. labels are far from the nodes they belong to, I want to move them closer to the nodes   3. one extra (but not so important): is it possible to mirror the frame of the labels on the second line (when labels are below the nodes)? ![The problematic tikzpicture](http://i.stack.imgur.com/HFEW7.png) Here is the code which belongs the tikzpicture above               \tikzstyle{input} = [draw, rectangle, rounded corners]          \begin{tikzpicture}[node distance=0.26\textwidth,>=latex', line width=4pt,anchor=south]         \node [input, label={original} ] (signOrig) { \includegraphics[width=.14\textwidth]{Erika2b} };         \node [input, label={grayscale},  right of=signOrig] (signGr) { \includegraphics[width=.14\textwidth]{Erika2b} };         \node [input, label={binary},     right of=signGr] (signBin) { \includegraphics[width=.14\textwidth]{Erika_segm} };         \node [input, label=below:{edges},      below of=signBin, node distance=0.3\textwidth] (signGray) { \includegraphics[width=.14\textwidth]{Erika2_edgeb} };         \node [input, label=below:{segmented},  left of=signGray] (signDilate) { \includegraphics[width=.14\textwidth]{Erika_segm}};         \node [input, label=below:{centerline}, left of=signDilate] (signBw) { \includegraphics[width=.14\textwidth]{Erika_skel}};              \draw [->] (signOrig)   -- (signGr);         \draw [->] (signGr)     -- (signBin);         \draw [->] (signBin)    --  (signGray);         \draw [->] (signGray)   -- (signDilate);         \draw [->] (signDilate) -- (signBw);     \end{tikzpicture}


title: tikzscale not working with subcaptionbox?

text: I have some complicated `tikz` pictures that I don't want to manually resize (therefore `tikzscale`) - but putting several in a figure doesn't seem to work with `\subcaptionbox`. It _does_ work with `subfigure` (also from the `subcaption` package), but then the captions are not aligned if the number of lines per caption differ. For the MWE one needs to create a `square.tikz`-file with the following content (obviously this is a simplification to illustrate the problem ;-))               \begin{tikzpicture}     \draw (-10,-10) rectangle (10,10);     \end{tikzpicture}      Then the code is               \documentclass{article}     \usepackage[english]{babel}     \usepackage{tikz}     \usepackage{tikzscale}     \usepackage[justification=centering]{subcaption}          \begin{document}          \begin{figure}         \subcaptionbox{One-line caption}[0.5\textwidth]{\includegraphics[width=\textwidth]{square.tikz}}         \subcaptionbox{Two-line caption \\ is aligned}[0.5\textwidth]{\includegraphics[width=\textwidth]{square.tikz}}         \caption{With \texttt{subcaptionbox}}     \end{figure}          \begin{figure}         \begin{subfigure}{0.5\textwidth}             \includegraphics[width=\textwidth]{square.tikz}             \caption{One-line caption}         \end{subfigure}         \begin{subfigure}{0.5\textwidth}             \includegraphics[width=\textwidth]{square.tikz}             \caption{Two-line caption; \\ should be aligned with one-line caption}         \end{subfigure}         \caption{With \texttt{subfigure}}     \end{figure}          \end{document}


title: Extra space in front of keywords in listings

text: Does anyone know why I'm getting extra spaces in front of the keywords in my code listings? I've attached a picture of one of my listings that I've compile with `showspaces=true` and `showtabs=true`. You can clearly see gaps in front of the `void`, `range`, `int`, and other keywords. However these gaps aren't denoted as being spaces with the underscoring. The styles I'm using are:               basicstyle=\ttfamily\footnotesize,     keywordstyle=\color{black}\bfseries\rmfamily\footnotesize,      Also there are no spaces in front of any of the keywords in the `keywords={` or `morekeywords={` sections of my language definition. Is it something to do with the change in font families between the keywords and regular identifiers? Does anyone have any suggestions how I can get rid of them? ![Example of code listing with extra spaces](http://i.stack.imgur.com/GHzCr.jpg)


title: Latex, remove blanks between sections in a chapter

text: I am writing thesis with 10 chapters, each of them has multiple sections. In Latex, I put each section in a separate file. But, there are blank spaces between sections in each chapter in the pdf file. how to remove the blank meanwhile still keeping each section in separate .tex file ? Any help will be appreciated.


title: Illegal unit of measure(pt inserted)

text: I can't find my fault and appreciate any help for curing the error. Here is the code:               \documentclass[a4]{paper}     \usepackage{graphicx,slashed,color,amssymb}     \usepackage{xspace,colortbl,times,pause}     %\documentstyle[preprint,aps]{revtex}     \renewcommand{\baselinestretch}{1.6}     \begin{document}     \title{QFT}     \author{Athos\CZ}     \date{March 11, 2012}     \begin{eqnarray}     [\gamma^\nu,\sigma_{\alpha\beta}]w^{\alpha\beta}g_\alpha^\nu&=&4i\gamma^\mu w_\mu^\nu g_\beta^\mu\nonumber\\     [\gamma^\nu,\sigma_{\alpha\beta}]w^{\nu\beta}&=&4i\gamma^\mu w_\beta^\nu\\     \end{eqnarray}      I want to write two formula, but can do it. However, if I set the two formula apart as:               \begin{eqnarray}     [\gamma^\nu,\sigma_{\alpha\beta}]w^{\alpha\beta}g_\alpha^\nu&=&4i\gamma^\mu w_\mu^\nu g_\beta^\mu\nonumber\\     \end{eqnarray}     \begin{eqnarray}     [\gamma^\nu,\sigma_{\alpha\beta}]w^{\nu\beta}&=&4i\gamma^\mu w_\beta^\nu\\     \end{eqnarray}      there will be no problem. I'm so confused.


title: Latex Beamer Class Remove Section from Headline

text: I want to remove a few sections from the headline in `beamer` class. How do I remove them? I want them in my TOC but don't want them in my headline as that becomes too big then. I tried this but this removes the entire headline.               %\setbeamertemplate{headline}{}


title: Move Beamer header down

text: I did a dry run of a presentation I'm giving and I noticed that when in full screen mode, the projector is cutting off a little bit of all four sides of the slide (appears to be overscan). I've tried getting the projector and laptop to correct for it but have been unsuccessful. As a hack, I'd like to just increase the distance between the header and footer and the edge of the slide. The style file I'm using contains               \ProvidesPackageRCS $Header: /cvsroot/latex-beamer/latex-beamer/themes/theme/compatibility/beamerthemeshadow.sty,v 1.12 2007/01/28 20:48:30 tantau Exp $          \mode<presentation>          \definecolor{BYUblue}{RGB}{0,31,69}     \definecolor{BYUgold}{RGB}{195,163,106}     \usecolortheme[RGB={0,31,69}]{structure} % BYU Blue          \usetheme{Frankfurt}     \setbeamercolor*{section in head/foot}{bg=BYUblue,fg=gray!25}     \setbeamercolor*{frametitle}{bg=BYUblue!50,fg=white!25}     \setbeamercovered{transparent}     \mode<all>          \addtobeamertemplate{frametitle}{}{%     \begin{textblock*}{100mm}(0.95\textwidth,-0.7cm)     \includegraphics[width=1.2cm]{figures/magiccLabLogo}     \end{textblock*}}          % define the footline     \defbeamertemplate*{footline}{infolines theme}     {       \leavevmode%       \hbox{%       \begin{beamercolorbox}[wd=.25\paperwidth,ht=2.25ex,dp=2ex,left]{author in head/foot}%         \hspace*{2mm}     %        \usebeamerfont{author in head/foot}\insertshortauthor~~(\insertshortinstitute)             \usebeamerfont{author in head/foot}\insertshortauthor       \end{beamercolorbox}%       \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=2ex,center]{title in head/foot}%             \usebeamerfont{title in head/foot}\insertshorttitle             \hspace*{2mm}       \end{beamercolorbox}}%       \begin{beamercolorbox}[wd=.25\paperwidth,ht=2.25ex,dp=2ex,right]{author in head/foot}%             \usebeamerfont{author in head/foot}\insertpagenumber/\insertpresentationendpage             \hspace*{2mm}       \end{beamercolorbox}%       \vskip0pt%     }          \setbeamertemplate{navigation symbols}{} % no nav symbols        I moved the footer up by increasing the dp setting of the beamercolorboxes to 2ex in the above footline definition above. Is there an easy way like that do that for the header? This is what I have ![This is what I have](http://i.stack.imgur.com/rGVR6.png) This is what I want - just a little additional space just above the section titles ![This is what I want](http://i.stack.imgur.com/Fx1xu.png)


title: Length of \vfill

text: Is there a way to get the size of `\vfill`? I want to do some math with the spacing, and I already tried to do:               \newlength{\newtest}     \settowidth{\newtest}{\vfill}      I got an error. Any sugestions?


title: Inline LaTeX code and result of the code (similar to showexpl)

text: I would like to write a macro that works somewhat like showexpl but just reproduces the LaTeX code and the results of the code in a way that I can use _inline_.               \documentclass{article}     \usepackage{fancyvrb}     \begin{document}     I want a macro that produces something like ``\verb|$\bar\mathbf{x}$| produces $\bar\mathbf{x}$''.     \end{document}      Is this possible?


title: Clipping support in XeTeX

text: In pdflatex I'm used to clip graphics using something like this:               \includegraphics[trim=14mm 0mm 14mm 0mm,clip,width=1.2cm]{image.jpg}      When I attempt this in XeLaTeX, no clipping occurs and I get a warning: > Package xetex.def Warning: No clipping support in XeTeX yet It is obvious, that I could clip the image with a separate tool outside TeX, but for several reasons I would like to do this automatically from inside TeX (e.g. when migrating large old documents to XeTeX without messing around with the files) Two questions:   1. Is there any workaround I should be aware of to do the clipping automatically during the TeX run? E.g. by replacing `\includegraphics` by something else (TikZ?)   2. Does anyone know if someone is working on clipping from inside XeTeX? Maybe there is a beta I could try?


title: How to convert TikZ coordinates into PGF coordinates?

text: I have several coordinate specified in TikZ, say               \coordinate (a) at (0.4, 1.7);     \coordinate (b) at (3.2, 1.7);     \coordinate (c) at (1.7, 4.7);     \coordinate (cog) at ($1/3*(a) + 1/3*(b) + 1/3*(c)$);      Now I'm trying to use the `(cog)` coordinate in PGF commands, for example:               \pgftransformshift{<the (cog) coordinate>}      I already tried putting in `(cog)` or `cog` but it doesn't work as desired. So my question is: How do I convert my coordinate specified in TikZ so that I can use it inside PGF commands?


title: Caption centering does not work

text: I am using `subcaption` package to plot subfloats in my report. However, the caption for subfigures are not centered. Here is what I have done:               \documentclass[10pt]{report}     \usepackage{epsfig,cite,amsfonts,amssymb,psfrag,balance}     \usepackage[centertags]{amsmath}     \usepackage{amsthm}     \usepackage{newlfont}     \usepackage[ansinew]{inputenc}     \usepackage[justification=centering]{caption}     \usepackage{graphicx,subcaption}     \usepackage{dsfont}     \usepackage{morefloats}          \begin{subfigure}{0.33\textwidth}         \centering         \psfrag{lambda}[][][1.5]{$\log_{10} (\lambda)$}         \psfrag{N}[][][1.5]{Channel Noise Power, $N$}         \resizebox{8cm}{!}{\epsfbox{P3_N_vary.eps}}         \caption{Achievable}         \label{fig:p3_graph1}     \end{subfigure}     \hspace{2.5cm}     \begin{subfigure}{0.33\textwidth}         \centering         \psfrag{lambda}[][][1.5]{$\log_{10} (\lambda)$}         \psfrag{Ps}[][][1.5]{Encoder transmit power, $\ps$}         \resizebox{8cm}{!}{\epsfbox{P3_ps_vary.eps}}         \caption{Achievable }         \label{fig:p3_graph2}     \end{subfigure}     \caption{}     \end{figure}      Am I missing something here? Can somebody help me out please?


title: Problems with implementing glossary.engine in TeXShop

text: I followed the instruction from Creating Glossaries in TeXShop on Mac but the created engine did not appear (even not with Emacs). Here is what I did: I created `glossary_run.engine` with `TextEdit` (and later also with Emacs):               #!/bin/sh          bfname=$(dirname "$1")/"`basename "$1" .tex`"          makeindex -s "$bfname".ist -t "$bfname".alg -o "$bfname".acr "$bfname".acn     makeindex -s "$bfname".ist -t "$bfname".glg -o "$bfname".gls "$bfname".glo      I saved the file in `/Applications/TeX/TeXShop.app/Contents/Resources/TeXShop` and then run               chmod a+x glossary_run.engine      in `Terminal`, started `TeXShop`but could not find `glossary_run` in the dropdown-menu. Has anyone an idea what went wrong?


title: Caption and sections, subsections and subsubsections

text: I'm writing my thesis in Latex and this is the first time ever for me to use it. I've figured out a lot of things except this one - I need custom captions for pictures that are connected with sections, subsections, etc. I've put this lines in my preamble               \usepackage{chngcntr}     \counterwithin{figure}{section}     \counterwithin{figure}{subsection}     \counterwithin{figure}{subsubsection}      but when I'm using images in section it looks like this: ![Image with subsubsection that doesn't match](http://i.stack.imgur.com/lOmgA.jpg) And it should look like this: ![The way it should look like](http://i.stack.imgur.com/km8pB.jpg) What I need is a way to keep this look in subsections and subsubsections, but not in sections.


title: Equation environment for centered, equally-spaced columns of expressions

text: I want a environment for displaying rows and columns of mathematical expressions, such that the contents of each column is centered, and the columns are equally spaced. Rows must have optional equation numbers, as with the `align*` environment. I posted a similar question a few months ago, answered here: Standard math environment for equally-spaced columns of expressions? Although I accepted the answer there at the time, it has some shortcomings: I have to specify in advance how many columns I'm going to need (unlike the existing `align*` environment, for example), and it doesn't allow me to have equation numbers for rows in a straightforward way. Edit on 3rd April 2012: The syntax has to be like this:               \begin{newenvironment}     A & B & C     \\     \nonumber     f & g & h     \end{newenvironment}      This should produce two lines of displayed mathematics in three columns, all equally-spaced from the page margins and from each other. The first line should have an equation number, the second shouldn't.


title: Every non-label node in TikZ

text: In TikZ we can use `every node/.style=...` and `every label/.style=...` but is there a way to say something like `every non label/.style=...` so that I can define styles for non-label and label nodes without interference?


title: Get cell content from a Google doc spreadsheet using LuaTeX

text: I know that LuaTeX can access network resource (at least ConTeXt can). Would it be possible to get cell values in a macro, from a Google Docs spreadsheet, dynamically at compilation time, with LuaLaTeX? I created a document sample with hopefully no authentication issue. I found this project that could help but it does not seem to be really active.


title: How to write Definition 2.1. in texmaker?

text: I am just want to write Defintion 2.1. in texmaker ? I already used               \subsection     \begin{definition}     \end{definition}        but I can't found the output Definition 2.1. so please kindly tell us. After writing Definition 2.1 by followed the answer here. I'm want to write Remark 2.1. as given the below answer but my output is Remark 2.2. so please do help me to write Remark 2.1.


title: Achemso superscript for numbered bib

text: I am not all that experienced in using the achemso style package. I am trying to prepare an article for Environmental science & research. They want the references as super-scripted numbers in the end of the sentences after the punctuation. To my understanding this should be the default when using:               \documentclass[journal=esthag,manuscript=article]{achemso}      using in the text `\cite{nameofarticle_xxxx}` and implementing the bibliography file as: `\bibliography{nameofbibfile}`. However my references show up as numbers in normal text and before the punctuation mark. How do I get them super scripted and behind the punctuation mark? Is there a setting I am missing? The following MWE shows the issue:               \documentclass[journal=esthag,manuscript=article]{achemso}     \setkeys{acs}{super=true}     \begin{filecontents}{acsdemo.bib}     @ARTICLE{Abernethy2003,       author = {Colin D. Abernethy and Gareth M. Codd and Mark D. Spicer         and Michelle K. Taylor},       title = {{A} highly stable {N}-heterocyclic carbene complex of         trichloro-oxo-vanadium(\textsc{v}) displaying novel         {C}l---{C}(carbene) bonding interactions},       journal = {{J}. {A}m. {C}hem. {S}oc.},       year = {2003},       volume = {125},       pages = {1128--1129},       number = {5},       doi = {10.1021/ja0276321},     }     \end{filecontents}     \title{Demo title}     \begin{document}     This is a citation\cite{Abernethy2003}.     \bibliography{acsdemo}     \end{document}      ![enter image description here](http://i.stack.imgur.com/eoRic.png) Any help is most appreciated