title: Problem in Texmaker after reinstalling MiKTeX: 'the memory dump file could not be found'

text: I had MiKTeX, with TeXworks and Texmaker running fine on my Windows 7 machine, except the package manager crashed whenever I opened it. So I decided to uninstall and reinstall everything LaTeX on my computer. Now, after reinstalling MiKTeX and Texmaker, the TeXworks that comes with MiKTeX works fine, however Texmaker keeps saying:               The memory dump file could not be found. pdflatex: Data: pdflatex.fmt      I have also installed Lyx and LEd, and they bring up similar errors. What I've tried:   * Rebooting my computer a few times   * Uninstalling and reinstalling MiKTeX and Texworks a few times   * Typing `initexmf --dump` into Windows' command prompt   * Going into MiKTeX's settings and updating the formats Those are all what I'd seen suggested on this forum and others, but they don;t work for me. It seems weird that MiKTeX's own TeXworks works, whilst all other editors don't. I guess it's not the end of the world - I can still write LaTeX documents, it's just that other editors offer many more features that I've come to really like. Thanks for any help anybody gives me, I really appreciate it! P.S. If it helps at all, MiKTeX is installed in my "Program Files" folder, whereas the other editors are installed in my "Program Files (x86)" folder, which I just noticed. Could that be a problem? _Note: Just re-installed LEd into the "Program Files" folder instead, didn't help._


title: How can I get these two nested \foreach loops to work?

text: I try to use nested `\foreach` loops to create edges between many nodes.               \documentclass{standalone}     \usepackage{tikz}     \begin{document}     \begin{tikzpicture}       \node (a) at (0, 1) {};       \node (b) at (0, -1) {};       \node (c) at (1, 0) {};       \node (d) at (-1, 0) {};       \foreach \from/\targets in {%         b/d,%         {a/b,c,d}%       } {         \typeout{\from-\targets}         \foreach \to in {\targets} {           \typeout{ \from-\to}           \path (\from) edge (\to);         }       }     \end{tikzpicture}     \end{document}      But this fails with the cryptic error               b-d      b-d     a-b,c,d      a-b,c,d          ! Package PGF Math Error: Unknown function `b' (in 'b').      As `\typeout` visible before the error show, seemingly `\targets` is not expanded and thus interpreted a single parameter instead of a list. Can expansion be forced at this point? Or is there another way to fix it?


I am attempting to place the document's title on the left side of a header and the chapter's name on the right side of the header. However, I am unable to find how to use the title variable specified in by `\title{my title}` in the header. Additionally, whenever I use `\chaptermark` the right section of the header appears blank on all pages. How do I insert a document's title and the chapter's name into a header? My tex file contents are pasted below:               \documentclass{report}     \usepackage{lastpage}     \usepackage{fancyhdr}     \pagestyle{fancy}     \fancyhf{}     \begin{document}          \rhead{\bfseries \chaptermark}     \lfoot{\thepage\ of \pageref{LastPage}}     \rfoot{My Company}     \renewcommand{\headrulewidth}{0.4pt}     \renewcommand{\footrulewidth}{0.4pt}          % redefine headers and footers for chapters     \fancypagestyle{plain}{%      \fancyhf{}      \rhead{\bfseries \chaptermark}      \lfoot{\thepage\ of \pageref{LastPage}}      \rfoot{My Company}      \renewcommand{\headrulewidth}{0.4pt}      \renewcommand{\footrulewidth}{0.4pt}     }          \title{My Document Title}     \author{Ryan Taylor}     \date{\today}     \maketitle     \tableofcontents     \chapter{Version Control}     Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sapien metus, tempus sit amet feugiat id, feugiat in diam. Integer ut nunc eget orci hendrerit ullamcorper nec at enim.          \chapter{Introduction}     Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sapien metus, tempus sit amet feugiat id, feugiat in diam. Integer ut nunc eget orci hendrerit ullamcorper nec at enim.


title: How to make a shortcut for \mathbb font in LyX?

text: I want to make a shortcut for the `\mathbb` font (or other fonts) in LyX.   How can I do it?


title: Remove newpage after \tableofcontents, \listoffigures, etc. in book class

text: When using a documentclass of `book`, it seems there is a `\newpage` inserted after the `\tableofcontents` and `\listoffigures`. How can I suppress this? In `articles`, the following works. How can I get this layout with a `book`?               \twocolumn     \tableofcontents     \listoffigures     \listoftables     \printglossaries     \onecolumn


title: Creating an abbreviations file

text: I'm new to the LaTeX scene as I've starting writing my thesis. I'm using a root `.tex` file and using `\include` to add in my chapters (etc). I'm also using `\nomencl` to add an abbreviations list. I'd like to have one central file that I can add abbreviations too and then add it to my final document. So I have manged to make that work but I can't get rid of the blank page created where I include my abbreviations file abbrev.tex               \addtocontents{toc}{\protect\setcounter{tocdepth}{-1}}     \section{}     \nomenclature{JOE}{Job Obselete Effort}%     \nomenclature{NHE1}{The human Na$^{+}$/H$^{+}$ exchanger isoform-1}%     \nomenclature{home}{Where the heart is}     \nomenclatenter code hereure{LaTeX}{better than sliced bread}%      root.tex               \documentclass[10pt,oneside]{report}     ...     \begin{document}     ...     \include{chapter1     \include{chapter2}     \include{abbreviations}     ...     \end{document}      and just to make it really clear: everything (i.e. all abbreviations and abbreviation list are inserted correctly in the document) is working EXCEPT I get a blank page where `\include{abbreviations}` is. I know I can just add all the `\nomenclature{...}` lines at the end of a chapter file but it would be nice to have them in one place. I've also tried `\input' instead but it's exactly the same.


title: Horizontal lines in bar plots without first line

text: I'm starting to learn pgf-plot and this is my first plot:               \documentclass{standalone}     \usepackage{pgfplots}     \pgfplotsset{compat=1.9}          \begin{document}     \begin{tikzpicture}     \begin{axis}[         ybar,         ymin=0, ymax=70,         width=9.5cm,         symbolic x coords={a,b,c,d,e},         xtick=data,         bar width=15pt,         axis lines*=left,         ytick={0,10,...,70},         xticklabel style={text height=1.5ex},         ymajorgrids,          ]         \addplot[fill=gray!40] coordinates {             (a,54)             (b,60)             (c,62)             (d,58)             (e,51)         };     \end{axis}     \end{tikzpicture}     \end{document}      Now I want to draw horizontal lines from every yticks to the other end of the plot. I tried with `xbar interval` but it didn't work. How should I do it? **Edit:** nevermind, found it. It was the `xmajorgrids` option. Now what I can't do is to remove the first line from the horizontal grid (first from above, the hline at y=70). Is it possible?


title: Representing hyperlinks differently in a single pdf file

text: Can someone tell me how to color/represent (only internal) hyperlinks in a pdf differently (preferably just by using LyX,i.e. without diving deeper into pure latex) ? For example I would like the links from the table of contents to the separate sections my pdf to be put in a blue box, but all the other links (links to formulas or footnotes) to be green-coloured text. My problem is, if I set a color and a "style"(in a box/text-colored) **all** links are like that and I see no way of differentiating between them. My version of LyX is 2.


title: Custom T shape in TikZ

text: I would to define a new "T" shape (i.e. the red and green shapes in the following image) so that I can then draw with TikZ the diagram below. ![component](http://i.stack.imgur.com/nojlA.png) Unfortunately I cannot figure out how to do. To be honest, I have read the section "Declaring New Shapes" from the PGF manual and I am completely lost with the low level pgf commands. How could I do? Suggestions on any direction are welcomed.


title: Wrong scale in a stacked ybar logarithmic plot with basis 10 using package pgfplots

text: I want the plot described in the title. So I added options `log basis y=10` and `ybar stacked` to the `axis` environment. The scale becomes wrong. If I add just one option, the scale is right. Is my mistake or a bug in package `pgfplots`? I am using `pgfplots` version 1.5.1, and `pgf/tikz` version 2.10. An example follows.               \documentclass{article}     \usepackage{pgfplots}          \begin{document}          \begin{tabular}{cc}     \begin{tikzpicture}          \begin{axis}[ymode=log     %                , log basis y=10     %                , ybar stacked                      ]               \addplot coordinates {(0,1e5)};               \addplot coordinates {(0,9e5)};          \end{axis}     \end{tikzpicture}     &     \begin{tikzpicture}          \begin{axis}[ymode=log                     , log basis y=10     %                , ybar stacked                      ]               \addplot coordinates {(0,1e5)};               \addplot coordinates {(0,9e5)};          \end{axis}     \end{tikzpicture}     \\     \begin{tikzpicture}          \begin{axis}[ymode=log     %                , log basis y=10                     , ybar stacked                      ]               \addplot coordinates {(0,1e5)};               \addplot coordinates {(0,9e5)};          \end{axis}     \end{tikzpicture}     &     \begin{tikzpicture}          \begin{axis}[ymode=log                     , log basis y=10                     , ybar stacked                      ]               \addplot coordinates {(0,1e5)};               \addplot coordinates {(0,9e5)};          \end{axis}     \end{tikzpicture}     \end{tabular}          \end{document}


title: defining a region to fill in a tikz shape

text: I am trying to define a collection of shapes that are useful in drawing Riemann surfaces. For this, I am heavily indebted to Andrew Stacey's tqft package. I am having some trouble defining a shape to represent the standard short-hand we use to indicate genus on a surface. I want the shape to draw the arcs, but when I fill it, only fill the "hole". I have a hack solution at present (code snippet below), but it works by filling the hole in white and ignoring any fill. Abstracted away from my specific situation: > How can I define the stroke and fill parts of my shape separately? EDIT: I am including more detail in my example. First, a toy example: I have a shape called "sun" that consists of a disk with rays and smaller circles outside. When I fill it, I want it to give me a green main disk but unfilled outer circles. (i.e. a hybrid between the two pictures below: the outer circles should match the left, and the inner disk should match the right). ![unfilled and filled sun shape](http://i.stack.imgur.com/00qN1.png) Here is code for the sun:               \documentclass[convert]{standalone}     \usepackage{tikz, pgf}     \usetikzlibrary{shapes,calc}          \makeatletter          \pgfdeclareshape{sun}{      \savedanchor{\centre}{ \pgfpointorigin}      \anchor{center}{\centre}      \savedanchor{\top}{         \pgf@x = 0cm         \pgf@y = 0.15cm       }       \anchor{top}{\top}       \savedanchor{\bottom}{         \pgf@x = 0cm         \pgf@y = -0.375cm         }       \anchor{bottom}{\bottom}          \backgroundpath{                   \foreach \x in {0,45,...,360} {         \pgfpathmoveto{\pgfpointpolarxy{ \x }{ 1.2 }}         \pgfpathlineto{ \pgfpointpolarxy{\x }{2 } }         \pgfpathcircle{\pgfpointpolarxy{\x}{2.2}}{2pt}             }            \pgfpathcircle{\pgfpointorigin}{1cm}     }         }              \makeatother          \begin{document}     \begin{tikzpicture}     \node [sun, draw, scale=.5, fill=green] at (2,0) {};     \node [sun, draw, scale=.5, fill=none] at (-2,0) {};            \end{tikzpicture}     \end{document}      Now, the real example: the picture with genus. I have four shapes: genuspic, hackgenuspic, strokegenuspic and fillhackgenuspic. From top to bottom in the picture: genuspic with fill=green, hackgenuspic with fill=green, fillhackgenuspic with fill=green, fillhackgenuspic with fill=none, strokegenuspic. Genuspic draws my arcs as I want them. Hackgenuspic draws my arcs as I want them, but also draws a path that bounds the hole. It then fills that path in (in white, ignoring fill=green). How can I have a shape that does what hackgenuspic does, but where the fill colour pays attention to fill=green? ![pictures of genus](http://i.stack.imgur.com/EIZcU.png) Here is the code for the Riemann surface example:               \documentclass[convert]{standalone}     \usepackage{tikz, pgf}     \usetikzlibrary{shapes}          \makeatletter          \pgfdeclareshape{genuspic}{      \anchor{center}{\pgfpointorigin}     \backgroundpath{          \pgfpathmoveto{\pgfqpoint{-1cm}{0cm}}          \pgfpathcurveto %                 {\pgfpoint{-0.5cm}{-.5cm}}             {\pgfpoint{0.5cm}{-.5cm}}             {\pgfpoint{1cm}{0cm}}               \pgfpathmoveto{\pgfqpoint{-0.75cm}{-0.15cm}}          \pgfpathcurveto %                 {\pgfpoint{-0.25cm}{.25cm}}             {\pgfpoint{.25cm}{.25cm}}             {\pgfpoint{0.75cm}{-0.15cm}}         }         }          \pgfdeclareshape{strokegenuspic}{      \anchor{center}{\pgfpointorigin}     \backgroundpath{          \pgfpathmoveto{\pgfqpoint{-1cm}{0cm}}          \pgfpathcurveto %                 {\pgfpoint{-0.5cm}{-.5cm}}             {\pgfpoint{0.5cm}{-.5cm}}             {\pgfpoint{1cm}{0cm}}               \pgfpathmoveto{\pgfqpoint{-0.75cm}{-0.15cm}}          \pgfpathcurveto %                 {\pgfpoint{-0.25cm}{.25cm}}             {\pgfpoint{.25cm}{.25cm}}             {\pgfpoint{0.75cm}{-0.15cm}}             \pgfusepath{stroke}         }         }               \pgfdeclareshape{hackgenuspic}{      \anchor{center}{\pgfpointorigin}     \backgroundpath{              \pgfpathmoveto{\pgfqpoint{-0.78cm}{-.17cm}}          \pgfpathcurveto %                 {\pgfpoint{-0.35cm}{-.44cm}}             {\pgfpoint{0.35cm}{-.44cm}}             {\pgfpoint{.78cm}{-0.17cm}}           \pgfpathmoveto{\pgfqpoint{-0.78cm}{-0.17cm}}          \pgfpathcurveto %                 {\pgfpoint{-0.25cm}{.25cm}}             {\pgfpoint{.25cm}{.25cm}}             {\pgfpoint{0.78cm}{-0.17cm}}             \pgfsetfillcolor{white}             \pgfusepath{fill}               \pgfpathmoveto{\pgfqpoint{-1cm}{0cm}}          \pgfpathcurveto %                 {\pgfpoint{-0.5cm}{-.5cm}}             {\pgfpoint{0.5cm}{-.5cm}}             {\pgfpoint{1cm}{0cm}}               \pgfpathmoveto{\pgfqpoint{-0.75cm}{-0.15cm}}          \pgfpathcurveto %                 {\pgfpoint{-0.25cm}{.25cm}}             {\pgfpoint{.25cm}{.25cm}}             {\pgfpoint{0.75cm}{-0.15cm}}                   \pgfusepath{stroke}         }         }              \pgfdeclareshape{fillhackgenuspic}{      \anchor{center}{\pgfpointorigin}     \backgroundpath{              \pgfpathmoveto{\pgfqpoint{-0.78cm}{-.17cm}}          \pgfpathcurveto %                 {\pgfpoint{-0.35cm}{-.44cm}}             {\pgfpoint{0.35cm}{-.44cm}}             {\pgfpoint{.78cm}{-0.17cm}}           \pgfpathmoveto{\pgfqpoint{-0.78cm}{-0.17cm}}          \pgfpathcurveto %                 {\pgfpoint{-0.25cm}{.25cm}}             {\pgfpoint{.25cm}{.25cm}}             {\pgfpoint{0.78cm}{-0.17cm}}             \pgfusepath{fill}               \pgfpathmoveto{\pgfqpoint{-1cm}{0cm}}          \pgfpathcurveto %                 {\pgfpoint{-0.5cm}{-.5cm}}             {\pgfpoint{0.5cm}{-.5cm}}             {\pgfpoint{1cm}{0cm}}               \pgfpathmoveto{\pgfqpoint{-0.75cm}{-0.15cm}}          \pgfpathcurveto %                 {\pgfpoint{-0.25cm}{.25cm}}             {\pgfpoint{.25cm}{.25cm}}             {\pgfpoint{0.75cm}{-0.15cm}}                   \pgfusepath{stroke}         }         }                        \makeatother          \begin{document}     \begin{tikzpicture}[scale=.5]     \fill[color=black!10] (-6,3) arc (-180:0:2 cm and 1 cm)       (-2,3) .. controls +(-60:1) and +(-120:1) .. (2,3)     (2,3)  arc (-180:0:2 cm and 1 cm)     (6,3) .. controls +(-90:2) and +(0:4) .. (0,-10) .. controls +(180:4) and +(-90:2) .. (-6,3);          \node [genuspic, draw, scale=1, fill=green] at (0,0) {};     \node [hackgenuspic, draw, scale=1, fill=green] at (0,-2) {};     \node [fillhackgenuspic, draw, scale=1, fill=green] at (0, -4) {};     \node [fillhackgenuspic, draw, scale=1, fill=none] at (0, -6) {};     \node [strokegenuspic, draw, scale=1, fill=green] at (0, -8) {};               \draw (-4,3) ellipse (2 cm and 1 cm)       (-2,3) .. controls +(-60:1) and +(-120:1) .. (2,3)     (4,3)  ellipse (2cm and 1cm)     (6,3) .. controls +(-90:2) and +(0:4) .. (0,-10) .. controls +(180:4) and +(-90:2) .. (-6,3);     \end{tikzpicture}                    \end{document}


title: Inline table of contents

text: I am trying to generate an inline Table of Contents that would have no title, a depth of two and the following formatting: **1.** Section one ‖ _1.1._ Subsection one; _1.2._ Subsection two ‖ **2.** Section two I played with `titletoc` and almost got the right result, except that the ToC is left aligned rather than justified, and my formatting actually overrides the standard one which I don't know how to restore afterwards. So I tried redefining `\tableofcontents`, `\contensline` and `\numberline` but got stuck with the following problems:   1. How can I find out from inside `\numberline` what level of heading I am formatting (so as to differentiate between **bold** for `\section`s and _italics_ for `\subsection`s? Or alterantively,   2. How can I get rid of the call to `\numberline` inside the `#2` argument for `\contensline` in `file.toc`? And,   3. How can I know if the (`sub`)`section` I am formatting is the first or the last one in row, so as to put the "‖" and ";" separators in the right places? I'm actually more interested in learning to write macros in TeX than to solve this particular problem, so I would be most grateful for an explanation rather than simply a solution, if it's not a problem. **Edit:** A minimal example (ignore "‖" missing from the standard font; this isn't a problem):               \documentclass{article}          \makeatletter     \renewcommand{\tableofcontents}{\noindent\@starttoc{toc}}     \renewcommand{\l@section}[2]{#1~‖}           % How can I tell here if anything (and what?) follows?     \renewcommand{\l@subsection}[2]{#1;}         % As above.     \renewcommand{\numberline}[1]{\textbf{#1}.~} % How can I tell here if it's a section or a subsection?     \makeatother          \begin{document}     \tableofcontents     \section{Section one}     \subsection{Subsection one}     \subsection{Subsection two}     \section{Section two}     \end{document}      What the above gives is this: **1.** Section one ‖ **1.1.** Subsection one; **1.2.** Subsection two; **2.** Section two ‖ The problems are:   1. Subsection numbers are in **bold** rather than _italic_.   2. `Subsection two` is followed by a semicolon.   3. `Section two` is followed by a "‖".


title: Aligning different parts of an equation with certain spots in the line above

text: I am trying to get certain parts in the second line of an equation to line up with certain parts in the first line. For example,               X=AAA+BBB+CCC           = a + b + c      where here I am wanting the lower-case letter to line up in the middle of its three upper-case counterparts and all of the operators to align. I have tried using `align` in the following way:               \begin{align}            X&=A&AA &+ B&BB &+ C&CC \\            &= &a &+ &b &+ &c          \end{align}      This results in horrible spacing. I have also tried using `tabular`, but the spacing is bad there also. I would like the first line to be written as it would be normally and then the second line to line up as desired.


title: Make .Rnw child document independent from main document

text: This is a followed-up question to this answer. I have a `variables.Rnw` document in charge with the task of loading data from `R` datafiles and create `R` variables that I will then compile into a `.tex` file with `knitr`. I have different documents that use the variables contained in `variables.Rnw` and I would like to make it independent from any one master document. The problem is that according to the answer mentioned above I need a preamble for each `.Rnw` child documents, like               % !TeX root = main.Rnw     % !Rnw weave = knitr     % !TeX program = pdfLaTeX      which contains path and name of the root file the child file should use. Is it possible to avoid declaring any root file, then turning the child file orphan?


title: Get error "Undefined control sequence \end{forest}"

text: I have tried to compile the following document:               \documentclass{article}          \usepackage{forest}          \begin{document}          \begin{forest}       [A         [B]       ]     \end{forest}          \end{document}      I get the error message `Undefined control sequence \end{forest}`. What am I doing wrong?


title: Plainnat style not alphabetically and lowercase

text: I have a problem with the `plainnat` bib-style as my reference list is not sorted alphabetically (I may be wrong on this one but I have the impression that this should be the case for this bib-style). Also all titles on papers are in lowercase (except the first letter) which I don't like - can I change that somehow?


title: How to make nodes to simple dots instead of being named

text: I currently have the following code:               \documentclass{article}     \usepackage{tikz}          \begin{document}     \begin{tikzpicture}[scale=1]     \tikzstyle{every node}=[draw,shape=circle]     \path (0,0) node (p0) {$p_0$}     (-1.5,-1) node (p1) {$p_1$}     (-1.5,-2.5) node (p2) {$p_2$}     (1.5,-2.5) node (p3) {$p_3$}     (1.5,-1) node (p4) {$p_4$}     (0,-3.5) node (p5) { $p_5$};     \draw (p0) -- (p1)     (p0) -- (p1)     (p0) -- (p2)     (p0) -- (p3)     (p0) -- (p4)     (p0) -- (p5)     (p1) -- (p2)     (p1) -- (p3)     (p1) -- (p4)     (p1) -- (p5)     (p2) -- (p3)     (p2) -- (p4)     (p2) -- (p5)     (p3) -- (p4)     (p3) -- (p5)     (p4) -- (p5);     \end{tikzpicture}          \end{document}      but my problem is that this name each node. And i just want a simple dot. How do I do that?


title: creating a dotted paper pdf

text: I want a template like this http://dottedpaper.com/download/dotted.pdf to print out. But all the ones I find online have watermarks, so I want to create my own. Is it possible to do in LaTeX? What packages would I use? I found a package `graphpap` that does graph paper. Is it possible to modify this to do dots isntead?


title: How do I completely remove bibliography

text: I am writing an internal company document in LaTeX (class `report`) and I do not want to have any citations, references or bibliography section. If I just omit the `\bibliographystyle`, the LaTeX compiler throws an error. And I just CANNOT find how to remove the bibliography section, google gives me bunch of links how to modify the bibliography, but not how to completely remove it. I have found a site which has a list of bibliography styles and "None" was not in the list. Your help would be very appreciated.


title: maxchunks in ledmac and ledpar

text: What is the idea behind the command `\maxchunks` in the ledmac/ledpar-package? Of course, I understand that I get an error when I have used, say, 15 times `\pstart ... \pend` while `\maxchunks` is set to `{10}`. But then I just increase the value of `\maxchunks` to `{15}` or `{20}` or even `{100}`. So, why not using `\maxchunks{1000000}`? Is there any reason or recommendation for not using a value that high?


title: Options for supplementary materials in preprint version: revTeX + arXiv

text: Those days, there are more and more papers which accept supplementary materials, as _e.g._ the Physical Review Letters: see their policy regarding supplementary materials. For them you can submit two different documents, say `main.tex` and `supp.tex`. I believe that preprint servers will display only _one_ final document. At least it seems so for arXiv, see their policy regarding LaTeX submission. Let stick ourself with RevTeX and arXiv examples for the present purpose. The problems are that `main.tex` and `supp.tex` usually do not use the same layout and co. : two columns vs. one column, different abstracts, different bibliographies, ... So I'm wondering about the best choice(s) for presenting our papers including supplementary materials on preprint servers. I'm well aware that it should depend on the nature of the supplementary materials (video, code, equations, ...). Here let us suppose the supplementary materials are some pure LaTeX document. If you want to discuss the possibility to include some more exotic materials, feel free, that's always interesting :-) What is the the best option: including extra documents (with the difficulty to have a clear distinction between the main part and the supplementary part, especially the preamble of `supp.tex` is not displayed anymore, see How to include a document into another document?), or to abuse of appendix (with the problem that appendix is _not_ a supplementary material) ? So, in short: How to combine my `main.tex` and my `supp.tex` into a global `paper.tex` file in a clever way ? Thanks in advance.


title: How do I remove the \paragraph{} text from the \tableofcontents with acmsmall?

text: I am writing a rather long literature review for submission to ACM Computing Surveys and we are putting a table of contents on it for the benefits of our internal reviewers. The table of contents is including text from the `\paragraph` tags. I don't want it to, but I can't get rid of it. Here is a sample document:               \documentclass[prodmode,acmcsur]{acmsmall} % Aptara syntax     \begin{document}     \tableofcontents     \section{A Section}     \subsection{A Subsection}     \subsubsection{A SubSubSection}     \paragraph{First Paragraph} Some text.     \paragraph{Second Paragraph} Some text.     \paragraph{Third Paragraph} Some text.     \subsubsection{Another SubSubSection}     \end{document}      And here is what it looks like: ![table of contents](http://i.stack.imgur.com/eFs53.png) I've tried to get rid of the paragraph text with `\setcounter{tocdepth}{3}` and that doesn't help. (It removes the subsubsection, but not the `paragraph`.) I've also tried `\setcounter{secnumdepth}{3}`. No luck. What's the solution?


title: Is lualatex supposed to be a superset of pdflatex? (regarding production of PDF)

text: In other words, is it a bug if lualatex cannot compile a document that pdflatex can? Based on the answers to this question How to expand TeX's "main memory size"? (pgfplots memory overload) I decided to give a try to lualatex to resolve the issue of dynamic memory allocation, specificially for pgfplots. Although there are still memory issues in extreme cases, I found that lualatex is more resilient to failure, and had been using it by default... until I tried it for 3D pgfplots. I found that is fails to produce a good PDF for this MWE:               \documentclass{article}     \usepackage{pgfplots}     \begin{document}     \begin{tikzpicture}     \begin{axis}     \addplot3[surf, shader = interp] %shader interp offends lualatex     coordinates {     (-3, -3, 4.07584)(-1, -3, 2.96859)(1, -3, 3.00208)(3, -3, 4.1488)\par     (-3, -1, 3.00208)(-1, -1, 1.10114)(1, -1, 1.18849)(3, -1, 3.1004)\par     (-3, 1, 3.06798)(-1, 1, 1.26984)(1, 1, 1.34629)(3, 1, 3.16425)\par     (-3, 3, 4.22049)(-1, 3, 3.16425)(1, 3, 3.1957)(3, 3, 4.29098)\par     };      \end{axis}     \end{tikzpicture}     \end{document}      pdflatex works perfectly, but lualatex produces a PDF that is corrupted, evince shows the wrong polygons and Acrobat Reader gives a "drawing error occurred". The offending feature seems to be the "shader = interp" option in the 3D plot. versions: TeXLive 2012, acroread 9.4.7, evince 3.4.0. An acceptable answer can be a confirmation that this is a bug in lualatex.


title: Show the Steps Taken to Solve an Equation

text: I am new to LaTex and I am trying to type a document where I show the steps I took to solve an equation however I do not know how to do this in LaTex. I am trying to display something like this: ` x^2+2x+1 = 0   (x+1)^2 = 0   x = -1` Is there a way to do this (or something similar) in LaTex? Any suggestions would be much appreciated!


title: Change the bottom and top margin of section and subsection

text: In my current document, `section` and `subsection` have too much bottom and top margin. How can I change that globally to be less? I use the document class as book.


title: Using different aliases for textual and parenthetical citations in natbib

text: I need to define distinct aliases in textual and parenthetical citations for the same reference. For example, I would like `\citetalias{Miller2012}` to result in "Miller et al. [2012, Paper 1]", while `\citepalias{Miller2012}` should give "[Miller et al., 2012, Paper 1]". Is there some way to achieve this by using a generalized version of the `natbib` command `\defcitealias`? Are there any alternatives? I need the paper number to appear together with the year in all citations of this paper. Trying to include "Paper 1" directly in the year field in the `.bib` file leads to problems when citing several refs at the same time and it seems like an ugly solution. Thanks for any suggestions!


title: pgfplots - Data set doesn't get cut off

text: When doing a groupplot such as the one starting on the bottom of page 385 in the manual, is there some specific setting to cut off the data at the specified new `xmin`\- and `xmax`-values? Or is there some catch to it when specifying a "lower" `xmin` value which is negative (old `xmin`: -100 -> new `xmin`: -50)? I am using the same code, except `table` instead of `file`. The `sharp plot` lines for the new groupplot essentially run over the end of the graph and reach into a off-screen area. ## Picture ![enter image description here](http://i.stack.imgur.com/Fzjkv.png) ## MWE               \documentclass[     a4paper     ]{scrartcl}          \usepackage{     tikz,     pgfplots,     amsmath     }          \usepackage[T1]{fontenc}     \usepackage{     lmodern,     textcomp     }          \usetikzlibrary{calc,trees,shadows,positioning,arrows,chains,shapes.geometric,%         decorations.pathreplacing,decorations.pathmorphing,shapes,%         matrix,shapes.symbols,patterns,intersections,pgfplots.groupplots}          \pgfdeclarelayer{background layer}     \pgfdeclarelayer{foreground layer}     \pgfsetlayers{background layer,main,foreground layer}          \begin{document}     \begin{center}         \begin{tikzpicture}             \begin{groupplot}[                 group style={group size=1 by 3},                 height=8cm,                 width=14cm,                 scale only axis=true,                 clip=false,                 %                 xlabel={Zeit},                 ylabel={Kraft},                 %                 xmajorgrids={true},                 xminorgrids={false},                 ymajorgrids={true},                 yminorgrids={false},                 enlargelimits=upper,                 ]                 \nextgroupplot                 \addplot[sharp plot] table [col sep=semicolon] {data.csv};                 \draw[thick, dashed, red] (axis cs:-0.05,0) rectangle (axis cs:0.05,500);                 \nextgroupplot[xmin=-0.05, xmax=0.05, width=10cm]                 \addplot[sharp plot] table [col sep=semicolon] {data.csv};             \end{groupplot}         \end{tikzpicture}     \end{center}     \end{document}      ## data.scv               Tnormiert;123123     -0.2;-5.100883     -0.198;0     -0.196;-2.550442     -0.194;-2.550442     -0.192;-2.550442     -0.19;-2.550442     -0.188;-2.550442     -0.186;-2.550442     -0.184;-2.550442     -0.182;-1.275221     -0.18;-2.550442     -0.178;-2.550442     -0.176;-2.550442     -0.174;-2.550442     -0.172;-2.550442     -0.17;-2.550442     -0.168;-2.550442     -0.166;-2.550442     -0.164;-2.550442     -0.162;-5.100883     -0.16;-2.550442     -0.158;-6.376104     -0.156;0     -0.154;-5.100883     -0.152;-1.275221     -0.15;-5.100883     -0.148;-1.275221     -0.146;-6.376104     -0.144;-2.550442     -0.142;-2.550442     -0.14;-1.275221     -0.138;0     -0.136;-6.376104     -0.134;0     -0.132;-2.550442     -0.13;-2.550442     -0.128;-5.100883     -0.126;0     -0.124;-6.376104     -0.122;0     -0.12;-2.550442     -0.118;-2.550442     -0.116;-3.825663     -0.114;-1.275221     -0.112;-2.550442     -0.11;-5.100883     -0.108;1.275221     -0.106;-5.100883     -0.104;0     -0.102;-6.376104     -0.1;0     -0.098;-2.550442     -0.096;-2.550442     -0.094;-2.550442     -0.092;-2.550442     -0.09;-2.550442     -0.088;-7.651325     -0.086;0     -0.084;-6.376104     -0.082;-2.550442     -0.08;-3.825663     -0.078;-2.550442     -0.076;-1.275221     -0.074;-3.825663     -0.072;-2.550442     -0.07;-2.550442     -0.068;-2.550442     -0.066;-2.550442     -0.064;-2.550442     -0.062;-3.825663     -0.06;-2.550442     -0.058;-5.100883     -0.056;-2.550442     -0.054;-2.550442     -0.052;-3.825663     -0.05;-2.550442     -0.048;-3.825663     -0.046;-5.100883     -0.044;-1.275221     -0.042;-2.550442     -0.04;1.275221     -0.038;-1.275221     -0.036;-3.825663     -0.034;-2.550442     -0.032;-2.550442     -0.03;0     -0.028;-2.550442     -0.026;-3.825663     -0.024;-3.825663     -0.022;-1.275221     -0.02;-1.275221     -0.018;1.275221     -0.016;-3.825663     -0.014;-2.550442     -0.012;-6.376104     -0.01;0     -0.008;-2.550442     -0.006;53.559275     -0.004;163.228268     -0.002;337.933524     0;475.657375     0.002;138.999072     0.004;-26.779638     0.006;33.155742     0.008;17.853092     0.01;3.825663     0.012;21.678754     0.014;10.201767     0.016;12.752208     0.018;33.155742     0.02;34.430963     0.022;12.752208     0.024;28.054859     0.026;15.30265     0.028;11.476988     0.03;20.403534     0.032;16.577871     0.034;20.403534     0.036;26.779638     0.038;29.330079     0.04;29.330079     0.042;35.706184     0.044;29.330079     0.046;30.6053     0.048;26.779638     0.05;24.229196     0.052;25.504417     0.054;25.504417     0.056;29.330079     0.058;30.6053     0.06;29.330079     0.062;22.953975     0.064;26.779638     0.066;19.128313     0.068;22.953975     0.07;20.403534     0.072;28.054859     0.074;26.779638     0.076;29.330079     0.078;29.330079     0.08;29.330079     0.082;26.779638     0.084;22.953975     0.086;25.504417     0.088;21.678754     0.09;26.779638     0.092;21.678754     0.094;20.403534     0.096;20.403534     0.098;17.853092     0.1;22.953975     0.102;20.403534     0.104;22.953975     0.106;21.678754     0.108;22.953975     0.11;29.330079     0.112;29.330079     0.114;29.330079     0.116;26.779638     0.118;31.880521     0.12;25.504417     0.122;28.054859     0.124;28.054859     0.126;26.779638     0.128;26.779638     0.13;26.779638     0.132;28.054859     0.134;21.678754     0.136;26.779638     0.138;24.229196     0.14;24.229196     0.142;26.779638     0.144;24.229196     0.146;30.6053     0.148;25.504417     0.15;30.6053     0.152;28.054859     0.154;25.504417     0.156;29.330079     0.158;22.953975     0.16;29.330079     0.162;26.779638     0.164;24.229196     0.166;29.330079     0.168;24.229196     0.17;29.330079     0.172;26.779638     0.174;28.054859     0.176;26.779638     0.178;28.054859     0.18;33.155742     0.182;25.504417     0.184;28.054859     0.186;28.054859     0.188;25.504417     0.19;28.054859     0.192;22.953975     0.194;28.054859     0.196;21.678754     0.198;22.953975     0.2;25.504417     0.202;20.403534     0.204;22.953975     0.206;19.128313     0.208;25.504417     0.21;20.403534     0.212;24.229196     0.214;24.229196     0.216;21.678754     0.218;29.330079     0.22;24.229196     0.222;29.330079     0.224;22.953975     0.226;28.054859     0.228;24.229196     0.23;25.504417     0.232;25.504417     0.234;26.779638     0.236;25.504417     0.238;22.953975     0.24;29.330079     0.242;24.229196     0.244;26.779638     0.246;28.054859     0.248;26.779638     0.25;29.330079     0.252;24.229196     0.254;29.330079     0.256;24.229196     0.258;29.330079     0.26;25.504417     0.262;26.779638     0.264;29.330079     0.266;26.779638     0.268;26.779638     0.27;26.779638     0.272;26.779638     0.274;29.330079     0.276;28.054859     0.278;30.6053     0.28;26.779638     0.282;33.155742     0.284;24.229196     0.286;29.330079     0.288;24.229196     0.29;28.054859     0.292;26.779638     0.294;22.953975     0.296;29.330079     0.298;22.953975     0.3;25.504417     0.302;21.678754     0.304;24.229196     0.306;25.504417     0.308;22.953975     0.31;26.779638     0.312;21.678754     0.314;25.504417     0.316;21.678754     0.318;26.779638     0.32;22.953975     0.322;24.229196     0.324;26.779638     0.326;21.678754     0.328;26.779638     0.33;24.229196     0.332;24.229196     0.334;21.678754     0.336;25.504417     0.338;24.229196     0.34;25.504417     0.342;26.779638     0.344;22.953975     0.346;28.054859     0.348;24.229196     0.35;25.504417     0.352;24.229196     0.354;25.504417     0.356;28.054859     0.358;25.504417     0.36;25.504417     0.362;25.504417     0.364;22.953975     0.366;29.330079     0.368;22.953975     0.37;26.779638     0.372;26.779638     0.374;26.779638     0.376;29.330079     0.378;24.229196     0.38;29.330079     0.382;25.504417     0.384;29.330079     0.386;29.330079     0.388;24.229196     0.39;30.6053     0.392;25.504417     0.394;26.779638     0.396;26.779638     0.398;26.779638     0.4;29.330079     0.402;22.953975     0.404;25.504417     0.406;24.229196     0.408;24.229196     0.41;26.779638     0.412;25.504417     0.414;26.779638     0.416;21.678754     0.418;26.779638     0.42;24.229196     0.422;25.504417     0.424;24.229196     0.426;20.403534     0.428;25.504417     0.43;21.678754     0.432;26.779638     0.434;24.229196     0.436;24.229196     0.438;24.229196     0.44;25.504417     0.442;25.504417     0.444;22.953975     0.446;26.779638     0.448;24.229196     0.45;24.229196     0.452;24.229196     0.454;24.229196     0.456;26.779638     0.458;24.229196     0.46;25.504417     0.462;24.229196     0.464;24.229196     0.466;26.779638     0.468;22.953975     0.47;28.054859     0.472;25.504417     0.474;26.779638     0.476;28.054859     0.478;22.953975     0.48;26.779638     0.482;25.504417     0.484;26.779638     0.486;26.779638     0.488;26.779638     0.49;29.330079     0.492;24.229196     0.494;29.330079     0.496;25.504417     0.498;28.054859     0.5;26.779638     0.502;24.229196     0.504;29.330079     0.506;24.229196     0.508;26.779638     0.51;26.779638     0.512;25.504417     0.514;26.779638     0.516;22.953975     0.518;29.330079     0.52;21.678754     0.522;24.229196     0.524;24.229196     0.526;21.678754     0.528;26.779638     0.53;20.403534     0.532;25.504417     0.534;25.504417     0.536;25.504417     0.538;24.229196     0.54;25.504417     0.542;28.054859     0.544;21.678754     0.546;28.054859     0.548;21.678754     0.55;25.504417     0.552;22.953975     0.554;22.953975     0.556;28.054859     0.558;24.229196     0.56;24.229196     0.562;26.779638     0.564;20.403534     0.566;24.229196     0.568;28.054859     0.57;24.229196     0.572;24.229196     0.574;25.504417     0.576;21.678754     0.578;29.330079     0.58;26.779638     0.582;25.504417     0.584;26.779638     0.586;24.229196     0.588;26.779638     0.59;26.779638     0.592;24.229196     0.594;29.330079     0.596;26.779638     0.598;26.779638     0.6;28.054859


title: How to put 4 tikzfigures, in a 2x2 layout?

text: I have 4 things drawn with tikz. It's working fine but now I want to layout them in a grid 2x2, each one with its own caption. EDIT: I have rewritten my question since It was not clear. Below code is what I want to a reduced version of what I want to draw but I want it to appear in a 2x2 layout. Currently I get everything in a column. Taking too much space               \begin{figure}     \centering     \subfloat[Start 1]{         \label{fig:chap3_input_image}         \begin{tikzpicture}[scale=2.0]             \tikzstyle{every node}=[draw, shape=circle];             \path (0:0cm) node[fill=black!40] (v0){$v_0$};             \path (20:0.8cm) node (v1){$v_1$};             \path (340:0.9cm) node (v8){$v_8$};         \end{tikzpicture}     }     \hfill     \caption[Start]{Initial state}     \subfloat[State 2]{         \label{fig:chap3_input_image2}         \begin{tikzpicture}[scale=2.0]             \tikzstyle{every node}=[draw, shape=circle, fill=black!20];             \path (0:0cm) node[fill=black!40] (v0){$v_0$};             \path (20:0.8cm) node (v1){$v_1$};             \path (340:0.9cm) node (v8){$v_8$};         \end{tikzpicture}     }     \caption[Step2]{State 2}     \subfloat[State 3]{         \label{fig:chap3_input_image3}         \begin{tikzpicture}[scale=2]             \tikzstyle{every node}=[draw, shape=circle];             \path (0:0cm) node[fill=black!30] (v0){$v_0$};             \path (20:0.8cm) node (v1){$v_1$};             \path (340:0.9cm) node (v8){$v_8$};         \end{tikzpicture}     }     \hfill     \caption[Third step]{Third step of algorithm}     \subfloat[Step 4]{         \label{fig:chap3_input_image4}         \begin{tikzpicture}[scale=2]             \tikzstyle{every node}=[draw, shape=circle];             \path (0:0cm) node[fill=black!30] (v0){$v_0$};             \path (20:0.8cm) node (v1){$v_1$};             \path (60:1.0cm) node (v2){$v_2$};                  \path (340:0.9cm) node (v8){$v_8$};         \end{tikzpicture}     }     \caption[Algorithm X]{Flow of algorithm X}     \label{fig:AlgorithFlow}     \end{figure}      Thanks in advance


title: Miktex randomly fails on install

text: Everytime I try to install miktex it fails, but in different places. I tried restarting the computer, running admin, nothing works. The TexStudio installs fine, but doesnt compile the document (i assume since latex is not being installed). The consistency I do see seems to be with the fonts folder the error log is like so:               extracting files from embrac.tar.lzma...     extracting files from emerald.cab...          An error occurred:       source file: Libraries\MiKTeX\Extractor\CabExtractor.cpp       source line: 506       message: The file could not be extracted.       info: texmf\fonts\tfm\emerald\fjdmw8c.tfm      ![enter image description here](http://i.stack.imgur.com/BDLqp.jpg) Does anyone know what causes this?


title: Accent characters incorrectly written external file

text: I tried to write some strings in an external file for use in a special type of index, but using utf8 accented characters appear wrong. In my external file, those characters appear in the same way as I wrote in my document and thess characters can't be read later. My test code is:               \documentclass{article}     \usepackage[utf8]{inputenc}     \usepackage[portuges]{babel}     \usepackage[T1]{fontenc}          \newif\iffirstSiglaUse\firstSiglaUsetrue          \newcommand{\sigla}[2]{%         \iffirstSiglaUse             \newwrite\arqEscreveSiglas%             \immediate\openout\arqEscreveSiglas=\jobname.losg%             \firstSiglaUsefalse         \fi         \immediate\write\arqEscreveSiglas{#1 #2}%         #2 (#1)%     }          \AtEndDocument{%         \iffirstSiglaUse\else\immediate\closeout\arqEscreveSiglas\fi     }          \makeatletter     \newcommand{\leArquivo}{%         \def\dados{}         \newread\arqLeSiglas%         \openin\arqLeSiglas=\jobname.losg%         \loop\unless\ifeof\arqLeSiglas%             \read\arqLeSiglas to \dados%             \dados\par%         \repeat%         \closein\arqLeSiglas%     }          \begin{document}          \leArquivo          A \sigla{EPUSP}{Escola Politécnica da Universidade de Sao Paulo} é uma instituição de ensino ligada à \sigla{USP}{Universidade de Sao Paulo} e visa o ensino em engenharia. A entidade representativa dos engenheiros formado na EPUSP é responsabilidade da \sigla{AEP}{Associacao dos Engenheiros Politecnicos} que promove a integração entre ex-alunos.          \end{document}      The answer is "! Package inputenc Error: Unicode char \u8:(something) not set up for use with LaTeX" I read the inputenc documentation and I saw some aux files generated using utf8 characters and I realized that the correct representation of accented characters is "\IeC{...}", but my output file is not so. My output file is:               EPUSP Escola Politécnica da Universidade de Sao Paulo     USP Universidade de Sao Paulo     AEP Associacao dos Engenheiros Politecnicos      Does anyone know what I did wrong?


title: How to change the appearance of subsections, subsubsections, etc. in an AMS Article?

text: Suppose I have the following document:               \documentclass{amsart}     \begin{document}          \subsection{Subsection}     Content.          \end{document}      How can I modify the code so that the subsection heading is italic instead of bold? I tried to use the `titlesec` package, but I don't think it is compatible with the AMS document classes:               \documentclass{amsart}     \usepackage{titlesec}          \titleformat*{\subsection}{\it}          \begin{document}          \subsection{Subsection}     Content.          \end{document}      It works with the Article document class, but it produces errors in an AMS Article. Edit: I would also like a space between the subsection title and the content, as in the typical Article document class.


title: shader=faceted interp does not compile in Xelatex

text: I am using pgfplots               \begin{figure}       \centering       \begin{tikzpicture}         \begin{axis}[width=\linewidth]             \addplot3[surf, mesh/cols=41,mesh/ordering=colwise,faceted color=black,shader=faceted interp] table {P.dat};         \end{axis}       \end{tikzpicture}     \end{figure}      my P.dat is here: http://pastebin.com/xdevrCNF Note that the same code compiles if I omit the shader directive


title: Why does "\if\char98\char98 T \else F \fi" return F instead of T?

text: According to the TeXbook the two tokens following `\if` are expanded and compared? It seems then that `\if\char98\char98 T \else F \fi` should be the same as `\if bb T \else F \fi` which does return `T`. What is wrong with my interpretation?


title: Cartography on LaTeX

text: How to use the cartography font mencioned in http://ctan.tche.br/info/fontsampler/sampler.pdf


title: Is it really bad to use \makeatletter and \makeatother in a package or class file?

text: In my answer to this question What do \makeatletter and \makeatother do? I apparently wrote: > The commands should not be used within `.sty` and `.cls` files themselves as > they may conflict with the catcode changes that occurs when package and > class files are loaded. In fact this particular line was added in by Will Robertson. So I'm curious: can someone come up with a concrete example of how having `\makeatletter` and `\makeatother` at the beginning and end of a package or class would affect another package? I'm not talking about what happens if you leave one of them out, as discussed here: How bad is slack \makeatother discipline really?


title: Banded matrix with random entries

text: What is the optimal way to get banded matrices with random entries in LaTeX? By random, I mean the following: It should give me different entries after every compilation.


title: Change the appearance of commas in a certain font

text: I'm using the `kerkis` font, which I love everything about _except_ for the commas. (The curl of the commas is very small, making them appear like periods unless you look very closely.) Is there a way to change how the commas look, within this font? ![commas](http://i.stack.imgur.com/qxilT.png)               \documentclass[11pt]{article}     \usepackage{kmath, kerkis}     \begin{document}     It's hard to tell apart commas, and periods.     \end{document}


title: Different names of sections

text: I wish to name my sections as "Exercise x - name" in the text but as "Exercise x" in the ToC and in the `\leftmark`. Does anyone have an idea for this? I have tried just manipulating my `\leftmark` by using `\thesection` instead. My problem here lies in, that I use the `\setcounter{secnumdepth}{-1}` command so I don't have the section numbering.


title: Right aligned text in minipage vs. longtabu

text: After some brute-force attempts I found out that I could right-align two lines in a longtabu cell as follows:               \documentclass{article}          \usepackage[T1]{fontenc}     \usepackage[utf8x]{inputenc}          \usepackage{booktabs}     \usepackage{longtable}     \usepackage{tabu}     \usepackage{xcolor}          \begin{document}          \newcommand{\desc}[2]{ \begin{minipage}[t]{6em} \hfill \textbf{#1}\\  \footnotesize \raggedleft #2 \end{minipage} }          \begin{longtabu} to \linewidth{r l}      \desc{Frequency}{kHz} & \bfseries Callsign \\ \toprule     \endhead     2500 & WWV \\     3330 & CHU     \end{longtabu}          \end{document}      ![Both lines aligned to the right](http://i.stack.imgur.com/j0Wcc.png) When I change the second line to use `\hfill` it is aligned to the left:               \newcommand{\desc}[2]{ \begin{minipage}[t]{6em} \hfill \textbf{#1}\\  \footnotesize \hfill #2 \end{minipage} }      ![With hfill for both lines](http://i.stack.imgur.com/U9NfQ.png) And if I try to use `\raggedleft` for the whole minipage, like this:               \newcommand{\desc}[2]{ \begin{minipage}[t]{6em} \raggedleft \textbf{#1}\\  \footnotesize  #2 \end{minipage} }      then the document does not compile anymore. Why not? In any Office program I would just select the cell content and press the “right aligned” button, is LaTeX really that complicated?


title: Changing page number location

text: I need to do the following: For the first page of every section, the page number should be at the bottom and centered. The text should stop one "double space" above it. For all other pages, the page number should be at the top right, with the text starting one "double space" below that. How can I:   1. Change the location of the page number according to the above?    2. How can I specify a "double space" distance above/below the page number?


title: Exercises in lecture notes without predetermined placement (Follow-up)

text: I found a partial answer to my problem so I update the question, and leave the unmodified original post here below for reference. The only problem left is how to pass the actual value of a command to a macro at the moment of creation of the macro, instead that having it evaluated when the macro is called. Made lots of attemptes with `\edef`,`\expandafter`... no way! This question is a follow-up of Exercises in lecture notes without predetermined placement There, the problem was to write exercises anywhere in the text (which is very useful fo the author if part of the logic of an argument is deferred to exercises), and decide afterwards where to place them (e.g. at the end of the section). The answer provided there is really good, simple and effective. It is almost what I need, since in addition I would like to write also the answers, and have them all published e.g. at the end of the book. For this reason, I tried to modify the code in this way:               \documentclass{book}     \usepackage{amsthm}          \theoremstyle{remark}     \newtheorem*{SolInternal}{}     \newtheorem{ExInternal}{Exercise}[section]          \makeatletter     \let\@solutions\@empty%     \let\@exercises\@empty%     \newcommand\exercise[3][]{%         \g@addto@macro\@exercises{%             \begin{ExInternal}[#1]%                 \label{exercise:\theExInternal}%                 #2%             \end{ExInternal}%         }%         \global\edef\ExerciseLabel{\theExInternal}%         \g@addto@macro\@solutions{%             \begin{SolInternal}[\ExerciseLabel]%                 #3%             \end{SolInternal}%         }%     }          \newcommand\exerciseshere{%         \subsection*{Exercises}         \@exercises%         \global\let\@exercises\@empty%     }          \newcommand\solutionshere{%         \chapter*{Solutions of the Exercises}         \@solutions%         \global\let\@solutions\@empty%     }          \makeatother          \begin{document}     \chapter{This is a chapter}     \section{This is a section}     You mat try exercise \ref{myExercise}     \exercise{\label{myExercise}Show that \(2+2=4\).}{\(2+2=1+1+1+1=4\).}     \exercise{Show that \(4+4=8\)}{Apply exercise \ref{myExercise}}     And there is more text around.     \exerciseshere % creates the exercises of the section     \section{This is another section}     Here we have fun.     \exercise{Prove that \(1+1=10\).}{Use the binary system.}     \exerciseshere          \solutionshere % creates the solutions of all the book     \end{document}      This works fine, it creates automatically unique labels for the exercises; but I cannot find a way for passing them to the corresponding solutions. All solutions get the same label, that of the last exercise, because they are evaluated at the moment, the macro is called. I tried with edef, but apparently it does not what I would like... * * * **Original Post:** There, the problem was to write exercises anywhere in the text (which is very useful fo the author if part of the logic of an argument is deferred to exercises), and decide afterwards where to place them (e.g. at the end of the section). The answer provided there is really good, simple and effective. It is almost what I need, since in addition I would like to write also the answers, and have them all published e.g. at the end of the book. For this reason, I tried to modify the code and merge it with the package `answers`. More precisely, I added a `\begin{sol}#3\end{sol}` in the definition of the macro, and raised to 3 the number of arguments. It did not work, it resulted in a `Runaway Error ! File ended while scanning use of \next`. The temporary file is created, but is messed up. Any solution? The code I tried:               \documentclass{article}     \usepackage{amsthm,answers}     \Newassociation{sol}{Solution}{ans}          \theoremstyle{remark}     \newtheorem{ExInternal}{Exercise}[section]          \makeatletter     \let\@exercises\@empty%     \newcommand\exercise[3][]{%         \g@addto@macro\@exercises{%             \begin{ExInternal}[#1]%                 #2%                 \begin{sol}%                     #3%                 \end{sol}%             \end{ExInternal}%         }%     }          \newcommand\exerciseshere{%         \subsection*{Exercises}         \@exercises%         \global\let\@exercises\@empty%     }     \makeatother     \begin{document}     \Opensolutionfile{ans}[ans1]          \section{Prime Numbers}          A \emph{prime number} is a positive integer other than $1$ that is only divisible by $1$ and itself.          \exercise[Euclid's Theorem]{\label{ex:euclid}Show that there are infinitely many prime numbers.}{\(n!+1\) is prime for every \(n\).}          \exerciseshere               \Closesolutionfile{ans}     \section{Solutions}     \input{ans1}          \end{document}      And here is the temporary file I got:               $ cat ans1.tex     \begin{Solution}{1.1}      n!+1\) is prime for every \(n\).\end {sol}\end {ExInternal}\global \let \@exercises \@empty                \Closesolutionfile{ans}     \section{Solutions}     \input{ans1}          \end{document}     $


title: lost formating on one page

text: Formating on one page is broken, namely in header part there is missing one parameter (word) and the columns looks differently as shows the picture bellow. How can I correct the formating? The script can be found here and here is full compilable example with pictures (37MB) of letter M. On page 22 appears lost formating. In zip files can be view also log files from compilation. ![picture](http://i.stack.imgur.com/CYcdY.png)


title: Undocumented useful commands in Tikz

text: \tikzstyle{...}=[...]      This command seems to be extremely useful since it allows to re-use the same style in multiple TikZ pictures. Is is used in a few places in TikZ manual (pgfmanual.pdf), but why it is not defined or described? What are the other useful commands not described in TikZ manual?


title: How to draw simple arrow between words in Beamer?

text: Under Beamer, how to draw a sipmle arrow between words in itemize? I do not need to configure the size, location or any other detail settings. What I need is simply a default arrow. I tried `\rightarrow` and `\implies` but without luck.


title: Set custom page text/line width in memoir for sidepars

text: I wish to lay out a page using the memoir package so it has dimensions something like this:                 #  <--        21.6cm (Letter stock)      -->  #       #  Margin | Content     | |  Note  |  Margin  #       #  2.5cm  | <- 10cm --> | |  5.4cm |  2.5cm   #        #         |              ^.6cm     |          #      Unfortunately I seem to be overlooking something in my attempts. Here is an example of what I have tried:               \documentclass[oneside,12pt]{memoir}          \usepackage{ragged2e}     \usepackage{lipsum}          \begin{document}       \setlrmarginsandblock{2.53cm}{2.53cm}{*}%       \settypeblocksize{20cm}{10cm}{*}%       \sideparmargin{outer}%       \renewcommand{\sideparfont}{\footnotesize}%       \renewcommand{\sideparform}{\RaggedRight}       \setlength\marginparwidth{5.4cm}%       \setlength\marginparsep{0.6cm}%       \setlength{\parindent}{0pt}% no par indent       \checkandfixthelayout[nearest]%          \sidepar[]{\lipsum[2]}\lipsum[1]          Textwidth: \the\textwidth\newline     Linewidth: \the\linewidth     \end{document}      The above ends up looking like this:                 #  Margin |        Content         | |  Note  #|       #  2.5cm  |  <--   13.5cm   -->    | |  5.4cm #|      The above when run will print a `textwidth` of 284.0pt, but `linewidth` of 383.0pt. In this case there are approximately 28.425pt/cm, so the textwidth is 10cm, but linewidth is 13.47cm. This would seem to be a clue to the issue at hand, as the text appears (based on visual inspection) to be suspiciously about 3.5cm too large. Running the above, the memoir class shall output something like the following to the LaTeX log:               Stock height and width: 794.96999pt by 614.295pt     Top and edge trims: 0pt and 0pt     Page height and width: 794.96999pt by 614.295pt     Text height and width: 563pt by 284pt     Spine and edge margins: 71.13188pt and 71.13188pt     Upper and lower margins: 124.64378pt and 107.3262pt     Headheight and headsep: 14.5pt and 19.8738pt     Footskip: 30pt     Columnsep and columnseprule: 10pt and 0pt     Marginparsep and marginparwidth: 17.07182pt and 170.71652pt     Sidecapsep and sidecapwidth: 7pt and 50pt     Sidebarhsep and sidebarwidth: 7pt and 50pt     Sidebarvsep and sidebartopsep: 14.5pt and 0pt     Sidebarheight: 546.64995pt     Sidefoothsep and sidefootwidth: 7pt and 50pt     Sidefootvsep and sidefootheight: 14.5pt and 546.64995pt      One would expect that running `\settypeblocksize` would change the size of the textblock, be it updating the `textwidth`, `linewidth` or otherwise. This is consistent with my understanding of the relationship of these variables - as explained here on tex.SE. In any case, in this instance it would be quite helpful to understand   1. why the size of the textblock isn't being updated as expected;   2. why `\linewidth` differs from `\textwidth` in the amount it does; and   3. what one ought to be doing to set the appropriate width of a block of text to accommodate extra-large side-paragraphs as in the case here.


title: \subsection{AAA \Rey } error in beamer

text: My MWE is               \documentclass[presentation]{beamer}     \let\Tiny\tiny     \usepackage{hyperref}     \usetheme{Berkeley}               \newcommand\Rey{\mbox{\textit{Re}}}            \begin{document}                    \section{A section}     \subsection{AAA \Rey }     \begin{frame}       \frametitle{Frame title1}       \framesubtitle{frame subtitle1}       Some text s     \end{frame}     \end{document}      But it get errors:               <inserted text>                      \par      l.14 \subsection{AAA \Rey }      Want to get help, Thanks. :-D


title: show part of tikzpicture

text: Is it possible to extract a part of a tikzpicture? See for example this tikzpicture. I would like to show the parts with different colors on different slides. (The real picture is more complex, wide and cant be divided in different tikzpictures.)               \documentclass{beamer}     \usepackage{tikz}          \begin{document}     \begin{frame}       \begin{tikzpicture}         \draw[fill=green] (0.0, 0.0) rectangle (3.0, 2.0);         \draw[fill=blue]  (3.0, 0.0) rectangle (6.0, 2.0);         \draw[fill=red]   (6.0, 0.0) rectangle (9.0, 2.0);      \end{tikzpicture}     \end{frame}     \end{document}      If its also possible to animate the views (from left to right) like you have a window for the current view and drag it to the next part of the picture I would like to see a solution for that, too. **Update** : I just found the \clip-Command. By this I get a copy paste solution: Three slides with the code above and additional commands               \clip (0.0, 0.0) rectangle (3.0, 2.0);     \clip (3.0, 0.0) rectangle (6.0, 2.0);     \clip (6.0, 0.0) rectangle (9.0, 2.0);


title: How to increase vertical spacing between entries when using glossaries long style?

text: I am using the `glossaries` package with long style. However I don't want the entries to be so tight one to another. Minimal code:               \documentclass{book}     \usepackage{glossaries}          \newglossarystyle{customlong}{         \glossarystyle{long}         % I use this to prevent a different vertical spacing from x2 to y than from x1 to x2         \renewcommand{\glsgroupskip}{}     }     \makeglossaries          \newglossaryentry{x1}{name={x1},description={first term}}     \glsadd{x1}     \newglossaryentry{x2}{name={x2},description={second term}}     \glsadd{x2}     \newglossaryentry{y}{name={y},description={third term}}     \glsadd{y}          \begin{document}     test document     \newpage     \printglossary[type=main,style=customlong]     \end{document}      How can I increase the vertical space between entries? Thanks.


title: Beamer and Google Earth (how to call a vi)

text: I did a movie using Google Earth and I would like to call this video via my PDF presentation constructed by the beamer class, so how can I proceed? I know that it is very easy to call videos like .mp3, .mp4, .avi, etc ..., but I never faced before to call a video in the Google Earth using beamer.


title: Is there any way to get LaTeX in OneNote?

text: Any thoughts on how to get LaTeX in OneNote?


title: Suggestions for commands in TeXworks

text: Is there any auto-completion or suggestion available for commands in TeXworks? I am a beginner.


title: Understanding TikZ node placement

text: I'm having a hard time understanding how TikZ uses space               \documentclass{article}     \usepackage{tikz}      \usetikzlibrary{positioning}     \begin{document}     \tikzset{red/.style={fill=red,circle,inner sep=0pt}}     \tikzset{green/.style={fill=green,circle,inner sep=0pt}}     \begin{tikzpicture}[x=1cm,y=1cm]       \draw[help lines,step=.2] (-2,-1) grid (-1,0);      \draw[help lines,line width=.5pt,step=1] (-2,-1) grid (2,1);      \foreach \x in {-2,-1}      \node[anchor=north] at (\x,-1) {\x};      \foreach \y in {-1,0}      \node[anchor=east] at (-2,\y) {\y};      \node [rectangle,inner xsep=20mm,inner ysep=10mm,line width=.5pt](fr){};           \node [red,anchor=center] at (fr.south west){};      \node [green,anchor=center] at (-2,-1)(sw){};      \node [green,right=2mm of sw.center](r){};     \end{tikzpicture}     \end{document}      1) If you compile the above code you'll see that the red dot, which is placed with a relative coordinate, and the green one which is placed with numerical coordinates do not overlap perfectly. Why is that? 2) the node labeled r is not placed where it should be but a bit on the right, even if the distance is specified from sw.center. Why?


title: TikzDictionary slow and blocking in knitr

text: I need to knit presentations with many slides and Tikz-plots. Knitr is fantastic for this, but it takes very long time and I cant knit two reports in parallel. I have isolated the problem to the saving on disk of tikzDictionary file. There are two problems, but I suspect they are related and have same solution. Problem 1: tikzDictionary is re-written on the harddisk for every slide and plot. This slows down report generation. Problem 2: If I Rscript a second report-generation before the first is ready, there is an error and the report-generation crasches:               Quitting from lines 10-11 (./Slide_template_example.Rnw)      Error in createLockFile(lockname) : cannot create lock file     Calls: knit2pdf ... dbExists -> dbExists -> dbList -> dbList -> createLockFile      How can I define the tikzDictionary to not be re-written per slide, and not be in conflict with another R-session? Here is a minimal working (crashing) example. Run this, each in its own in terminal-window:               Rscript Report_start.R "Report1"     Rscript Report_start.R "Report2"      R-file:               ## Report_start.R     args <- commandArgs(trailingOnly = TRUE)     report.name <- as.character(args[1])     library(knitr)     knit2pdf(input="Report_master_example.Rnw", compiler='xelatex', output=paste(report.name, ".tex", sep=""))      Master-Rnw:               ## Report_master_example.Rnw     \documentclass{beamer}     \usepackage{tikz}          \title{Beamer-example}     \author{Chris}          \begin{document}          <<data.prep, include=FALSE>>=     library(ggplot2)     library(tikzDevice)     options(tikzDefaultEngine='xetex')     plot.data <- data.frame(days=c(1,2,3,4,5,6,7,8,9), price=c(2,3,4,3,5,6,5,7,8))     @          \begin{frame}[plain]     \titlepage%     \end{frame}          <<run-all-orig, include=FALSE>>=     out = NULL     for (i in 1:100) {       out = c(out, knit_child('Slide_template_example.Rnw'))     }     @     \Sexpr{paste(out, collapse = '\n')}          \end{document}      Slide-template-Rnw:               ## Slide_template_example.Rnw     <<, echo=FALSE >>=       opts_chunk$set(fig.path=paste("figure/", report.name, "-nr-", i, "-", sep=""))     @            \begin{frame}{Slide: \Sexpr{i}}     <<, echo=FALSE, dev='tikz', sanitize=TRUE, fig.width=6, fig.height=4, out.width='.40\\paperwidth', message=FALSE, warning=FALSE>>=        p <- ggplot(plot.data, aes(x=days, y=price))        p <- p + geom_line()        p     @       \end{frame}      Hopefully someone will find the example useful.


title: How to add text under symbol in equation ?

text: I was trying to make something like this ![](http://i.stack.imgur.com/F0Arq.png) (something similar to `\substack` in `\sum`) in equation. How to do this ?


title: Simple transliteration in LaTeX (for Latin)

text: I would like to typeset the same latin text in two or more "spellings". My source is a modernized spelling (distinguishing i/j, u/v) and I would like to display it both with and without this distinction. Since I would like to stay in (pdf)LaTeX, I had thought to hack the \lowercase macro by modifying lccodes and uccodes. Here is a working example, which mainly does what I want:               \documentclass{article}     \newcommand{\translit}[1]{\begingroup       \lccode`\A=`\A       \lccode`\B=`\B       \lccode`\C=`\C       \lccode`\D=`\D       \lccode`\E=`\E       \lccode`\F=`\F       \lccode`\G=`\G       \lccode`\H=`\H       \lccode`\K=`\K       \lccode`\L=`\L       \lccode`\M=`\M       \lccode`\N=`\N       \lccode`\O=`\O       \lccode`\P=`\P       \lccode`\Q=`\Q       \lccode`\R=`\R       \lccode`\S=`\S       \lccode`\T=`\T       \lccode`\W=`\W       \lccode`\X=`\X       \lccode`\Y=`\Y       \lccode`\Z=`\Z            \lccode`\I=`\I       \lccode`\J=`\I            \lccode`\U=`\V       \lccode`\V=`\V            \lccode`\v=`\u       \lccode`\j=`\i            \uccode`\u=`\V       \uccode`\j=`\I          \lowercase{#1}          \endgroup}          \begin{document}               \lowercase{Vero. Ubi et Orbi.  Nuper Quidem cum iam te adventare arbitraremur. ut queant laxis.}\par          \translit{Vero. Ubi et Orbi.  Nuper Quidem cum iam te adventare arbitraremur. ut queant laxis.}\par          % checks that the modification is local     \lowercase{Vero. Ubi et Orbi.  Nuper Quidem cum iam te adventare arbitraremur. ut queant laxis.}\par          \bigskip               Original version\par          { Arma virumque cano, Troiae qui primus ab oris          Italiam, fato profugus, Laviniaque venit          litora, multum ille et terris iactatus et alto          vi superum saevae memorem Iunonis ob iram;          multa quoque et bello passus, dum conderet urbem,                         inferretque deos Latio, genus unde Latinum}          \medskip          Modified version\par          \translit{ Arma virumque cano, Troiae qui primus ab oris          Italiam, fato profugus, Laviniaque venit          litora, multum ille et terris iactatus et alto          vi superum saevae memorem Iunonis ob iram;          multa quoque et bello passus, dum conderet urbem,                         inferretque deos Latio, genus unde Latinum}               \end{document}      My questions are:   * Is there a more sensible way to do that in LaTeX (I would rather not use XeTeX or ConTeXt at this point) (without locally changing codes) ?   * I also thought about building a dialect of the latin babel because the medieval setting does not do this: it is intended to change capitalization rules for headers and titles. Doing this development would have several advantages (I have custom things to do on ligatures, hyphenation, typographic rules) but it seems a little involved for me right now, and would certainly require a lot of help from the package maintainers (I now they are active on TeX.SE).   * Some things that this trick cannot do and I would like:     * Treat specially first letters of words. In some ancient typographic traditions, if a lowercase u/v was the first letter of a word, it was typed v, if inside the word, it was typed u. I thought this might be achieved with the same mechanism used in the french babel language file for typographic conventions: making certain characters active, etc.     * do not disturb hyphenation patterns for modified words     * Apply to text stored in definitions although it works well with inline text.


title: Compilation problem with tikz diagram

text: As I said, I'm writing math books for school; one of them is about matrices and I have several problems with it. It's a big code, so I'm trying to summarize it:   1. Problem with TikZ matrix: When I try to compile it something like              \draw [<->, yl] (A-2-4.north) to [bend left] node [arrow style mul] {$+$} (B-2-4.north);      using the `tikz` package and the following `tikz` libraries:              \usepackage{tikz}     \usetikzlibrary{decorations.pathmorphing}     \usetikzlibrary{decorations.markings}     \usetikzlibrary{shapes,snakes,calc,arrows}     \usetikzlibrary{intersections,through,backgrounds}     \usetikzlibrary{shapes.arrows,chains,positioning}     \usetikzlibrary{matrix,decorations.pathmorphing}      I get              No shaped name A-2-4 is known. See the pgf package documentation for explanation        2. And when I try to compile this (using `\include{filename}`):               \chapterimage{m2summary.pdf}      \chapter{Respostas e soluções}      \begin{multicols}{2}      \section*{\textcolor{ocre}{1. Matrizes}}      \subsection*{Exercícios de fixação}      \begin{enumerate}[label=\arabic*.]      \tiny{      \item $\ds A=\begin{bmatrix} 0 & -1 & -2 \\ 1 & 0 & -1 \\ 2 & 1 & 0 \end{bmatrix}$      }      \end{enumerate}      \end{multicols}      it shows: `Missing $ inserted`. HOW? I tried to compile with no text, actually, with no math text, and it keeps showing that $ is missing. I really don't know what to do! Sorry for making this long post, I just tried to be as complete as I can. And I use WinEdt 8, MikTeX 2.9 that I installed this week (February 2014). Code of TIKZ pic:               \begin{tikzpicture}     \matrix(A)[matrix of math nodes, nodes={node style ge}, left delimiter={[}, right delimiter={]}] at (0,0){       a_{11}                         & a_{12}                         & \cdots & a_{1n}                         \\       \node[node style sp] {a_{21}}; & \node[node style sp] {a_{22}}; & \cdots & \node[node style sp] {a_{2n}}; \\       \vdots                         & \vdots                         & \ddots & \vdots                         \\       a_{m1}                         & a_{m2}                         & \cdots & a_{mn}                         \\     };     \node [draw, above=10pt] at (A.north) {matriz $\color{ocre}A$};     \node [right=20pt] at (A.east) {$\color{ocre}+$};          \matrix(B)[matrix of math nodes, nodes={node style ge}, left delimiter={[}, right delimiter={]}] at (6,0){       b_{11}                         & b_{12}                         & \cdots & b_{1n}                         \\       \node[node style sp] {b_{21}}; & \node[node style sp] {b_{22}}; & \cdots & \node[node style sp] {b_{2n}}; \\       \vdots                         & \vdots                         & \ddots & \vdots                         \\       b_{m1}                         & b_{m2}                         & \cdots & b_{mn}                         \\     };     \node [draw, above=10pt] at (B.north) {matriz $\color{ocre}B$};          \matrix(C)[matrix of math nodes, nodes={node style ge}, left delimiter={[}, right delimiter={]}] at (6,-4.5){       c_{11}                              & c_{12}                               & \cdots & c_{1n}                                \\       \node[node style sp, ocre] {c_{21}}; & \node[node style sp, blue] {c_{22}}; & \cdots & \node[node style sp, yl] {c_{2n}}; \\       \vdots                              & \vdots                               & \ddots & \vdots                                \\       c_{m1}                              & c_{m2}                               & \cdots & c_{mn}                                \\     };     \node [draw, below=10pt] at (C.south) {matriz $\color{ocre}C=A+B$};          \node (a) [above=10pt] at (A-2-1.north) {};     \node (b) [above=10pt] at (C-2-1.north) {};          \draw [<->, yl] (A-2-4.north) to [bend left] node [arrow style mul] {$+$} (B-2-4.north);     \draw [->, yl] (B-2-4.south) to (C-2-4.north);          \draw [<->, blue] (A-2-2.north) to [bend left] node [arrow style mul] {$+$} (B-2-2.north);     \draw [->, blue] (B-2-2.south) to (C-2-2.north);          \draw [<->, ocre] (A-2-1.north) to [bend left] node [arrow style mul] {$+$} (B-2-1.north);     \draw [->, ocre] (B-2-1.south) to (C-2-1.north);     \end{tikzpicture}


title: How to display text different place than the source in LaTeX?

text: As an example: I would like to put the text of a math problem and the solution of the problem in the same input file next to each other, but in the pdf book I want to separate them into different sections. How to do it?


title: How to remove diaeresis after hyphen

text: To quote Wikipedia: > In Dutch, spellings such as coëfficiënt are necessary because the digraphs > oe and ie normally represent the simple vowels [u] and [i], respectively. > However, hyphenation is now preferred for compound words so that zeeëend > (sea duck) is now spelled zee-eend. Because the diaeresis is used to indicate that two letters should not be read as a digraph, it should be removed when this is indicated in an other way (a hyphen at a line break, for example). There are still cases where hyphenation removes the diaeresis: ‘financiën’ should be hyphenated as ‘fi-nan-ci-en’. Unfortunately, when using               \usepackage{polyglossia}     \setdefaultlanguage{dutch}      the word is hyphenated as ‘financi-ën’ (when hyphenation happens at a line break). Is it possible to make XeLaTeX/Polyglossia remove the diaeresis when hyphenation happens? The language-specific options in the Polyglossia manual do not offer a solution to this problem. The Babel manual mentions the `\@trema` macro, and indeed, when using pdfLaTeX and Babel, `financi"en` is hyphenated correctly (removing the diaeresis) at line breaks. I did find this ugly hack, but I am convinced there should be a better solution.


title: ltablex inside environment throws \end -error

text: I wanted to use a `tabularx` (`ltablex` package) inside an environment, but there is an error (but it still builds okay). I'm using `ltablex`, because I want a `longtable` spanning several pages with the behaviour of `tabularx` (having one or more columns auto-size via "X"). The example is a stripped down minimal version to show the error (for this simple example I wouldn't bother to create a new environment, the real thing has more formatting).               \documentclass[a4paper]{scrartcl}     \usepackage[margin=1in]{geometry}     \usepackage[utf8]{inputenc}     \usepackage[english]{babel}     \usepackage{ltablex} % includes tabularx, but combined with longtables (spanning multiple pages)          \newenvironment{deftable}{        \tabularx{\textwidth}{ |p{5cm}|X| }     }{        \endtabularx     }          \begin{document}          \begin{deftable}       cell & anothercell \\ \hline       more cells & Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren \\     \end{deftable}          \end{document}      The error I'm getting is:               ! LaTeX Error: \begin{deftable} on input line 13 ended by \end{tabularx}.      I think the `tabularx` processor does not consume the `\end{tabularx}` that is put on the stack by `\endtabularx` ... but seriously, I know LaTeX not good enough to figure out some solution.


title: Efficiently maintaining a long-term Bibliography database

text: I am working on a long-term research project and I would like to maintain a somewhat large bibliography (~500 papers). I am using Lyx, but I can also deal with Latex; can anyone suggest program to efficiently maintain a bibliography. I anticipate that there will be a few papers written on this long-term topic in the coming years, and I would like to try to find an organized way to cite sources from the bibliography database I wish to construct. Does anyone have any advice? Would bibTex be good for this? Please take into consideration that I use Lyx


title: Source code listing with frame around code?

text: I'd like to make my code listing looking more sexy. I found a good example on SO, but one problem is remaining: I would like to not only have a horizontal line at the bottom of the listing but also at the left and right side. Therefore I changed frame=b to frame = blr. This works fine, but the problem is now that there is a small gap between the vertical lines and the caption box. How can I correct this? I want a closed box with a caption around my listing.


title: curved bar in mindmap

text: Does anyone know how to draw a curved bar in mindmap? Here is my graph and code. I want the straight bars from the blue and red circles to the orange one be replaced by two curved ones like the black lines but with mindmap style and decoration. ![enter image description here](http://i.stack.imgur.com/mYcv0.png) `               \documentclass{scrbook}              \usepackage{tikz}         \usetikzlibrary{mindmap,trees}         \pagestyle{empty}              \begin{document}         \LARGE              \begin{tikzpicture}                \path[mindmap,concept color=orange!80!white,text=white]             node (fc) at (0,-1) [concept] {Final consumer}             %[decoration={angle=45}]             %[clockwise from=135]             child[concept color=red!80!white] {               node(pp) at (-3,13)[concept] {Plastic products}               [clockwise from=90]               child {node[concept] {Plastic} }             }               child[concept color=blue!80!white]{               node(mp) at (4,13)[concept] {Metal Products}               [clockwise from=90]               child { node[concept] {Iron and Steel} }             }             child[concept color=violet!80!white]{               node(mv) at (-1.5,9.1)[concept] {Motor Vehicles}             }         ;         \path (mp) to[circle connection bar switch color=from (blue!80!white) to (violet!80!white)] (mv) ;         \path (pp) to[circle connection bar switch color=from (red!80!white) to (violet!80!white)] (mv) ;         \path (pp) to[circle connection bar switch color=from (red!80!white) to (blue!80!white)] (mp) ;              \end{tikzpicture}              \end{document}


title: How does BibTeX sort references?

text: How does LaTeX sort references as it is causing the first reference I have used to be numbered as [2] in the document rather than [1]. See below: `Technology has been introduced in various ways within healthcare applications to support the delivery of reminders [2]. One of the most prevalent approaches to date for the delivery of reminders has been through the use of mobile phones, especially within the domain of provision of support for persons with dementia [1, 3].` Ref [2] in this paragraph is the first reference in my `.bib` file, how can I get it to be shown as [1]?               \documentclass[a4paper,12pt]{article}     \begin{document}          Technology has been introduced in various ways within healthcare applications to support the delivery of reminders \cite{GatorTechSmartHouse}. One of the most prevalent appraches to date for the delivery of reminders has been through the use of mobile phones, especially within the domain of provision support for persons with dementia \cite{NextGenerationOfMobileMedicationManagementSolutions, VideoRemindersAsCognitiveProstheticsForPeopleWithDementia}.          \bibliographystyle{plain}     \bibliography{ref}     \end{document}      .bib file               @article{     GatorTechSmartHouse,         Author = {S. Helal, W. Mann, H. El-Zabadani, J.King, Y. Kaddoura, E. Jansen},         Title = {The {G}ator {T}ech {S}mart {H}ouse: a programmable pervasive space},         Journal = {Computer},         Volume = {38, No. 3},         Pages = {50-60},         Year = {2001}     }          @article{     NextGenerationOfMobileMedicationManagementSolutions,         Author = {C.D. Nugent, D. Finlay, R. Davis, M. Mulvenna, J. Wallace, C. Paggetti, E. Tamburini, N. Black},         Title = {The next generation of mobile medication management solutions},         Journal = {International {J}ournal of {E}lectronic {H}ealthcare},         Volume = {3, No. 1},         Pages = {7-31},         Year = {2007}     }          @article{     VideoRemindersAsCognitiveProstheticsForPeopleWithDementia,         Author = {S. O'Neill, S. Manson, G. Parente, M.P. Donnelly, C.D. Nugent, S. McClean, B. Scotney, D. Craig},         Title = {Video reminders as cognitive prosthetics for people with dementia},         Journal = {Ageing {I}nternational},         Volume = {36, No. 2},         Pages = {267-282},         Year = {2011}     }


title: Put a grey background behind code extracts in a Latex document (like this site does)

text: I'm using the `listings` user package to insert extracts of code into my document, however it isn't distinct enough from the normal text as I'd like. Is there a way to put a grey background behind the code extracts, like the ones used on this site? e.g:               #include <stdio.h>          int main(int argc, char ** argv)     {       printf("Hello world!\n");       return 0;     }      Also/alternatively, can I indent the code, so the areas of code have wider margins?


title: How can I typeset those braces?

text: How can I typeset the following expression? ![enter image description here](http://i.stack.imgur.com/5WLCG.jpg)


title: Horizontal line below figure caption

text: I would like to draw a horizontal line/rule beneath my multi-line caption to separate the caption more clearly from the rest of the text. A quick example:               \begin{figure}[tb]       \begin{center}         \includegraphics[width=\textwidth]{./fig/test}       \end{center}       \caption{`Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed                 do eiusmod tempor incididunt ut labore et dolore magna aliqua.                 Ut enim ad minim veniam, quis nostrud exercitation ullamco                 laboris nisi ut aliquip ex ea commodo consequat. Duis aute                 irure dolor in reprehenderit in voluptate velit esse cillum                 dolore eu fugiat nulla pariatur. Excepteur sint occaecat                 cupidatat non proident, sunt in culpa qui officia deserunt                 mollit anim id est laborum`}       \label{fig:test}     \end{figure}      At the end of the caption I would like to put something like `\newline\hrule` or something similiar to the suggestions made in a related post:   * How to draw a line between two paragraphs of my text?


title: How space itemize

text: How to set space between each items to 2ex, between subitems to 1ex, between an item and its subitem to 1ex, between a subitem and the next item to 2ex? I've tried to proceed this way:               \documentclass{beamer}     \makeatletter     \def\@listii{\leftmargin\leftmarginii                   \topsep    1ex                   \parsep    0\p@   \@plus\p@                   \itemsep   \parsep}     \makeatother     \begin{document}         \begin{frame}             \begin{itemize}                 \item Here are two interesting things:                 \begin{itemize}                     \item Here are two interesting things:                     \item Here are two interesting things:                 \end{itemize}                     \item Here are two interesting things:                     \item Here are two interesting things:             \end{itemize}         \end{frame}     \end{document}      Thanks in advance!


title: Page numbering 143/141

text: I have a large latex document, compiled with pdflatex. When it compiles (I compile twice, I have tried compiling thrice) the page numbers come out as: 1/141 2/141 ... 142/141 143/141 On the bottom.It seems to be two numbers short. In the rest of the document the page numbers rise in order and all is fine. What are the typical reasons for such a problem? Normally I know where to start trouble shooting, when it comes to this I am pretty lost.


title: nomencl+hyperref: Clickable links when entry appears in text?

text: Is it somehow possible to create a nomenclature using the `nomencl` package in conjunction with the `hyperref` package, so that whenever a nomenclature entry appears in the main text, it is actually a clickable link to the entry in the nomenclature? Something like this:               \documentclass{minimal}     \usepackage{nomencl}     \makenomenclature     \usepackage{hyperref}     \begin{document}          Here, I define My Fancy Abbreviation (MFA\nomenclature{MFA}{My fancy abbreviation}).     Later on in the text, I want to use MFA, which should be a link to     the nomenclature entry.          \clearpage{}          \printnomenclature{}     \end{document}


title: Diagonal Resistor Label Font Size and Curved Arrows

text: I'm trying to draw a Wheatstone Bridge and this is the code I have so far:               \documentclass[12pt]{article}     \usepackage[americanvoltages,fulldiodes,siunitx]{circuitikz}     \usepackage[pdftex]{graphicx}     \usepackage[width=16.00cm, height=22.00cm]{geometry}     \usepackage{letltxmacro}     \begin{document}           \begin{circuitikz}[scale=2.5]\draw       (0,0) to[battery1, l=$V$] (0,2) -- (2,2)       to[R=$R_1$,*-*] (1,1)       to[R=$R_3$, *-*] (2,0) -- (0,0);           \draw (2,2) to[R=$R_2$, *-*] (3,1)             to[R=$R_4$, *-*] (2,0);      \draw (1,1) to[R=$R_5$, *-*] (3,1);           \draw[>=latex,->,color=magenta,text=black, thick] (0.6,1.9)            to[out=-0,in=-0] (1.4,1.9) to[out=8,in=70] (0.8,1)node[anchor=east]{$I_a$}           to[out=-70,in=-0] (1.4,0.1) to[out=-0,in=-0] (0.5,0.1);            \draw[>=latex,->,color=magenta,text=black, thick](1.7,1.3)arc(220:-50:0.4 and 0.15);            \draw[>=latex,<-,color=magenta,text=black, thick](1.7,0.8)arc(-220:50:0.4 and 0.15);           \filldraw[fill=black] (2,1.5) circle(0pt)node[anchor=south]{$I_b$};      \filldraw[fill=black] (2,0.78) circle(0pt)node[anchor=north]{$I_c$};      \end{circuitikz}      And this is what it produces: ![enter image description here](http://i.stack.imgur.com/HnMwE.png) Note how huge the labels for the diagonal resistors are! **Question 1:** How can I make the font size of these labels back to normal (i.e. the same size as `$R_5$` and `$V$`)? I don't want to use font size editors like `\tiny` or `\small`; I already did that and even `\tiny` still makes the font size slightly larger than normal. There should be a more natural way for the font size _not_ to increase and just stay the way it's supposed to, no? **Question 2:** The long curved arrow for `$I_a$` has a sharp corner near the middle that I want to smooth out (to make it a smooth curve), and the top and bottom corners of the arrow don't seem to be very naturally transitioning (i.e. you can see that there is a bit of a jaggedness, the curved line doesn't naturally flow into the flat line). Is there an easy way to fix these top/middle/bottom corners instead of having to individually tweak all the `in/out` angles, and if so, how? Thank you!


title: Vertical alignment with array package when the line width is fixed

text: I created a post earlier on the same topic (Vertical alignment in tables). I got an answer but it triggered another question. Below the solution that has been provided. I would expect vertical centering but the text goes on top of each cell. Playing with `p`, `m`, and `b` to align vertically doesn't seem to work here. I have probably missed something...               \documentclass{article}     \usepackage[english]{babel}     \usepackage{array}          \begin{document}          \begin{tabular}{ |m{2cm}|m{2cm}|m{2cm}|@{}l@{}}        \hline          x &          x &          x &\\[5mm]        \hline     \end{tabular}          \end{document}


title: Starting with TeX (not LaTeX)

text: I've been using LaTeX for 3 years and I'm decided to switch to (plain) TeX. For the moment I'm reading _The TeXbook_ for the third time (I quietly start to read the double-danger signed paragraphs) and I'm looking for informations about stuff that are not covered in the book but needed to use TeX with all that has been added since the 90's: etex, eplain, preloading other formats, pdftex, texmf trees, character encodings (utf8/latin1), foreign language hyphenation (French in particular), use of colors, image inclusion, _etc_. I also read somewhere that TeX's modern implementation have switched from 256 to (a higher number I've forgotten) registers. What about it?


title: Connecting two nodes with horizontal-vertical-horizontal line in tikz

text: I am working on this example: Simple flow chart               \documentclass{article}     \usepackage[latin1]{inputenc}     \usepackage{tikz}     \usetikzlibrary{shapes,arrows}     \usepackage{verbatim}     \usepackage[active,tightpage]{preview}     \begin{document}     \pagestyle{empty}     % Define block styles     \tikzstyle{decision} = [diamond, draw, fill=blue!20,          text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]     \tikzstyle{block} = [rectangle, draw, fill=blue!20,          text width=5em, text centered, rounded corners, minimum height=4em]     \tikzstyle{line} = [draw, -latex']     \tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm,         minimum height=2em]      \begin{tikzpicture}[node distance = 2cm, auto]         % Place nodes         \node [block] (init) {initialize model};         \node [cloud, left of=init] (expert) {expert};         \node [cloud, right of=init] (system) {system};         \node [block, below of=init] (identify) {identify candidate models};         \node [block, below of=identify] (evaluate) {evaluate candidate models};         \node [block, left of=evaluate, node distance=3cm] (update) {update model};         \node [decision, below of=evaluate] (decide) {is best candidate better?};         \node [block, below of=decide, node distance=3cm] (stop) {stop};         % Draw edges         \path [line] (init) -- (identify);         \path [line] (identify) -- (evaluate);         \path [line] (evaluate) -- (decide);         \path [line] (decide) -| node [near start] {yes} (update);         \path [line] (update) |- (identify);         \path [line] (decide) -- node {no}(stop);         \path [line,dashed] (expert) -- (init);         \path [line,dashed] (system) -- (init);         \path [line,dashed] (system) |- (evaluate);     \end{tikzpicture}     \end{document}      I would like to remove the "update model" node and to connect directly the decision node node and the "identify..." one with an horizontal-vertical- horizontal line. I naively tried to use                \path [line] (decide) -|- node [near start] {yes} (identify)      but it doesn't work. Is there any simple way to do this?


title: how to make hard code in table of content?

text: I am using the `pdfpages` package for including a few pages of pdf to my main LaTeX document, therefore I would like to add some lines to the table of content for that pages by myself. I am using the `titletoc` package as well. I hope something like the following works:               \addtocontents{toc}{Preface to 2ed \titlerule i}     \addtocontents{toc}{Preface to 1ed \titlerule ii}      for the display > Preface to 2ed ............................................ i > > Preface to 1ed ............................................ ii where both "Preface" and the page numbers "i/ii" are typed by myself, while the "titlerule" should be consistent with what is being used. Can someone help?


title: Vertical text (not in table)

text: For a book cover, I want to write the title vertically (like in Japanese, but using English text):                        T     T        I     H        T     I  I  M  L     S  S  Y  E      How do I do this without jumping through a host of `\vbox` and `\hbox`es?


title: How to get the last element of a specific column from a CSV file?

text: I have CSV files of different lengths. For example               a,b,c,d,e     0,0, 5, 5, 1     0,5, 5, 11, 2     0,11, 5, 16, 1     5,0, 10, 6, 1     5,6, 10, 11, 2      I want to get the value of the last element of the `c` and `d` columns, for example `c`=10 and `d`=11. And every time with a different file of different length. I am using the `datatool` package.               \DTLloaddb[         headers={a,b,c,d,e},         keys={a,b,c,d,e}     ]{data}{input}      .....     ....     \DTLforeach*{data}{\a=a,\b=b,\c=c,\d=d,\e=e}{     ......     ...     \eappto\mydraws{[gray, fill=\k,line width=0.05cm] (axis cs:\a,\b) rectangle (axis cs:\c,\d);}%     }      I don't know how I can access only the last element of a specific column.


title: Why is there an overfull box with \[ ... \]

text: \documentclass{article}     \begin{document}     \hsize 200pt          %A wonderful serenity has taken possession of my entire soul, like these sweet     %mornings of spring which I enjoy with my whole heart.          \[ e=mc^2 \]     \end{document}      gives me an overfull hbox:               Overfull \hbox (22.0021pt too wide) in paragraph at lines 9--9     [][]       using `$$...$$` instead of `\[...\]` works fine. Using a soon-to-be-released tool for visual debugging shows me a strange box sticking out to the right: ![strangeboxstickingouttotheright](http://i.stack.imgur.com/jiV2u.png)


title: Subsection starting in same line as subsection name

text: Many articles are structured in the following way: # 1\. [Title of section 1] 1.1. **[title of subsection 1.1]**.text of subsection 1.1 1.2. **[title of subsection 1.2]**.text of subsection 1.2. # 2\. [Title os section 2] 2.1. **[title of subsection 2.1]**.text of subsection 2.1 2.2. **[title of subsection 2.2]**.text of subsection 2.2. How can I do that (in a proper way)? Thanks.