title: TeX capacity exceeded with \pgfkeys

text: I'm trying to create a code listing and set custom options using `pgfkeys`. The below provided code works fine. The style handler for title option (currently commented out) is breaking TeX compilation by throwing the `capacity exceeded` error. What is wrong with the title style handler ?               \documentclass[12pt]{book}     \usepackage{tcolorbox}     \usepackage{hyperref}          \tcbuselibrary{breakable}     \tcbuselibrary{skins}     \tcbuselibrary{listings}          \pgfkeys{%       /code listing/.cd,%       title/.initial = {},%       label/.initial = {},%       %% title/.style = \pgfkeys{%       %%   /tcb/.cd,%       %%   title=#1,%       %% }%     }          \newtcbinputlisting{\CodeListing}[2][]{%       beamer, breakable, listing only,%       colback=red!5!white, fonttitle=\ttfamily,%       listing file=#2%     }          \newcommand{\IncludeCodeFromFile}[2][]{%       \pgfqkeys{/code listing}{#1}%       \CodeListing{#2}%     }          \begin{document}     \IncludeCodeFromFile[title=Some Code]{somefile.cxx}     \end{document}


title: Can the font of chords be changed ("songs" package)?

text: In the `songs` package, it's possible change the font of chords? For example: Garamond font for lyrics and Computer Modern for chords? Or change the color of chords, for example: lyrics-black, chords-red?


title: Use placeins for subsections

text: I would like to place figures in my document in certain `subsections`. Normally I would achieve this with `float` using `[H]`. But this would mean, that the figures are at fixed points in my text and sometimes this just doesn't look good. I already found this question: How do I ensure that figures appear in the section they're associated with? How can I tell LaTeX use `subsections` as `float barriers` instead of `sections`.


title: Using LaTeX3’s xtemplate

text: > Relevant are the answers to _Moving to LaTeX3 for package authors_ and _What > new bits have already been implemented in Latex3? Will my current documents > (with many packages) still compile with Latex3?_ How is `xtemplate` properly used? I’ve read the package documentation and Lars Hellström’s _Some notes on templates_, and I’ve tried to make sense of the `xfrac` implementation. What I’ve gleaned is that there are “objects”, “templates”, “keys”, and “instances”. But how they interact is confusing, and `xfrac` has too many options to grasp easily (and is written assuming the reader understands `xtemplate`, rather than as an `xtemplate` tutorial). Can the concepts of `xtemplate` be described in a simple-but-complete worked example?


title: Recreate the conditions of the document preamble while loading a file in the document body

text: While in the document body I like to temporary switch back to the mode active in the LaTeX preamble, i.e. spaces between macros should be ignored. I don't mind whether I get the `! LaTeX Error: Missing \begin{document}` or not. I'm aware that this is something which is normally not done. The switch will be done by a package for loading size files. _Details:_ This is a follow-up question for my question Switching to different font size(s) locally. I like to load a file which is normally only loaded in the preamble inside a local scope in the document body. The problem is that it contains some spaces between macros which are ignored in the preamble but not the document. I can't set the catcode of the space to 'ignore', because there might be spaces inside macros which should stay spaces. Ignoring all line endings by setting `\endlinechar=-1` helps, but doesn't catch all spaces. I also tried to wrap the `\input` with `\ignorespaces .. \unskip`, but this removes only the first and last space, but keeps other spaces. I currently don't understand how the preamble mode is implemented. Apparently the typesetting mechanism of TeX is trip-wired. It would be great if answers could include some explanation how this is actually done.


title: Right-aligned columns using the tabularx environment

text: I'm trying to typeset a matrix which has entries of differing widths. However, for aesthetic reasons, I would like each of the columns of the matrix to be the same width, and I'd furthermore like them to be right-aligned. I'm working in the tabularx environment (because of its ability to adjust column width uniformly). However, if I compile               \documentclass{amsart}     \usepackage{amsmath}     \usepackage{array}     \usepackage{tabularx}          \begin{document}          \[     \left[     \begin{tabularx}{1in}{XXX}     x & 0 & y\\     0 & y & -x     \end{tabularx}     \right]     \]          \end{document}      then the columns don't have the desired justification. I looked through the tabularx documentation and discovered that I should define a new column type. So I tried the following:               \documentclass{amsart}     \usepackage{amsmath}     \usepackage{array}     \usepackage{tabularx}          \begin{document}          \newcolumntype{R}{>{\raggedleft\arraybackslash}X}          \[     \left[     \begin{tabularx}{1in}{RRR}     x & 0 & y\\     0 & y & -x     \end{tabularx}     \right]     \]          \end{document}      This produced no change in output. What am I missing? EDIT: The following code               \documentclass{amsart}     \usepackage{amsmath}     \usepackage{array}     \usepackage{tabularx}          \begin{document}          \newcolumntype{P}{>{\raggedleft\arraybackslash }p{.075in}}     \newcolumntype{Q}{>{\raggedleft\arraybackslash $}p{0.075in}<{$}}          $\left[\begin{array}{PPP}     x & 0 & y\\     0 & y & -x     \end{array}\right]$         \qquad         $\left[\begin{array}{QQQ}     x & 0 & y\\     0 & y & -x     \end{array}\right]$          \end{document}      produces THIS output: ![enter image description here](http://i.stack.imgur.com/hF7hF.png)


title: What I need to use extra symbols in MinionPro?

text: I've just installed MinionPro fonts for LaTeX, as it is written in the HowTo of the `minionpro` package. My font's version is "`Version 2.030;PS 2.000;hotconv 1.0.51;makeotf.lib2.0.1867`. Than, I tried to test the fonts, and use extra symbols by `\PiSymbol` command, like this:               \documentclass[a4paper,12pt]{article}     \usepackage[utf8]{inputenc}     \usepackage[T1]{fontenc}     \usepackage[magyar]{babel}     \usepackage{MinionPro}     \usepackage{pifont}     \begin{document}     \Pisymbol{MinionPro-Extra}{110}     \end{document}      Compiling this with `pdflatex`, it gives the following message:                pdfTeX warning: pdflatex (file      /usr/share/texmf/fonts/type1/adobe/MinionPro/Min      ionPro-Regular.pfb): glyph `orn.011'      undefined      And in the PDF output, an ugly box appears instead the expected symbol. Please give any hints, where to look for the reason of this error, what is missing for it to work. I've googled a lot, but haven't found anything.


title: How to include the € symbol?

text: In my *.cls class file I loaded               \usepackage[T1]{fontenc}     \usepackage[utf8]{inputenc}      (does the order of the two matter?) and get the following **error message** : `Command \texteuro unavailable in encoding T1.`   * Why can't I insert the EURO € symbol?   * Do I need to to load a special package, e.g. `eurosym`?   * Can I just type it plainly, or do I need to wrap it in TeX-code?


title: Figure breaks listing, how to avoid that?

text: I have a listing in my document and some lines before it I'm inserting a figure, doing the following:               \begin{figure}[htbp]     \begin{center}     \includegraphics[scale=0.7]{filename.png}     \caption{Caption}     \label{fig:label}     \end{center}     \end{figure}      Unfortunately the figure is breaking the listing in two and I don't know how to avoid that. I tried changing the figure positioning, but I couldn't find a good looking solution. EDIT: The listing mentioned is a container for software code, like the following:               \begin{lstlisting}[language=C, label=lst, caption="Software", breaklines=true]      //my code here     \end{lstlisting}


title: How do I get fontspec to work with text color white in XeLaTeX

text:
In a previous question ( How do I globally set the text color in XeLaTeX ), I've asked how to globally set a text colour in XeLaTeX and got some excellent answers. However, while the proposed mechanisms seem to work in most cases, they also seem to fail consistently for the colour `white`. I'm not sure if this is a bug or if I'm doing something wrong here, but please consider the following example:               \documentclass{report}     \usepackage{xcolor}     \usepackage{fontspec}     \setmainfont[Color=white]{Linux Libertine O}     \setsansfont[Color=white]{Linux Biolinum O}     \setmonofont[Color=white]{Inconsolata}          \pagecolor{darkgray}          \begin{document}     \chapter{A chapter}     \section{A section}     \texttt{Some mono text}     The text above is invisible as it is all black and not white.          {\addfontfeature{Color=yellow} Some yellow text showing up on the dark page.}     {\addfontfeature{Color=white} Some white text invisible on the dark page.}          \end{document}      The example follows @AlanMunn s suggestion on the other question. The result is: ![White text is black](http://i.stack.imgur.com/4jpGM.png) The white text is printed in black. Other colours (like yellow in the example) work well. If I use @Herbert s suggestion of adding               \AtBeginDocument{\color{white}}
     \addtokomafont{sectioning}{\color{white}}
      to the document, I keep stumbling over environments that are still black, like the captions of figures for example. In any case, the `\color` command seems to be stronger than the `fontspec` setting. Any thoughts or solutions to this?


title: Display first (sub) environment in an environment

text: I would like to make a bank of problems of similar type--however, I only want to display the first of each time. For example:               \begin{bank}       \begin{exercise} 2+2     \end{exercise}          \begin{exercise} 4+3     \end{exercise}     \end{bank}      Would only show the exercise 2+2. Any help on this would be great. Note: this questions seems similar to Getting the first line of an environment and I've tried something like:               \def\getline#1\par{%     \gdef\theline{#1}#1%     }          \newenvironment{bank}{%       \getline%     }{\theline}      but this displays the contents of bank, and then the first environment.


title: How to keep title, table and caption together in 1 page?

text: I have one table which is dynamic (number of rows varies from 2 to 20). This table has title and caption. But I need title, table and caption all 3 should be in the same page i.e. need to avoid title or caption hanging on one page and table on another page. How can I control it. Please help me as I am in great need. Thanks


title: Fit four authors across on one row in "sigplanconf" style?

text: Is there some hack out there to make it possible to fit four authors across in one row in the `sigplanconf` class? No matter how short each author's name, affiliation, and email is, by default the style fits only 3 authors across in one row. Having four authors results in a massive amount of wasted space. Ideally, I'd like to have this:                                 Article Title          Fname Lname   Fname Lname   Fname Lname   Fname Lname        dept           dept         dept          dept       school         school       school        school      email@edu     email@edu     email@edu     email@edu                    Abstract                .....................     ....................         .....................     ....................         .....................     ....................         .....................      But this is what I have instead:                                 Article Title          Fname Lname        Fname Lname       Fname Lname           dept               dept              dept              school             school            school            email@edu          email@edu         email@edu                                 Fname Lname                           dept                          school                         email@edu                Abstract               .....................     ....................         .....................     ....................         .....................     ....................         .....................      Is there something I can do to `\authorinfo` to force them to be wider, or to squeeze 4 to a column? My document looks like:               \documentclass[preprint,10pt]{sigplanconf}          \usepackage{amsmath}          \begin{document}          \title{My Title}          \authorinfo{Fname Lname}                {school}                {email@edu}     \authorinfo{Fname Lname}                {school}                {email@edu}     \authorinfo{Fname Lname}                {school}                {email@edu}     \authorinfo{Fname Lname}                {school}                {email@edu}          \maketitle          \begin{abstract}     ...


title: LaTeX Markup Options?

text: I was wondering what prevented the implementation of a MarkDown system _in_ (La)TeX? I know that pandoc does a conversion of MarkDown with extra features to LaTeX. I also know that many are happy with the way LaTeX is right now, so please do not feel offended. In particular I was wondering why stuff like `->` or `=>` cannot be translated to `\rightarrow` or `\Rightarrow` and similar transformations along with the usual MarkDown features. After all to me it seems that (La)Tex after all is a way to mark-up plain text in a way that it can be rendered neatly for printing devices. I also know that there's LyX and TeXmacs but those have left the plain-text approach of tex. In particular I'm genuine curious _if_ and _why_ one could not implement MarkDown features right in LaTeX, after all TeX is Turing complete, no? Does it in some way break the existing system in a way I do not see? There's a lot that could make writing text a little more _pleasant_ on the eyes. For example, writing a theorem like so:               THEOREM: ...          PROOF: ...               Next paragraph continues after two new lines...      and similarly for definitions lemmata, you name it. Again please don't get me wrong. There are enormous amounts of useful commands in (La)TeX. As it is now, (La)TeX does do some of these transformations already. E.g. turning --- into an em-dash or treating a blank line as the separation of two paragraphs. And modern (La)TeX can deal with unicode thus not necessarily requiring the ASCII- fication of Greek Letters. There will always be more obscure things one wants to do with (La)TeX, but what is preventing the system from incorporating features like these? Or am I missing something completely and this is possible already?


title: Windows 8 style font in LaTeX

text: How do I get the Windows 8 font styling in LaTeX(the package)? A sample font is:![enter image description here](http://i.stack.imgur.com/iU1CT.png)


title: TeX question: how to switch between languages?

text: I am using TeX, with the macro package AmS-TeX. I'd like to use it with the Italian language, so that words are hyphenated the right way (e.g. the Italian word 'distante' should be broken as di-stante; TeX instead breaks it as dis- tante, like it would break the English word 'distant'). In addition, is it possible to switch between different languages in the same document? If so, then how? I have found solution to this problem only for LaTeX; I need, instead, a solution for TeX.


title: show the numerical labels only in one subsections or entities of multibib package

text: uncommenting the following line in moderncv with multibib package show the numerical labels in the bibliography.               \makeatother     \renewcommand*{\bibliographyitemlabel}{[\arabic{enumiv}]}      But how to show the numerical labels only in one subsections or entities of multibib.


title: How do I install TikZ on a MacBook?

text: I have no knowledge of programming... I have a MacBook OS10.6 with Tex Shop, updated... after placing the zipped file into `/Users/myname/Library/texmf/tex` folder, I open terminal in utilities and type `texhash`...this is what I get...               Last login: Tue Feb 15 12:31:42 on console You have mail.     anns-macbook:~ ann$     anns-macbook:~ ann$ texhash     texhash: /usr/local/texlive/2010/../texmf-local: directory not writable.     Skipping... texhash: /usr/local/texlive/2010/texmf: directory not writable.     Skipping... texhash: /usr/local/texlive/2010/texmf-config: directory not writable.     Skipping... texhash: /usr/local/texlive/2010/texmf-dist: directory not writable.     Skipping... texhash: /usr/local/texlive/2010/texmf-var: directory not writable.      Skipping... texhash: Done.      Any ideas, I can't use the `pgf` library in TeX Shop since TeX Shop can't seem to find the library in the folder structure I've created


title: add lines into tex file

text: I have this tex file coming from matlab.               \begin{tikzpicture}     \begin{axis}[%     width=\figurewidth,     height=\figureheight,     scale only axis,     xmin=1,     xmax=5,     ymin=2,     ymax=10     ]     \addplot [color=red,line width=4.0pt,only marks,mark=*,mark options={solid},forget plot]       table[row sep=crcr]{     1   2   \\     2   4   \\     3   6   \\     4   8   \\     5   10  \\     };     \end{axis}     \end{tikzpicture}%      I want to add `xlabel` and `ylabel` inside it like               xmin=1,     xmax=5,     ymin=2,     ymax=10,     xlabel=X,     ylabel=Y,      if I run another latex file like mentioned here.               \documentclass{minimal}     \newwrite\tempfile     \begin{document}     \immediate\openout\tempfile=lists.tex     \immediate\write\tempfile{xlabel=X,}     \immediate\write\tempfile{ylabel=Y,}     \immediate\closeout\tempfile     \input{lists}     \end{document}      Can I write these to specific lines?


title: Best practive for managing the same bibliography files across several machines?

text: If you are/have using/used the same bibliography files across several machines (say a laptop and a desktop machine) of yours...   * How did you solve the problem of consistency? With a version control system (e.g. git) and/or a web hosting service (e.g. Dropbox) and/or a USB drive?   * What is your method to manage the bibliography file itself? Editing the .bib-file directly or with a tool?   * Has anyone run into a problem with this issue as a whole? What did you learn?


title: Is there an alternative to textpos when using pgfpages?

text: I have a completed beamer presentation in which I make extensive use of `textpos` package for absolute positioning, in particular of the `textblock*` environment. Now, I wanted to add notes to this presentation with `\setbeameroption{show notes on second screen=left}`, which didn't work. I learned here that the `textpos` package and the `pgfpages` package interfere with each other and do not work properly together while using absolute positioning. Is there an easy way to obtain the functionality of `textpos`, but in compliance with `pgfpages` (e.g. using some tikz commands) and preferably without having to reposition all of my `textblock*` environments? For reference, these environments contain single graphics as well as more complicated latex code.


title: Control shrinking of font size in cases environment

text: I'm, using the `cases` environment of the `amsmath` package and I was wondering whether there is a method to control the shrinking of certain elements of it. E.g. when there is a fraction, the elements in the nominator and denominator are shrinked compared to the non-fractional case. What I would be interested in, is e.g. whether I can enlarge the shrinked element a bit to increase its readability. Please see:               \documentclass{article}     \usepackage{amsmath}     \begin{document}     \begin{align}     x=\begin{cases}     \frac{a+b+c}{d+e+f}\\     a+b+c\\     d+e+f     \end{cases}     \end{align}     \end{document}      ![enter image description here](http://i.stack.imgur.com/g09yk.png)


title: Change bookmark depth

text: I want all bookmarks after "Anhang" (appendix) to be a level deeper, but I need them to be \chapter{} for the right numbering. I write a scrbook document and that's what I got: ![Issue](http://i.stack.imgur.com/yO4bn.png) Is it possible to change the depth of the chapter to act like a section in the bookmarks? **UPDATE** MWE:               \documentclass[12pt,a4paper,oneside]{scrbook}          \usepackage[ngerman]{babel}     % deutsche Worttrennung     \usepackage[T1]{fontenc}        % Ausgabe von Sonderzeichen und Akzenten in PDF verbessert     \usepackage[utf8]{inputenc}         % Eingabe von Sonderzeichen möglich     \usepackage{lipsum}          \setcounter{secnumdepth}{3}     % subsubsections nummerieren     \setcounter{tocdepth}{3}        % subsubsections in TOC          \usepackage[ %         pdfproducer={Texmaker},     %          pdfcreator={pdfLaTeX},      %          hidelinks,          % versteckt die Boxen um die Links in der PDF         bookmarksnumbered,      % nummereiert Lesezeichen         ]{hyperref}         % PDF Metainformationen hinzufügen           \begin{document}          \appendix     \pagenumbering{alph}          \thispagestyle{empty}          \vspace*{3em}     \begin{center}     \begin{Huge}     \textbf{\textsf{Anhang}}     \pdfbookmark{Anhang}{Anhang}     \end{Huge}     \end{center}          \chapter{Appendix 1}          \chapter{Appendix 2}          \section{Appendix 2.1}          \section{Appendix 2.2}          \chapter{Appendix 3}          \end{document}


title: lstlistings works strangely

text: I have some Java source code and want to display it in LaTex:               \lstset{language=Java}     \begin{lstlisting}         IntentFileter intentfilter = new IntentFilter();         intentfilter.addAction("com.anguanjia.action.download.START_DOWNLOAD");         intentfilter.addAction("com.anguanjia.action.download.DOWNLOAD_SUCCESS");         g = new blm(this, null);         m.registerReceiver(g, intentfilter);     \end{lstlisting}      But the output is indeed ugly: ![enter image description here](http://i.stack.imgur.com/2nuLC.png) Did I do something wrong or this is what it ought to be?


title: How to use variables in draw?

text: I want to read in a `.csv` file and draw each line as a point (x,y) with his color (r,g,b). I managed to set the points and the drawing part is fine except for the color. How can I use my variables out of my `.csv` file in the draw- method? **EDIT:** Draw is used the way I thought it was supposed to, I got an error for no reason ( }; was too much, looks like my face when realizing my fault) and now it works (thx to percusse)                   \begin{filecontents*}{data.csv}         x,y,r,g,b         1,4,5,1,255         2,3,123,55,55         3,5,6,121,43         4,1,47,93,0         5,3,43,57,83         \end{filecontents*}              \documentclass{article}         \usepackage[utf8]{inputenc}         \usepackage{csvsimple}         \usepackage{tikz}              \begin{document}         \begin{tikzpicture}         \csvreader[head to column names]{data.csv}{}{             \definecolor{tmpcolor}{RGB}{\r, \g, \b};         \draw[fill=tmpcolor] (\x, \y) circle(1mm);         }         \end{tikzpicture}         \end{document}      **Important** We need an intermediate step before writing color to draw because fill={rgb:red, ...} mixed all given by their ratio. So fill={rgb:red, 0;green, 0;blue, 0} triggers an arithmetic error and won't result in black color. Other ratios result in colors different to the RGB Codecolors...


title: Custom table of contents style in ConTeXt

text: I want to change the style of the table of contents:   1. ~~Chapter entries shouldn't have a dotted line.~~ _(see below)_   2. ~~Chapters without a number should have no left spacing.~~ _(see below)_   3. The dotted line should end at the same "x-position", no matter if the page number has one or two digits. This is my current minimal (not entirely) working example code:               \setupcombinedlist[content][         alternative=c,         aligntitle=no  % has no effect?     ]          \setuplist[chapter][         alternative=b,  % has no effect?         width=1.4em,         style={\ss\bf},         aligntitle=no,  % has no effect?         before={\blank[4*big]}     ]          \setuplist[section][width=2.2em]          \setupinterlinespace[line=3.4ex]  % more line spacing     \setupwhitespace[medium]  % space between paragraphs          % maybe there is a better way decrease line spacing for TOC?…     \startsectionblockenvironment[frontpart]         \setupinterlinespace[line=1.5ex]     \stopsectionblockenvironment          \starttext         \startfrontmatter             \completecontent             \chapter{Bla}         \stopfrontmatter              \page[8]  % to get two-digit numbers              \startbodymatter             \chapter{Foo}             \section{Foo Foo}             \section{Foo Foo}             \chapter{Bar}             \section{Bar Bar}             \chapter{Baz}             \section{Baz Baz}         \stopbodymatter              \startbackmatter             \chapter{Bibliography}         \stopbackmatter              \startappendices             \chapter{CD Contents}         \stopappendices     \stoptext      Annotated result: ![ConTeXt result](http://i.stack.imgur.com/iUzfC.png) * * * It should look a bit like this LaTeX version:               \documentclass[a4paper]{scrbook}          \usepackage[english]{babel}     \usepackage[utf8]{inputenc}     \usepackage[T1]{fontenc}          \usepackage[tocfullflat]{tocstyle}     \usetocstyle{KOMAlike}          \begin{document}          \tableofcontents          \frontmatter         \chapter{Bla}          \mainmatter         \setcounter{page}{8}  % to get two-digit numbers         \chapter{Foo}         \section{Foo Foo}         \section{Foo Foo}         \chapter{Bar}         \section{Bar Bar}         \chapter{Baz}         \section{Baz Baz}          \backmatter         \chapter{Bibliography}          \appendix         \chapter{CD Contents}          \end{document}      ![LaTeX result](http://i.stack.imgur.com/D3vKU.png) * * * **Update 1:** The solution of problem 1 is quite simple: `alternative=c` must be removed from `\setupcombinedlist[content]`, because this style is passed to _all_ sublists. Instead `\setupcombinedlist[section,subsection][alternative=c]` enables a dotted line for sections and subsections only. **Update 2:** Problem 2 seems not to exist in newer ConTeXt version. The screenshot was created with version 2012.05.30 11:26. But version 2013.01.08 01:19 works as wanted.


title: qtree with fullstop

text: I want to draw a constituent tree for a sentence ending with a full stop, but this gives errors in qtree. This is the example without a full stop. Now I want to add a full stop to the end, which is connected with the root node S.               \begin{figure}     \Tree [.S [.NP LaTeX ] [.VP [.V is ] [.NP fun ] ] ]     \end{figure}      Can this be done with qtree?


title: Modifying the Bibtex style file to get reference in a different form

text: I am trying to modify a certain `.bst` file. At the moment I am able to hack the file to get the following reference output for an `inbook` entry: > Jones, W.P. 1994. Turbulence modelling and numerical solution methods for > variable density and combustion flows, _Turbulent Reacting Flows._ In, > Libby, P.A. and Williams, F.A., (Eds.). Academic Press, London, UK. pp. > 309-374. The only problem I have is that if you look above, there is a comma after the word 'In'. I know that this is because I tried to included the word 'In' in the `.bst` file. Does anyone know how to do this properly? Here is the bit of code where I modified to get 'In'.               FUNCTION {format.editors}     { editor empty$          { "" }          {            add.period$ " In" * editor format.names            editor num.names$ #1 >              { ", " * bbl.editors * }              { ", " * bbl.editor * }            if$          }        if$     }      And this is the code for the `inbook` entry               FUNCTION {inbook}     { output.bibitem       format.authors output.nonnull       new.block       format.date "year" output.check       new.sentence       format.chapter.pages "chapter and pages" output.check       format.btitle "title" output.check       crossref missing$         { format.editors output           new.block           format.publisher           new.sentence         }         { format.chapter.pages "chapter and pages" output.check           new.block           format.book.crossref output.nonnull         }       if$       format.edition output       new.sentence       format.pages output       new.block       note output       fin.entry     }


title: Derivative of a tikz path?

text: I would like to draw curves that are smooth and have linear segments. These curves are to be used in the graph of one-dimensional functions, x(t). [To be used as position vs time graphs in writing homework problems for introductory physics.] Example: ![enter image description here](http://i.stack.imgur.com/qhcu2.png) I would like to draw these plots by specifying that the curve go through particular points with particular tangents. This question very nicely implements exactly what I've described so far Implementing a syntax: Smooth curves with specified points and tangents. However, my goal is to use these curves in plots of one-dimensional functions x(t) and would really, really like to be able to generate from them curves of the derivative x'(t). Is this feasible within `tikz`? (I made the example graph above with `pgfplots`. The function is a piecewise function I constructed in Mathematica. This approach would certainly work for me, but the process is a bit of a pain. I plan on making sufficiently many problems using graphs similar to this that I would really like something more efficient. The code is below.) **Code**               \pgfmathdeclarefunction{MyF}{1}{%        \pgfmathparse{%           (and (1 , #1<=5)*(3.-0.5*#1-2.24667*#1^2+2.93766*#1^3-1.55322*#1^4+0.413019*#1^5-0.0534444*#1^6+0.00265741*#1^7))   +%          (and (5<#1 , #1<7)*(4))     +%          (and (7<=#1 , #1<12)*(131.4-156.613*#1+54.0096*#1^2-7.99267*#1^3+0.538*#1^4-0.0135556*#1^5))    +%          (and (12<=#1 , 1)*(1))  %       }%     }          \begin{tikzpicture}     \begin{axis}[axis lines = middle,minor tick num = 1, grid = both, xlabel = {$t$\,(\si{s})}, ylabel = {$x$\,(\si{m})}, no markers, smooth,xmin=0, xmax=14, ymin=-6, ymax=6, samples = 100, thick, unit vector ratio = 1]     \addplot +[very thick, domain=0:14] {MyF(x)};     \end{axis}     \end{tikzpicture}      **Update** Both of the answers below draw the derivative by constructing an explicit mathematical function for original curve, then taking its derivative numerically. I would really like to avoid constructing an explicit mathematical expression for the original curve because, for graphs like the one above, I find the expressions unwieldy and unnatural to generate. I would much rather generate the original curve via the method outlined in Implementing a syntax: Smooth curves with specified points and tangents or something similar. My question is: without an explicit mathematical expression for the curve, is it feasible within LaTeX (probably via `tikz`) to draw the derivative. For example, given a path               \draw (0,0) .. controls (1,1) and (1,1) .. (2,0);      could you draw its derivative? (Restricting our attention to paths y(x) that are single-valued functions of x).


title: Error when compiling (pdfLaTeX)

text: I wrote some lines and I wanted to view the pdf, so I compiled and built but I have this error message:               This is pdfTeX, Version 3.1415926-2.4-1.40.13 (MiKTeX 2.9 64-bit)     pdflatex.EXE: The memory dump file could not be found.     pdflatex.EXE: Data: pdflatex.fmt     texify: pdflatex failed for some reason (see log file).      Can you help me to correct this error?


title: latex: how to insert oneside figures in a twosided article?

text: I'm writing a 2 sided article with latex, but I'd like to insert a figure in appendix with width of the whole page to make it clearer. I tired with this script but it did nothing...               \appendix[oneside]     \section{Figures}     \begin{multicols}{1}     \begin{figure}[H]     \includegraphics[width=0.5\textwidth]{myfigure.eps}     \centering     \caption{BPT [NII] $\lambda6583/$H$\alpha$ vs. [OIII]$\lambda5007/$H$\beta$ diagram. }     \end{figure}     \end{multicols}     \vspace{1cm}      Could anyone help me? Thank you!!


title: Avoid: multicol Error: Error saving partial page

text: In my package I am using in the dtx file the ltxdoc class which uses multicol for the index. Currently I get this error: > ! Package multicol Error: Error saving partial page. > > See the multicol package documentation for explanation. > > l.1 \begin{theindex} > > The part of the page before the multicols environment was nearly full with > the result that starting the environment will produce an overfull page. Some > text may be lost! Please increase \premulticols either generally or for this > environment by specifying a suitable value in the second optional argument > to the multicols environment. However even if I include something like               \setlength\premulticols{10\baselineskip}      this does not change anything. In the document pdf the error is that the index runs into the bottom of the page instead of starting at a new page. An obvious solution would be to add an `\clearpage` at the end of the dtx file               % \clearpage     % \Finale     \endinput      but if this can be solved otherwise I would like to know it.


title: Using \inputminted from lyx with relative path

text: I'm using the minted package with lyx. I want to use `\inputminted` and _must_ be able to specify a relative path (to share between machines with different home directory names). The problem is that the working directory when `\inputminted` is invoked is `/tmp/lyxbuf_tmp`. This mailing list post from 2009 discusses this exact problem of copying external material to this directory, but there appears to be no resolution that I can find. Can anyone explain how to make a `minted.layout` file which would allow me to use `\inputminted` and have the desired effect of including an external source code file? Alternatively can anyone suggest any ways to achieve the desired effect?


title: Glossaries package: smallcaps and uppercase in index does not work

text: I am using the `glossaries` package in pdfLaTeX. I am trying to   1. use the acronyms written in small caps in the body text and   2. for the index, make the first letter of each entry name in the glossary uppercase. I have already tried to look around but I could not find a solution. To obtain the glossary I run the command `makeindex` defined as following:               "/usr/texbin/makeglossaries" %      Normally, I load my entries from 2 external files but I do not think that this is the problem since I get the same issue also after running my MWE. Anyway, to show the commands I'm using I inserted them as comments in the MWE. Also, I'm not sure if this is important, but I use MinionPro as my main font and KOMA-Script. My MWE is based on this thread: http://www.latex- community.org/forum/viewtopic.php?f=5&t=9966               \documentclass{scrreprt}     \usepackage[T1]{fontenc}     \usepackage[toc=true,smallcaps,section,nonumberlist,acronym,nomain]{glossaries}     \newglossary{slg}{sym}{syb}{Nomenclature}     % \input{./text/glossary}     % \loadglsentries{./text/symbols}     \makeglossaries     \newacronym{pcm} {PCM} {phase change material}     \newglossaryentry{sym:hfus}{type=slg,sort={pl:h},                       name = {\null$\Delta H_{fus}$},                       description={latent heat of fusion}}          \begin{document}     Sample: \gls{sym:hfus}. \gls{sym:hfus}. \gls{pcm}. \gls{pcm}.              \textsc{This is small caps. PCM pcm }          \renewcommand{\glsnamefont}[1]{\makefirstuc{#1}}     \printglossary[type=slg, style=long, nonumberlist=true]          \renewcommand{\glsnamefont}[1]{\MakeUppercase{#1}}     \printglossary[type=acronym, style=long]     \end{document}      Here's the result: ![Result of MWE](http://i.stack.imgur.com/CuldV.png) The only thing that gets capitalized is Fus from the math environment and I really do not understand how this happens. Everything else (smallcaps option and uppercases of description) is just not working. Someone can please explain me what I'm doing wrong?


title: Prevent page break after first line of example

text: I would like to find a way to prevent a page break between the first line of the example in following code.               \documentclass{article}     \usepackage{lipsum}     \usepackage{gb4e}          \begin{document}          \lipsum[3-7]          Some extra text to get the page break in the right place.          \begin{exe}      \ex\label{Label} Some description of this example       \begin{xlist}        \ex[*] {        First sentence.}        \ex[] {        First sentence.}        \ex[*] {        Third sentence.}       \end{xlist}     \end{exe}     \end{document}      I don't have a problem with a page break after the first actual item (i.e. between items (a) and (b)). I just don't want the title/heading of the example to be separated from the actual items of the example. It's important that the example be formatted with the `gb4e` package (rather than a more generic list environment), as I have many examples with complex linguistic glosses that require a package dedicated to the issue. I would prefer to use this package, as I have a lot of examples already formatted for this package (as opposed to other packages for linguistic examples). I know that there are many questions on this site dealing with preventing or forcing page breaks at specific points, but I have not found an answer that works with the examples made using the `gb4e` package. I have attempted adding things like `\nopagebreak` in the example itself or `\goodbreak` before the example, but the page break remains in the same place. Finally, I was able to force the whole example to the next page by putting it in a `minipage` environment, but this has two disadvantages. First, it does not allow a break between (a) and (b) in the example when that would be fine. Second, it would require manually checking for these orphans. That is not very practical for long documents (e.g. a dissertation).


title: adjust uniformdeviate values

text: I need to insert in the rectangle all my 10 molecules in random way (angle and x,y position). I don't know what is wrong with my code. ![enter image description here](http://i.stack.imgur.com/E8X3O.jpg)               \startMPinclusions          vardef spring (expr a, b, w, h, n) =     pair vec ; path pat ; numeric len ; numeric ang ;     vec := (b-a) ;     pat := for i=1 upto n-1: (if odd(i):-fi w/2,i)--endfor (0,n) ;     pat := (0,0)--(0,h)-- pat shifted (0,h)--(0,n+h)--(0,n+2h) ;     len := (xpart vec ++ ypart vec)/(n+2h) ;     ang := -90+angle(vec) ;     ( pat yscaled len rotatedaround(origin,ang) shifted a )     enddef ;           \stopMPinclusions          \enabletrackers       [metapost.showlog]     \starttext          \starttext                         \startMPcode     tracingall;     picture molecule;     path p ; p :=(.1cm,0)--spring((.2cm,0),(2.5cm,0),.5cm,0,10)--(2.6cm,0) ;          draw p;     draw fullcircle scaled 2cm shifted(-0.9cm,0);     draw fullcircle scaled 2cm shifted(3.6cm,0);     molecule := currentpicture scaled .1;currentpicture:=nullpicture;          numeric angulo; numeric xx; numeric yy; pair par;          for i=1 step 1 until 10:     angulo:=uniformdeviate 180;     xx:=uniformdeviate 80;      yy:=uniformdeviate 50;     par:=(xx,yy);     draw molecule shifted par rotated angulo ;     endfor;          %clip currentpicture to (0,0)--(0,2cm)--(3cm,2cm)--(3cm,0)--cycle;     draw (0,0)--(0,2cm)--(3cm,2cm)--(3cm,0)--cycle withcolor 0.625red;     \stopMPcode          \stoptext


title: How to parametrize a \draw command in tikz?

text: I'm using the following command to draw a 'X' at a particular coordinate (x):               \draw [blue, line width=1mm]           (x)-- ++(-4.5pt,-4.5pt) -- ++(9.0pt,9.0pt)           ++(-9.0pt,0) -- ++(9.0pt,-9.0pt);      However, I don't really like pasting the same code at multiple places where I need the X - so, I'm looking for a way to kind of declare a subroutine which would do this, and take the coordinate as a parameter. (I tried using `\tikzset`, apparently that works with nodes - I wasn't able to get a decent example using `\draw`)


title: Interactively look up macro definitions

text: In a TeX document, the primitive command `\show` will print out the current definition of a macro one level deep (it won't (and can't?) reduce to primitives). This comes with the restriction of actually being in the document itself, having to typeset and re-typeset over and over, and sifting through log messages (which, even with a bare-bones file, isn't nothing). Is there a way to run a TeX session interactively such that I can               $ latex     > \documentclass{article}     blah blah blah          > \show\list     #1#2->\ifnum \@listdepth >5\relax \@toodeep \else \global \advance \@listdepth \@ne \fi      \rightmargin \z@ \listparindent \z@ \itemindent \z@ \csname @list\romannumeral \the      \@listdepth \endcsname \def \@itemlabel {#1}\let \makelabel \@mklab \@nmbrlistfalse      #2\relax \@trivlist \parskip \parsep \parindent \listparindent \advance \linewidth -     \rightmargin \advance \linewidth -\leftmargin \advance \@totalleftmargin \leftmargin      \parshape \@ne \@totalleftmargin \linewidth \ignorespaces .          > ...      interactively?


title: Caption on top of Figure with revTex 4.1 after update to Tex Live 2014

text: I used this kind of code to put several Figures in a Latex document               \documentclass[preprint]{revtex4-1}     \usepackage{graphicx}          \begin{document}     \begin{figure}[!h]       \begin{center}         \begin{tabular}{c}           \resizebox{0.5\linewidth}{!}{\includegraphics{image1}}           \resizebox{0.5\linewidth}{!}{\includegraphics{image2}}\\           \resizebox{0.5\linewidth}{!}{ \includegraphics{image3}}           \resizebox{0.5\linewidth}{!}{ \includegraphics{image4}}\\        \end{tabular}        \caption{Here is the caption of my figure.}        \label{fig:figure1}       \end{center}     \end{figure}     \end{document}      and I compile with `latex` and `dvipdfmx`. My images are the following http://heberg- fichiers.informatique13.com/uploads/c21bea2965.eps, http://heberg- fichiers.informatique13.com/uploads/3241c8d389.eps, http://heberg- fichiers.informatique13.com/uploads/e30b2e3f5e.eps, http://heberg- fichiers.informatique13.com/uploads/6700fd0f83.eps, It was working perfectly until I update from Tex Live 2009 to TeX Live 2014. Now some parts of the caption are on top of the Figure.


title: How to type Greek Letter inside an itemise

text: I'm trying to write an algorithm in a simple list format in latex. In the first point, I need an 'alpha' symbol followed by a subscript 'out'. This is what I did, but it doesn't seem to like it and throws several errors as well as giving strange outputs.               \begin{document}         \section{Algorithm}             \begin{footnotesize}                 \begin{itemize}[noitemsep]                     \item A maximum probability \textalpha _{out} for removal is pre-specified,                     \item Step 2...,                     \item Step 3...,                     \item Step 4...,                 \end{itemize}             \end{footnotesize}     \end{document}      Before posting this, I also tried the `{textgreek}` package described here, but that didn't seem to work either. I must be doing something wrong. Is there an easy solution to implementing a list that contains special characters? Thanks in advance.


title: How to convert an A5 document (PS or PDF) to an A4 document (PDF)?

text: I have a document with A5 pages (created from a TeX file) and want to combine pairs of A5 pages to A4 pages. That is, _without scaling_ , page 1 and 2 of the A5 document should become page 1 of the A4 document, and so on. The output has to be a PDF file. How to do this? ![enter image description here](http://i.stack.imgur.com/gjX2I.png) * * * Here is an example TeX file, say `a5pages.tex`. The PDF file is created by `pdflatex a5pages.tex` and the PS file is created by `latex a5pages.tex; dvips a5pages.dvi`.               \documentclass{article}     \usepackage[a5paper]{geometry}     \geometry{verbose,tmargin=15mm,bmargin=5mm,lmargin=9mm,rmargin=9mm}     \newenvironment{changemargin}{%       \begin{list}{}{%         \setlength{\textwidth}{\paperwidth}         \setlength{\textheight}{\paperheight}         \setlength{\topmargin}{-1.5in}\setlength{\topsep}{-0.2in}%         \setlength{\leftmargin}{-9mm}\setlength{\rightmargin}{-9mm}%         \setlength{\listparindent}{\parindent}%         \setlength{\itemindent}{\parindent}         \setlength{\parsep}{\parskip}%       }%       \centering\item[]%     }{\end{list}}          \begin{document}     This is a line of text.     \begin{changemargin}     \rule[1ex]{1\paperwidth}{2pt}          aaa\hfill bbb     \end{changemargin}          \newpage     This is a line of text.     \begin{changemargin}     \rule[1ex]{1\paperwidth}{2pt}          aaa\hfill bbb     \end{changemargin}     \end{document}      My attempts to convert the PS or PDF file to an A4 document have been   1. using Acrobat Reader: It is possible to print "Multiple pages per sheet" (Pages per sheet: "2") to a PS file, say `a4pages.ps`, but the result is shifted / wrongly cropped (e.g., the `BoundingBox` is stated as `19 36 576 833`). Changing this value by hand to `0 0 596 842` and possibly changing some other values like `DocumentPaperSizes` corrects this. The problem is that the result was _scaled down_...   2. using `psnup` of the package "psutils"               psnup -Pa5 -pa4 -nup 2 a5pages.ps a4pages.ps      The file "a4pages.ps" is on a5 paper despite the option `-pa4`. That is probably a bug as described here. Changing the BoundingBox and possibly other values corrects the problem for the PS file. Finally, for attempt 1 or 2, to get a PDF file, I followed this approach. That is, a correct PDF file is created by `ps2pdf -dDEVICEWIDTHPOINTS=596 -dDEVICEHEIGHTPOINTS=842 a4pages.ps` (where `ps2pdf` is from the package "ghostscript"). Is there a simple way than editing the BoundingBox and possibly other values?


title: tikz: table with mathmode and drawing

text: I made the following table ![enter image description here](http://i.stack.imgur.com/DCEZg.png) in `LaTex` with the following code:               \documentclass{article}          \begin{document}          \begin{table}[ph]     \protect\caption{Genotype-by-Environment Means}     \centering{}%     \begin{tabular}{l|cccccc|c}     \hline       & \multicolumn{6}{c|}{Environment} & \tabularnewline     \cline{2-7}      Genotype & $1$ & $2$ & $\ldots$ & $j$ & $\ldots$ & $e$ & Mean\tabularnewline     \hline      $1$ & $\overline{Y}_{11.}$ & $\overline{Y}_{12.}$ & $\ldots$ & $\overline{Y}_{1j.}$ & $\ldots$ & $\overline{Y}_{1e.}$ & $\overline{Y}_{1..}$\tabularnewline     $2$ & $\overline{Y}_{21.}$ & $\overline{Y}_{22.}$ & $\ldots$ & $\overline{Y}_{2j.}$ & $\ldots$ & $\overline{Y}_{2e.}$ & $\overline{Y}_{2..}$\tabularnewline     $\vdots$ & $\vdots$ & $\vdots$ & $\ddots$ & $\vdots$ & $\ddots$ & $\vdots$ & $\vdots$\tabularnewline     $i$ & $\overline{Y}_{i1.}$ & $\overline{Y}_{i2.}$ & $\ldots$ & $\overline{Y}_{ij.}$ & $\ldots$ & $\overline{Y}_{ie.}$ & $\overline{Y}_{i..}$\tabularnewline     $\vdots$ & $\vdots$ & $\vdots$ & $\ddots$ & $\vdots$ & $\ddots$ & $\vdots$ & $\vdots$\tabularnewline     $g$ & $\overline{Y}_{g1.}$ & $\overline{Y}_{g2.}$ & $\ldots$ & $\overline{Y}_{gj.}$ & $\ldots$ & $\overline{Y}_{ge.}$ & $\overline{Y}_{g..}$\tabularnewline     \hline      Mean & $\overline{Y}_{.1.}$ & $\overline{Y}_{.2.}$ & $\ldots$ & $\overline{Y}_{.j.}$ & $\ldots$ & $\overline{Y}_{.e.}$ & $\overline{Y}_{...}$\tabularnewline     \hline      \end{tabular}     \end{table}          \end{document}      Now I want to make some drawing on this table as below: ![enter image description here](http://i.stack.imgur.com/I0aDl.png) I used `tikz` for this and the code is:               \documentclass{article} % article standalone      \usepackage{tikz}     \usetikzlibrary{matrix}          \tikzset{      table/.style={       matrix of math nodes,       row sep=-\pgflinewidth,       column sep=-\pgflinewidth,       nodes={rectangle,draw=black,text width=3.3em,align=center},       text depth=0.25ex,       text height=2ex,       nodes in empty cells       }     }          \begin{document}          \begin{table}     \begin{tikzpicture}     \matrix (m) [table] {         %& K=3 & K=4 & K=5 & K=6 & K=7 & K=8 & K=9 & K=10 & K=11 & K=12\\         \hline      1  &  \overline{Y}_{11.}  &  \overline{Y}_{12.}  &  \ldots  &  \overline{Y}_{1j.}  &  \ldots  &  \overline{Y}_{1e.}  &  \overline{Y}_{1..} \\      2  &  \overline{Y}_{21.}  &  \overline{Y}_{22.}  &  \ldots  &  \overline{Y}_{2j.}  &  \ldots  &  \overline{Y}_{2e.}  &  \overline{Y}_{2..} \\      \vdots  &  \vdots  &  \vdots  &  \ddots  &  \vdots  &  \ddots  &  \vdots  &  \vdots \\      i  &  \overline{Y}_{i1.}  &  \overline{Y}_{i2.}  &  \ldots  &  \overline{Y}_{ij.}  &  \ldots  &  \overline{Y}_{ie.}  &  \overline{Y}_{i..} \\      \vdots  &  \vdots  &  \vdots  &  \ddots  &  \vdots  &  \ddots  &  \vdots  &  \vdots \\      g  &  \overline{Y}_{g1.}  &  \overline{Y}_{g2.}  &  \ldots  &  \overline{Y}_{gj.}  &  \ldots  &  \overline{Y}_{ge.}  &  \overline{Y}_{g..} \\     \textrm{Mean} &  \overline{Y}_{.1.}  &  \overline{Y}_{.2.}  &  \ldots  &  \overline{Y}_{.j.}  &  \ldots  &  \overline{Y}_{.e.}  &  \overline{Y}_{...} \\     };     \begin{scope}[shorten >= 10pt,shorten <= 10pt]     \draw[red, thick] (m-4-2.west) -- (m-4-8.east);     \end{scope}     \end{tikzpicture}     \end{table}          \end{document}      ![enter image description here](http://i.stack.imgur.com/HVVMI.png) Any help will be highly appreciated. Thanks * * * **Edited** * * * I want to use this table in `beamer`. On first frame the table without marker (red in hand made figure) and one second frame the table with marker (red in hand made figure). So what is the best approach. Thanks


title: alphabetical order in listoftheorems

text: I use the package `thmtools` to generate a List of my Definitions at the end of the Document. This works fine, but the list is orderd by chapter and not orderd by the name of the definition. Here's some code:               \documentclass{scrbook}     \usepackage{amsthm}     \usepackage{amsmath}     \usepackage{amssymb}          \usepackage{thmtools}          \declaretheoremstyle[     %spaceabove=6pt, spacebelow=6pt,     headfont=\normalfont\bfseries,     notefont=\normalfont\bfseries, notebraces={(}{)},     bodyfont=\normalfont,     postheadspace=1em,     headpunct={:},     ]{mystyle}     \declaretheorem[numberwithin=section,style=mystyle]{definition}     \renewcommand{\listtheoremname}{Definitionsverzeichnis}          \begin{document}         \begin{definition}[Foobar]             Lorem ipsum...         \end{definition}              \begin{definition}[Abar]             Lorem ipsum...         \end{definition}     \end{document}      If I compile this, I got the following List of Theorems:                1 Definition (Foobar)...............1      2 Definition (Abar).................1      But I want this:                2 Definition (Abar).................1      1 Definition (Foobar)...............1      Better this:                Abar.................1      Foobar...............1


title: Checking if first portion of an environment's content is empty

text: **Motivation** : I am working on a very personalized _Exercise/Answer_ package for my colleagues. The `exercise`, `exsheets`, etc. packages don't do what I need. To accomplish this, I create an `exercises` environment along with `\question` and `\subquestion` commands. They are used nested within one another in that order (see code below for example use). * * * **The code** : The following code compiles (I know, it's a long MWE):               \documentclass{scrartcl}          \usepackage[shortlabels]{enumitem}     \usepackage{environ}     \usepackage{etoolbox}     \usepackage{xparse}               %% New lists to use with enumerations (enumitem)     \newlist{lquestion}{enumerate}{1}     \setlist[lquestion,1]{label=\textbf{\arabic*.}, labelsep=0mm, leftmargin=0mm, nosep, parsep=0mm, align=parleft, resume=lquestion}          \newlist{lsubquestion}{enumerate}{1}     %% NOTE: itemsep and parsep must be equal     \setlist[lsubquestion, 1]{label=\textbf{\alph*)}, labelsep=.8em, leftmargin=*, nosep, topsep=0mm, itemsep=1mm, parsep=1mm, resume=lsubquestion}               %% Define new environment `exercises` and new commands `\question` and `\subquestion`     \makeatletter     \newtoggle{cgexer@bool@hasquest}     \newtoggle{cgexer@bool@hassubquest}     \toggletrue{cgexer@bool@hasquest}     \toggletrue{cgexer@bool@hassubquest}          %% Environment `exercises`     \NewDocumentEnvironment{exercises}{s O{}}       {%% Before         \global\togglefalse{cgexer@bool@hasquest}%% NO QUESTIONS YET       }%       {%% After         \iftoggle{cgexer@bool@hasquest}%           {%% THE EXERCISE BLOCK CONTAINS QUESTIONS...               \end{lquestion}           }{}%       }          %% Used within command `\question` to check whether text is provided before the first `\subquestion`     \newtoggle{cgexer@bool@hasgeneralquest}     \NewEnviron{preparegeneralquest}{%       %% Was text specified within `\question{...}`, before the first `\subquestion`?       \ifdefempty{\BODY}{}{\global\toggletrue{cgexer@bool@hasgeneralquest}}       \BODY%% Show the specified text     }          %% Command `\question`     \NewDocumentCommand{\question}{s O{} +g +g}{%       \global\togglefalse{cgexer@bool@hasgeneralquest}%% NO TEXT (GENERAL QUESTION) SPECIFIED BEFORE FIRST `\subquestion` YET       \global\togglefalse{cgexer@bool@hassubquest}%% NO `\subquestion`s YET       \nottoggle{cgexer@bool@hasquest}%         {%% FIRST QUESTION...             \begin{lquestion}[start=1]             \global\toggletrue{cgexer@bool@hasquest}%% THE EXERCISE BLOCK NOW CONTAINS 1+ QUESTION(S)         }{}%       %       \vspace{12pt plus 2.0pt minus 1.5pt}       \item START%% ***REPLACE WITH: \item \begin{preparegeneralquest}%           #3%% Show the content of the question (including all `\subquestion`s)       %       \iftoggle{cgexer@bool@hassubquest}%         {%% THE QUESTION CONTAINS SUB-QUESTIONS...             \end{lsubquestion}         }%         {%% THE QUESTION DOES NOT CONTAIN SUB-QUESTIONS...             STOP%% ***REPLACE WITH: \end{preparegeneralquest}%% To close \begin{preparegeneralquest}         }%     }          %% Command `\subquestion`     \NewDocumentCommand{\subquestion}{s O{} +g +g}{%       \nottoggle{cgexer@bool@hassubquest}%         {%% FIRST SUB-QUESTION...             STOP%% ***REPLACE WITH: \end{preparegeneralquest}%% To close \begin{preparegeneralquest}             \begin{lsubquestion}[start=1]             \global\toggletrue{cgexer@bool@hassubquest}%% THE QUESTION NOW CONTAINS 1+ SUB-QUESTION(S)         }{}%       %       \item #3%     }     \makeatother                    \begin{document}          \begin{exercises}       \question{Question 1           \subquestion{Sub-question A}           \subquestion{Sub-question B}{Sub-answer B}           \subquestion{Sub-question C}{Sub-answer C}           \subquestion{Sub-question D}           \subquestion{Sub-question E}{Sub-answer E}       }{Answer 1}            \question{Question 2}            \question{Question 3}{Answer 3}            \question{Question 4           \subquestion{Sub-question A}{Sub-answer A}           \subquestion{Sub-question B}           \subquestion{Sub-question C}           \subquestion{Sub-question D}{Sub-answer D}           \subquestion{Sub-question E}       }{Answer 4}            \question{           \subquestion{Sub-question A}{Sub-answer A}           \subquestion{Sub-question B}           \subquestion{Sub-question C}           \subquestion{Sub-question D}{Sub-answer D}           \subquestion{Sub-question E}       }{Answer 4}     \end{exercises}               \vspace{2\baselineskip}          \makeatletter     Testing the \verb|preparegeneralquest| environment:          \textbf{Test 1}:          \togglefalse{cgexer@bool@hasgeneralquest}     \begin{preparegeneralquest}       This one contains text.     \end{preparegeneralquest}     (\textbf{\iftoggle{cgexer@bool@hasgeneralquest}{Text was provided}{No text provided.}})          \textbf{Test 2}:          \togglefalse{cgexer@bool@hasgeneralquest}     \begin{preparegeneralquest}     \end{preparegeneralquest}     (\textbf{\iftoggle{cgexer@bool@hasgeneralquest}{Text was provided}{No text provided.}})     \makeatother          \end{document}      * * * **Output** : The generated output is... ![Output for the above code sample](http://i.stack.imgur.com/Ypc9k.png) * * * **The issue** : For layout reasons, I have to identify whether or not some text has been specified within `\question{...}` before the first `\subquestion` is encountered (if any). To accomplish this, I've tried to use the `environ` package along with the `\NewEnviron` and `\BODY` commands to gather the text and check (with a new environment called `preparegeneralquest`) whether it is empty or not using `\ifdefempty` (I have tried using the `ifmtarg` package, but it fails in this context and I don't know why; possibly due to expansion?). Now since the `\subquestion` commands are nested within the `\question` command, I've attempted to do this by _forcing the insertion of_ `\begin{preparegeneralquest}` and `\end{preparegeneralquest}` at the appropriate places in the structure. This is accomplished by changing the three lines identified with `*** REPLACE WITH:` in the code provided above, i.e. by changing               \item START      for               \item \begin{preparegeneralquest}%      and (twice, because it appears at two different places)               STOP      for               \end{preparegeneralquest}      However, after doing this, the document fails to compile and gives the error messages:               \begin{preparegeneralquest} on input line 92 ended by \end{exercises}     [...]     ! Undefined control sequence.     \env@preparegeneralquestion@parse ...name #1\env@nil                                                          \csname env@preparegeneral...      and so on. * * * **Question** : What am I doing wrong and is there a good way to trace what's happening (e.g. through a .tmp file)? Using the above version of the code, the `START` and `STOP` text is typeset at the appropriate place, but I understand it could be a nesting issue when this text is changed for an environment. Nota:   * I wouldn't mind using a command `\preparegeneralquest` instead of an environment, but then I get bracketing issues that I don't seem to be able to solve using `\begingroup` and `\endgroup` (or the much scarier `\bgroup` and `egroup` for that matter).   * If you are wondering why I'm creating new commands `\question` and `\subquestion` instead of simply defining them as lists with `enumitem`, it's because they will have various arguments, including a list of key-based options using `pgfkeys`.


title: table rescaling and subcaption package

text: I am placing tables side-by-side using the `subcaption` package in the following way:               \documentclass{article}          \usepackage{siunitx}     \usepackage{booktabs}     \usepackage{subcaption}     \usepackage{tabularx}          \begin{document}          \begin{table}         \centering         \begin{subtable}[b]{0.48\textwidth}             \large             \resizebox{\textwidth}{!}             {%                 \sisetup{detect-weight=true,detect-inline-weight=math}                 \begin{tabular}{rS[table-format=1.2(2)]S[table-format=1.2(2)]S[table-format=2.2(2)]S[table-format=2.2(2)]}                     \toprule                       & {25\%} & {50\%} & {75\%} & {95\%}\\                     \midrule                     A & 0.09(83) & 0.26(83) & 0.38(83) &  0.96  \\                     B & 0.10(1)  & 0.16(1)  & 0.22(2)  &  0.41(8)\\                     C & 0.08(1)  & 0.12(1)  & 0.19(3)  &  0.52(23)\\                     \bottomrule                 \end{tabular}%             }             \caption{}         \end{subtable}%         \hspace{0.02\textwidth}%         \begin{subtable}[b]{0.48\textwidth}             \large             \resizebox{\textwidth}{!}             {%                 \sisetup{detect-weight=true,detect-inline-weight=math}                 \begin{tabular}{rS[table-format=1.2(2)]S[table-format=1.2(2)]S[table-format=2.2(2)]S[table-format=2.2(2)]}                     \toprule                       & {25\%} & {50\%} & {75\%} & {95\%}\\                     \midrule                     A & 0.09(83) & 0.26(83) & 0.38(83) &  0.96  \\                     B & 0.10(1)  & 0.16(1)  & 0.22(2)  &  0.41(8)\\                     C & 0.08(1)  & 0.12(1)  & 0.19(3)  &  0.52(23)\\                     \bottomrule                 \end{tabular}%             }%             \caption{}         \end{subtable}     \end{table}               \end{document}      In a related post, one of the comments was that using `\resizebox{1\textwidth}{!}` was bad style, since it leads to inconsistent font sizes. The suggestion was to use the `tabularx` package instead. Thus I left out the `resizebox` command and replaced the calls to `\begin{tabular}{...}` with `\begin{tabularx}{\textwidth}{...}`. However, now the tables are no longer rescaled to match the `0.48\textwidth` of the subtable. What am I missing? It's strange, since using `\textwidth` in the `resizebox` command correctly picks up on the size of the subtable. EDIT: I should have noted that in actual fact my table is bigger, but with the same number of columns. Incorporating mico's answer, I get overfull hbox errors. The problem is I can't make the page much wider due to the need for a large inner margin. This is where the resizebox command came in handy, although it isn't the right way to go. Here is an edited example:               \documentclass{article}          \usepackage{siunitx,booktabs,subcaption}     %\usepackage[margin=1in]{geometry} % choose margins here          \begin{document}     \sisetup{detect-weight=true,detect-inline-weight=math}     \begin{table}         \centering          \begin{subtable}[b]{0.48\textwidth}             \begin{tabular*}{\linewidth}{@{}l@{\extracolsep{\fill}}                                          S[table-format=1.2(2)]                                          S[table-format=1.2(2)]                                          S[table-format=2.2(2)]                                          S[table-format=2.2(2)]@{}}                 \toprule                 &  \multicolumn{4}{c}{Error Quantiles}\\                 \cmidrule(lr){2-5}                 &  {25\%} & {50\%} & {75\%} & {95\%}\\                 \midrule                        A  & 0.17(1) & 0.25(3) & 0.33(2) & 0.43(2)\\                        B  & 0.09(1) & 0.12(1) & 0.17(2) & 0.26(5)\\                        C  & 0.07(1) & 0.09(1) & 0.11(1) & 0.16(1)\\                   \\                        A & 0.17(83) & 0.26(83) & 0.38(83) &  0.96 \\ % 1e7                        B & 0.10(1)  & 0.16(1)  & 0.22(2)  &  0.41(8)\\                        C & 0.08(1)  & 0.12(1)  & 0.19(3)  &  0.52(23)\\                   \\                        A & 0.37(6) & 0.73(15) & 1.66(63) & {201}\\ % 1e5                        B & 0.07(1) & 0.09(1)  & 0.15(2)  &  15.50(33)\\                        C & 0.06(0) & 0.09(1)  & 0.12(1)  &   0.20(2)\\                 \bottomrule             \end{tabular*}%             \caption{}          \end{subtable}%          \hspace*{\fill}%          \begin{subtable}[b]{0.48\textwidth}             \begin{tabular*}{\linewidth}{@{}l@{\extracolsep{\fill}}                                          S[table-format=1.2(2)]                                          S[table-format=1.2(2)]                                          S[table-format=2.2(2)]                                          S[table-format=2.2(2)]@{}}                 \toprule                 &  \multicolumn{4}{c}{Error Quantiles}\\                 \cmidrule(lr){2-5}                 &  {25\%} & {50\%} & {75\%} & {95\%}\\                 \midrule                        A  & 0.17(1) & 0.25(3) & 0.33(2) & 0.43(2)\\                        B  & 0.09(1) & 0.12(1) & 0.17(2) & 0.26(5)\\                        C  & 0.07(1) & 0.09(1) & 0.11(1) & 0.16(1)\\                   \\                        A & 0.17(83) & 0.26(83) & 0.38(83) &  0.96 \\ % 1e7                        B & 0.10(1)  & 0.16(1)  & 0.22(2)  &  0.41(8)\\                        C & 0.08(1)  & 0.12(1)  & 0.19(3)  &  0.52(23)\\                   \\                        A & 0.37(6) & 0.73(15) & 1.66(63) & {201}\\ % 1e5                        B & 0.07(1) & 0.09(1)  & 0.15(2)  &  15.50(33)\\                        C & 0.06(0) & 0.09(1)  & 0.12(1)  &   0.20(2)\\                 \bottomrule             \end{tabular*}%             \caption{}          \end{subtable}     \end{table}      ![enter image description here](http://i.stack.imgur.com/W4fbK.png)


title: How to stop LaTeX from forcing single line paragraphs on two lines

text: I have a document containing some short paragraphs which would fit on a single line using normal spacing. When typesetting those paragraphs LaTex apparently tries hard to stretch those lines (the words) far enough to make it a two-line paragraph. That produces some very ugly paragraphs. LaTex even hyphenates the last word of the paragraph to get only the shortest possible part of it on the second line. I tried adjusting the word stretching by lowering the setting for `\fontdimen3\font` to `0.2pt` but this does not feel right. Is it possible to tell LaTeX not to stretch paragraphs on at least 2 lines? ## Edit: I found the cause deep down in our templates:               \tolerance 1414     \emergencystretch 1.5em      Here's a minimal working example:               \documentclass[parskip=half*]{scrartcl}     \tolerance 1414     \emergencystretch 1.5em     \begin{document}        This is a sentence that would usually fit on one line with normal spacing.     \end{document}      Removing one of both lines fixes the spacing of one line paragraphs. I am not yet familiar with what those commands do exactly, but I assume they had been added because some of the generated code produced overfull text lines. Still, I don't understand why - with these settings - LaTeX tries to produce an extra line in the paragraph. From what I understand, `\tolerance` and `\emergencystretch` are supposed to jump in when formatting within the default rules is not possible. Where am I wrong? ## Edit2 The `parskip=half*` setting for the `srcartcl` document class appears to play a role in this game, also.


title: "Isodat" language source code syntax highlighting

text: Isodat language is used for Mass-spectrometers from ThermoFisher Scientific®, which is used for Stable Isotope Mass-spectrometry. Parts of the language's syntax highlighting has been explored in listings package: formating all numbers in language definition? and the follow-up question listing package: colored numbers, but not colored in variable names. In the end it should look like the image below: ![Example of Isodat source code.](http://i.stack.imgur.com/Tf5UV.png) I get the following: ![.png of .pdf from .tex.](http://i.stack.imgur.com/Bnbsk.jpg) Do you know what needs to be changed here? The problems are:   1. numbers within comment,   2. numbers within string,   So far the following have been fixed:   3. keywords in blue (if, else, string, number),   4. parenthesis following keywords in black,   5. block comments,   6. keywords in lightblue.   7. strings in blue               \documentclass[fleqn, a4paper, landscape]{article}     \usepackage{xcolor}          \definecolor{isored}{rgb}{0.6,0,0} % for strings     \definecolor{isogreen}{rgb}{0.25,0.6,0.2} % comments     \definecolor{isoblue}{rgb}{0.0,0.0,1} % keyword     \definecolor{isolightblue}{rgb}{0.5,0.5,1.0} % keywords     \definecolor{isocomgreen}{rgb}{0.25,0.35,0.75} % javadoc          \usepackage{etoolbox}          \newtoggle{InString}{}% Keep track of if we are within a string     \togglefalse{InString}% Assume not initally in string     % http://tex.stackexchange.com/questions/34896/coloring-digits-with-the-listings-package?rq=1     \newcommand*{\ColorIfNotInString}[1]{\iftoggle{InString}{#1}{\textcolor{isored}#1}}%     \newcommand*{\ProcessQuote}[1]{#1\iftoggle{InString}{\global\togglefalse{InString}}{\global\toggletrue{InString}}}%          \usepackage{listings}           \lstdefinelanguage{isodat}     {%       basicstyle=\ttfamily,%       literate=%          %{"}{{{\ProcessQuote{"}}}}1% Disable coloring within double quotes          {0}{{\ColorIfNotInString{0}}}{1}%          {1}{{\ColorIfNotInString{1}}}{1}%          {2}{{\ColorIfNotInString{2}}}{1}%          {3}{{\ColorIfNotInString{3}}}{1}%          {4}{{\ColorIfNotInString{4}}}{1}%          {5}{{\ColorIfNotInString{5}}}{1}%          {6}{{\ColorIfNotInString{6}}}{1}%          {7}{{\ColorIfNotInString{7}}}{1}%          {8}{{\ColorIfNotInString{8}}}{1}%          {9}{{\ColorIfNotInString{9}}}{1}%          {.0}{{\ColorIfNotInString{.0}}}{1}% Following is to ensure that only periods          {.1}{{\ColorIfNotInString{.1}}}{1}% followed by a digit are changed.          {.2}{{\ColorIfNotInString{.2}}}{1}%          {.3}{{\ColorIfNotInString{.3}}}{1}%          {.4}{{\ColorIfNotInString{.4}}}{1}%          {.5}{{\ColorIfNotInString{.5}}}{1}%          {.6}{{\ColorIfNotInString{.6}}}{1}%          {.7}{{\ColorIfNotInString{.7}}}{1}%          {.8}{{\ColorIfNotInString{.8}}}{1}%          {.9}{{\ColorIfNotInString{.9}}}{1}%          {\ }{{ }}{1}% handle the space          ,          %string=[s]{_}{=},          %string=[s]{_}{(},        mathescape=true,        emphstyle={[2]\color{isoblue}},       tabsize=4,       captionpos=b,       showstringspaces=false,       keywordstyle=\color{isoblue},       keywordstyle=[2]\color{isoblue},       commentstyle=\color{isogreen},%       stringstyle=\color{isolightblue},%       morestring=[s][\color{isoblue}]{"}{"},%       morecomment = [l]{//},       morecomment = [l]{///},       morecomment = [s]{/*}{*/},       sensitive = true,       morekeywords = {if, else, string, number},%You need to add here       emph={_Set, _Delay, _strstr, _strtod, _strmid},% You need to add here       emphstyle=\color{isolightblue},     }          \begin{document}         \begin{lstlisting}[caption=Isodat language sample..,language=isodat]                  _Set("Precon/Trap 3",0);             _Delay(1000,1,"Evacuating Carbon trap")             //_Set("ExtValveBlock/Valve 4",1); commented because interferes with extraction                  string SeqPrepText="";             number AnzFull=1;                  SeqPrepText =_GetSequenceText("Preparation","1,0");             //_MessageBox(SeqPrepText,MB_OK,MB_ICONEXCLAMATION);                          Midpoint    = _strstr (SeqPrepText,",");             if (Midpoint==-1)              {             /* Format stimmt nicht falsches oder kein Trennzeichen                no error haldling so far                cut to 1 and zero by default */             }             else             {               AnzHalf = _strtod(_strmid(SeqPrepText,(Midpoint+1),(StrLaenge-Midpoint-1)));             }         \end{lstlisting}     \end{document}


title: Chemistry arrows in restricted latex

text: I'm writing some software that interfaces with a LaTeX renderer. I need to write chemical reactions and equilibria, but I don't have access to `xrightleftharpoons`, is there a way I can render the same thing inline without loading a package? I do have access to some package stuff: `amssymb`, `amsmath`, `bm`, `color`, `[latin1]inputenc`, `flexisym`, `breqn`.


title: Adding the string "part" before the entries in the TOC

text: I want to add the word "Part" before my entries in the toc. I read here that I could use \renewcommand\cftpartpresnum{Part~}. I have tried adding making some modifications to the partpresnum and partleader command but it did not work. I am using the classicthesis style, which defines the toc like this for parts: (The full style file can be seen here)                   \ifthenelse{\boolean{@parts}}%         {%           \renewcommand{\thepart}{\roman{part}}%           \renewcommand{\cftpartpresnum}{\scshape}%  \MakeTextLowercase     %      \renewcommand{\cftpartaftersnum}{\cftchapaftersnum}%     %      \renewcommand{\cftpartaftersnumb}{\quad}%     %      \setlength{\cftpartnumwidth}{\cftpartnumwidth}           \renewcommand{\cftpartfont}{\color{Maroon}\normalfont}%           \renewcommand{\cftpartpagefont}{\normalfont}%           \ifthenelse{\boolean{@dottedtoc}}{\relax}%           {%             \renewcommand{\cftpartleader}{\hspace{1.5em}}%              \renewcommand{\cftpartafterpnum}{\cftparfillskip}%           }%                   \setlength{\cftbeforepartskip}{1em}%           \setlength{\cftbeforechapskip}{.1em}%           \setlength{\beforebibskip}{\cftbeforepartskip}%          }{\relax}         % chapters         \ifthenelse{\boolean{@nochapters}}%             {\relax}%             {%                 \renewcommand{\cftchappresnum}{\scshape\MakeTextLowercase}%                 \renewcommand{\cftchapfont}{\normalfont}%                 \renewcommand{\cftchappagefont}{\normalfont}%                 \ifthenelse{\boolean{@dottedtoc}}{\relax}%                     {%                     \renewcommand{\cftchapleader}{\hspace{1.5em}}%                      \renewcommand{\cftchapafterpnum}{\cftparfillskip}%                  }                 %\setlength{\cftbeforechapskip}{.1em}%                        }      ... see style file for full code. Any suggestions? Am I trying to make changes in the right place even? The following is a reduced example. I tried using only a portion of the style file, but I couldn't get that working.               \documentclass[parskip=half,10pt,twoside]{scrbook}     \usepackage{classicthesis}               \begin{document}          \tableofcontents     \part{First test part}     \chapter{Test chapter}     \chapter{Test chapter}     \part{Second  test part}     \chapter{Test chapter}     \chapter{Test chapter}          \end{document}


title: Listing within tcolorbox: how to adjust width to the natural listing width?

text: I would like to create a `tcolorbox` whose width is computed based on the longest line I have in listed code. I know it is possible to adjust the width with respect to the title. Is it also possible to adjust it based on the content?               \PassOptionsToPackage {usenames,dvipsnames}{xcolor}     \documentclass{standalone}          \usepackage{tcolorbox}     \tcbuselibrary{listings}     \usepackage{tikz}          \begin{document}     \begin{tcblisting}{           arc=7pt,           outer arc=7pt,           top=1mm,           bottom=1mm,           left=1mm,           right=1mm,           boxrule=0.6pt,           colback=yellow!5,           colframe=yellow!50!black,           fonttitle=\bfseries,           listing only,     }         int main(int ac, char *av[], char **ep) {           printf("Hello, World\n");           return 0;         }     \end{tcblisting}     \end{document}      ![enter image description here](http://i.stack.imgur.com/9TzDU.jpg)


title: How to use A4 instead of letterpaper?

text: I am working with a template which uses letterpage. Yet I need it to be A4.               \documentclass[10pt,letterpaper]{article}     \usepackage[letterpaper,margin=0.75in]{geometry}     \usepackage[utf8]{inputenc}     \usepackage{mdwlist}     \usepackage[T1]{fontenc}     \usepackage{textcomp}     \usepackage{tgpagella}     \pagestyle{empty}     \setlength{\tabcolsep}{0em}      How do I change it?


title: Remove extra space from framed environment

text: I would like to remove or better said have the framed environment (box) aligned with the content in the description. Notice below how the box is out of alignment and aligns with the margin. See a MWE: ![enter image description here](http://i.stack.imgur.com/rkLLk.png)               \documentclass[letterpaper]{article}     \usepackage{framed}     \usepackage{enumitem}     \usepackage{lipsum}     \begin{document}     \lipsum[1-2]         \begin{description}         \item[Test] \lipsum[1]         \begin{framed}             \textbf{Understanding the Problem}         \begin{enumerate}             \item[0:] Complete misunderstanding of the problem             \item[5:] Part of the problem misunderstood or misinterpreted             \item[10:] Complete understanding of the problem         \end{enumerate}         \end{framed}         \end{description}     \lipsum[1]     \end{document}


title: Package arev and sansmath

text: I would like to use the package `sansmath` and be able at the time to define a new symbol `\varheart`. To define the latter, following this answer, I use the code               \DeclareSymbolFont{extraup}{U}{zavm}{m}{n}     \DeclareMathSymbol{\varheart}{\mathalpha}{extraup}{86}      Unfortunately, as seen in the following minimal example, it does not work.               \documentclass{article}          \usepackage{sansmath}          \DeclareSymbolFont{extraup}{U}{zavm}{m}{n}     \DeclareMathSymbol{\varheart}{\mathalpha}{extraup}{86}          \begin{document}          \sansmath{Is the following a filled heart? $\varheart$}          \end{document}      ![enter image description here](http://i.stack.imgur.com/IbuiV.png) **Is there a way to solve this issue?**


title: Scaling a multi-column TikZ/pgfplots groupplot to page width

text: I am trying to scale a pgfplots groupplot with multiple (and variable numbers of) subplots to match the `\textwidth` of a document. What I found is that there seems to be no direct relationship between the `width` parameter in the `groupplot` definition, so a simple formula such as `1/<n-plots>*(\textwidth-<padding>)` is producing very different results with different plots. Moreover, I would expect a function such as `1/<n-plots>*\textwidth` to at worst exceed page width because of paddings not taken into account, but it turns out that the result is smaller than the page width and tends to shrink with more plots, suggesting some kind of negative padding. How is the width of a `groupplot` calculated, and how can it be scaled to a fixed width regardless of column number? (I'm not interested in solutions that simply rescale the entire image.) Example plot below: ![](http://i.imgur.com/eOq94bW.png)               \begin{tikzpicture}         \begin{groupplot}[             group style={                 group size=5 by 1,                 vertical sep=0pt,                 ylabels at=edge left,                 xlabels at=edge bottom,                 yticklabels at=edge left,                 horizontal sep=0pt,             },             extra y ticks={20},             extra y tick style={grid=major},             width=1/5*\textwidth,             height=5cm,             ylabel=coverage,             tickpos=left,             xtick=\empty,             ytick align=inside,             xtick align=inside,             ymin=0,             ymax=110,             xmin=0,             xmax=2         ]         \nextgroupplot[xlabel=1]         \addplot [blue!80!black, fill=blue, fill opacity=0.2] coordinates {(0,1)(1,45)(2,34)}             |- (axis cs:0,0) -- cycle;         \nextgroupplot[xlabel=2]         \addplot [blue!80!black, fill=blue, fill opacity=0.2] coordinates {(0,1)(1,45)(2,34)}             |- (axis cs:0,0) -- cycle;         \nextgroupplot[xlabel=3]         \addplot [blue!80!black, fill=blue, fill opacity=0.2] coordinates {(0,1)(1,67)(2,14)}             |- (axis cs:0,0) -- cycle;         \nextgroupplot[xlabel=4]         \addplot [blue!80!black, fill=blue, fill opacity=0.2] coordinates {(0,12)(1,105)(2,34)}             |- (axis cs:0,0) -- cycle;         \nextgroupplot[xlabel=5]         \addplot [blue!80!black, fill=blue, fill opacity=0.2] coordinates {(0,1)(1,45)(2,34)}             |- (axis cs:0,0) -- cycle;         \end{groupplot}     \end{tikzpicture}


title: How to make a caption visible in a newly defined lstenvironment?

text: I have a new `lstenvironment` defined like this:               \lstnewenvironment{xml}     {\lstset{language=xml, basicstyle=\ttfamily, frame=single, captionpos=b}}     {}      Then I want to apply it in my code:               \begin{xml}[label=base,caption=A configuration XML file.]     <?xml version="1.0" encoding="UTF-8" ?>     <config>         <connecting>             <url>something</url>             <user>username</user>             <password>password</password>         </connecting>     </config>     \end{xml}       In the output, I would expect caption printed at the bottom of the listing, however, it is not. Some suggestions? Do I need to include something more within `\lstset`?


title: Plotting the frequency bandwidth

text: I do not have almost any experience with `pgfplot` and I am having some problems with something which seemed really easy. What I want to do is filling the area between a function and two vertical lines identified by the intersection of a horizontal line with the function. I found the intersections and I could draw correctly the vertical lines but I cannot understand how to fill the area Following there is the code I managed to produce so far.               \documentclass{article}     \usepackage{tikz}     \usepackage{pgfplots}     \usetikzlibrary{calc,intersections}                                   \begin{document}          \begin{figure}     \centering     \begin{tikzpicture}     \begin{axis}[scale=1]     \addplot+[name path global=GraphCurve, domain=0.5:1.5, samples=400, color=black, mark=none]{0.09*x^2/sqrt((1-x^2)^2+(0.09*x)^2)};          \addplot+[name path global=HorizontalLine, domain=0.5:1.5,mark=none, opacity=0]{0.5};          \path[dashed,name intersections={of=GraphCurve and HorizontalLine,name=i}] (i-2)%           \pgfextra{\pgfgetlastxy{\macrox}{\macroy}%              \global\let\macrox\macrox};              \def \xinta {\macrox}      \draw[name path global=vert1, dashed](i-2) -- (\xinta,0);              \path (i-1)              \pgfextra{\pgfgetlastxy{\macrox}{\macroy}%              \global\let\macrox\macrox};                   \def \xintb {\macrox}           \draw[name path global=vert2,dashed](i-1) -- (\xintb,0);     \coordinate [label=left:$A$](A) at (i-1);     \coordinate [label=right:$B$](B) at (i-2);               \end{axis}     \end{tikzpicture}     \caption{This picture has been created with Pgfplots}     \end{figure}          \end{document}      Can anybody help with this?


title: Creating title page in revtex with twocolumn layout

text: I'm trying to create a separate title page for a report in revtex. This works fine if I have single column layout however I want the report to be in two column format. When I have this even including the `titlepage` option does not create a separate page, nor do `\clearpage` or `\pagebreak` after `\maketitle`. I create the class with               \documentclass[titlepage,aps,prd,twocolumn,groupedaddress,floatfix]{revtex4-1}     \begin{document}     \title{Twocolumnpage}     \author{Mithra}     \date{\today}          \begin{abstract}     This is an abstract     \end{abstract}          \maketitle          Body which should be on next page          \end{document}


title: Put chapter title in the middle of a page (vertically)

text: I'm using `fncychap` package to customize my chapters' titles. I want to put the chapter title in the center of a separate page (vertically).               \documentclass{report}     \usepackage[Bjornstrup]{fncychap}     \begin{document}     \chapter{Bjornstrup}%how to put it in the center of the page     \newpage     somecontent....     \end{document}


title: Extra space between columns (fixed/predefined width and X) in tabularx

text: This is a follow-up question of: What is the right way to set predetermined column widths with tabularx? As seen in the code below,               \begin{landscape}     \renewcommand*{\arraystretch}{2}     \begin{table}\tiny     \centering     \caption{Summary of Elders' Fall Assessment Articles tabularx}     \label{tab:FallRiskAssessmentArticles}          \newcolumntype{Y}{>{\raggedright\arraybackslash}X}     \begin{tabularx}{\linewidth}{>{\raggedright}p{15mm}>{\centering}p{13mm}>{\centering}p{10mm}<{\centering\arraybackslash}XYYYYYY}          \toprule          \textbf{Author} & \textbf{Sensor} & \textbf{Placement} & \textbf{Subject \newline count (M:F)} & \textbf{Movement} & \textbf{Signal Processing} & \textbf{Advantages} & \textbf{Dis\-ad\-van\-tages} & \textbf{Outcome} & \textbf{Reference Measure} \\          \midrule          \noindent\citet{najafi_measurement_2002}&     Gyroscope&     Chest&     11 (5:6)&     STS transitions&      Wavelet transform&      Uses normal postural transition.  Can be used during ADL&     Gyroscope must be worn on chest&      Extracted parameters show significant differences between high/low risk groups&     Fall risk using Tinetti tests, cognitive and vision tests, plus history of falls\\          \bottomrule          \end{tabularx}          \end{table}          \end{landscape}      I get the following output: ![enter image description here](http://i.stack.imgur.com/gvbpP.png) Where you can see there is a big space between column 4 and 5. Why if I'm using predefined widths I get this result? How do I fix it? **UPDATE** David Carlisle suggested to use `tabulary` package, but it seems there is a compatibility issue with `arydshln`, which is one of the packages I'm loading.


title: Missing Font in Apache

text: I have a tex file that compiles from the command line when I run pdflatex. However, when I run the same command from PHP/Apache, I get a fatal error. I also get a file called "missfonts.log" produced, which contains the following:               mktexpk --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 ecsi0800      In my output log, these are the last two lines:               !pdfTeX error: pdflatex (file ecsi0800): Font ecsi0800 at 600 not found     ==> Fatal error occurred, no output PDF file produced!      I don't know what `ecsi0800` refers to - it's not in my tex file anywhere. I've tried various permutations of updmap and updmap-sys, with no change. I can see a whole load of map files in my texmf-var directory, but no idea what to do with them to make them available to the builder. I'm not sure if this is a server config issue or a pdflatex issue. Is it possible to tell pdflatex to use fonts from a specific location? **Edit** : Another question led me to the command `kpsewhich pdftex.map`, with the output:               $HOME/.texmf-var/fonts/map/pdftex/updmap/pdftex.map      So, I created a folder called $HOME with a soft link from .texmf-var to the .texmf-var folder in my home folder, and the thing works! This isn't a great solution, and I'm sure there's a better way, so please do help if you can!


title: Biblatex does not reverse the first and last names of the second author

text: I have the following `.bib` file:               @Book{sample-book,         author="First1 Last1 and First2 Last2",         title="A sample book",         publisher="Public Domain Books",     }      Then I use `lualatex` `biber` `lualatex` `lualatex` to generate the pdf file. However, the generated entry would look like this: > Last1, First1 and First2 Last2, A sample book, Public Domain Books My `biblatex` package settings:               \usepackage[         bibstyle=mla,         style=authortitle,         %style=authortitle-tcomp,         %firstinits=true,         %backref=true,         natbib=true,         backend=biber     ]{biblatex}


title: Problem in the postion of the Part in in the TOC

text: Hello I've used the solution I've found here: Remove part page To suppress the part page. It works, but with a hitch. My structure is               part 1       chapter 1       chapter 2     part 2       chapter 3       chapter 4      But in the TOC it appears as:                 chapter 1     part 1       chapter 2       chapter 3     part 2       chapter 4      Can any one provide any insight as what could be the problem? PD: The page numbers appear correctly!


title: abbrvnat without natbib package

text: I need to use the `abbrvnat` style for citation without including the `natbib` package because there is incompatibility between this package and a journal class I'm using. The problem is that when I have multiple authors, I want the citation to appear as: > (Jones et al., 1990) However, it is appearing as > (Jones et al., (1990)Jones, Baker, and Williams) I want to remove the list of authors that appears after the year and i can't use the `\citep` because it needs the `natbib` package. Note: I'm using the following class which is used by the Natural Language Engineering Journal. The following is the bibliography part in the class.               %  ****************************************     %  *           BIBLIOGRAPHY               *     %  ****************************************          \renewcommand\@biblabel[1]{#1}     \newenvironment{thebibliography}[1]{%         \section*{References}%         \addcontentsline{toc}{section}{References}         \list{}{\labelwidth\z@ \leftmargin 1em \itemindent -1em}         \small \parindent\z@         \parskip\z@ \@plus .1\p@\relax         \def\newblock{\hskip .11em \@plus .33em \@minus .07em}         \sloppy\clubpenalty\z@ \widowpenalty\@M         \sfcode`\.\@m\relax}         {\endlist}          \newif\if@altcite     \def\@cite#1#2{\if@altcite #2\else (#1)\fi\global\@altcitefalse}     \def\@biblabel#1{}          \newlength{\bibhang}     \setlength{\bibhang}{2em}          \def\bibtitle{References}     \def\bibheadtitle{REFERENCES}          \def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi       \def\@citea{}\@cite{\@for\@citeb:=#2\do         {\@citea\def\@citea{; }\@ifundefined            {b@\@citeb}{{\bf ?}\@warning            {Citation `\@citeb' on page \thepage \space undefined}}%     {\csname b@\@citeb\endcsname}}}{#1}}          \def\cite{\@ifnextchar [{\@tempswatrue\global\@altcitetrue\@citex}       {\@tempswafalse\global\@altcitefalse\@citex[]}%     }          \let\@internalcite\cite     \def\cite{\def\citename##1{##1}\@internalcite}     \def\shortcite{\def\citename##1{}\@internalcite}      Any suggestions?


title: Aligning in- and out-text for algorithms

text: I use the `algorithm2e` package to typeset algorithms with custom keywords for input and output. When using `\SetKwInput{KwInput}{Input}` to define the keywords, colons are added but input and output are not aligned. ![enter image description here](http://i.stack.imgur.com/h2aJk.png) When using `\SetKwInOut{KwInput}{Input}` the text is aligned. However, the colon is at the right, so there will be ugly space like "Input :" that creates eye cancer. ![enter image description here](http://i.stack.imgur.com/ARlBq.png) **My question is** : How can I get the output (shown in the image below) without fiddling with `\hspace` in every `algorithm` environment? ![The result I would like to achieve.](http://i.stack.imgur.com/Dl7wC.png) Here is a MWE:               \documentclass[a4paper]{article}     \usepackage[ruled]{algorithm2e}          % Define keywords     \SetKwInput{KwInput}{Input}     \SetKwInput{KwOutput}{Output}          % This aligns the colons     %\SetKwInOut{KwInput}{Input}     %\SetKwInOut{KwOutput}{Output}          \begin{document}              \begin{algorithm}[h]             \KwInput{Network}                  \KwOutput{Flow}                  \begin{enumerate}                 \item Start with $\ldots$             \end{enumerate}             \caption{Some algorithm.}         \end{algorithm}     \end{document}


title: How can I prevent page break between lines of a paragraph or bibliography entry?

text: My university's thesis guidelines require that each bibliographic entry appear in whole on a single page, rather than being split across two. How can I prevent (La)TeX breaking a paragraph across a page boundary?


title: Problems with TexStudio 2.7 spell checker

text: I'm working with TexStudio 2.7, and trying to get the spell checker to work. I've tried downloading a new dictionary (as in here), as well as modifying the .aff file (as suggested here), but this doesn't seem to work.. It's not that the checker doesn't offer any corrections, but it's corrections are just not in English. Here are some of its offers:   1. algorithm -> Algorithmen, Algorithmus, algorithmisch   2. introduced -> eintrocknend    3. The -> Theo, Tee, Ehe, Che, Tue. *****Any ideas as to why this happens and how to make it work? _*_**


title: hyphens in index entries

text: If I write:               \index{axioms!Zermelo–Fraenkel}      LaTeX generates               axioms, 184         ZermeloFraenkel, 203, 208      How do I stop the hyphen from disappearing? EDIT: MWE...               \documentclass{article}     \usepackage{makeidx}     \makeindex          \begin{document}     \printindex     \index{axioms!Zermelo–Fraenkel}axioms     \end{document}      (also (MiKTeX version 2.9); compiled via WinEdt's pdftexify option)


title: What is the best way to alias a key using PGF Keys

text: I would like to be able to alias a PGF key to another name, is this possible and if it is, how do I do this? For example if I have defined a key as:                \pgfkeys{path/         color/.store in=\color@cx       }      I would like have the ability to let "color" to "somecolor" would it also be possible to alias keys that have been defined using `.style`?


title: Telecommunications Symbols

text: I am trying to draw some telecommunications objects to put in a more complex figure using `PGF/TikZ`. I know there must be a better way to do it and even write their names `UE`, `BS`, etc. . Any help is appreciated               \documentclass{standalone}          \usepackage{tikz}          \newcommand{\UEA}{%     \begin{pgfpicture}     \pgfpathmoveto{\pgfpointorigin}     \pgfpathrectanglecorners{\pgfpointorigin}{\pgfpoint{2cm}{2cm}}     \pgfpathclose     \pgfpathmoveto{\pgfpoint{1cm}{2cm}}     \pgfpathlineto{\pgfpoint{1cm}{3cm}}     \pgfpathclose     \pgfpathmoveto{\pgfpoint{2cm}{3cm}}     \pgfpathlineto{\pgfpoint{0cm}{3cm}}     \pgfpathlineto{\pgfpoint{1cm}{4cm}}     \pgfpathclose     \pgfusepath{stroke}     \end{pgfpicture}     }          \newcommand{\UEB}{%     \begin{pgfpicture}     \pgfpathmoveto{\pgfpoint{5cm}{0cm}}     \pgfpathrectanglecorners{\pgfpoint{5cm}{0cm}}{\pgfpoint{7cm}{2cm}}     \pgfpathclose     \pgfpathmoveto{\pgfpoint{6cm}{2cm}}     \pgfpathlineto{\pgfpoint{6cm}{3cm}}     \pgfpathclose     \pgfpathmoveto{\pgfpoint{7cm}{4cm}}     \pgfpathlineto{\pgfpoint{5cm}{4cm}}     \pgfpathlineto{\pgfpoint{6cm}{3cm}}     \pgfpathclose     \pgfusepath{stroke}     \end{pgfpicture}     }          \newcommand{\BSA}{%     \begin{pgfpicture}     \pgfpathmoveto{\pgfpoint{10cm}{0cm}}     \pgfpathlineto{\pgfpoint{12cm}{0cm}}     \pgfpathlineto{\pgfpoint{11cm}{3cm}}     \pgfpathclose     \pgfpathmoveto{\pgfpoint{11cm}{3cm}}     \pgfpathlineto{\pgfpoint{11cm}{4cm}}     \pgfpathclose     \pgfpathmoveto{\pgfpoint{12cm}{4cm}}     \pgfpathlineto{\pgfpoint{10cm}{4cm}}     \pgfpathlineto{\pgfpoint{11cm}{5cm}}     \pgfpathclose     \pgfusepath{stroke}     \end{pgfpicture}     }          \newcommand{\BSB}{%     \begin{pgfpicture}     \pgfpathmoveto{\pgfpoint{10cm}{0cm}}     \pgfpathlineto{\pgfpoint{12cm}{0cm}}     \pgfpathlineto{\pgfpoint{11cm}{3cm}}     \pgfpathclose     \pgfpathmoveto{\pgfpoint{11cm}{3cm}}     \pgfpathlineto{\pgfpoint{11cm}{4cm}}     \pgfpathclose     \pgfpathmoveto{\pgfpoint{12cm}{4cm}}     \pgfpathlineto{\pgfpoint{10cm}{4cm}}     \pgfpathclose     \pgfpathmoveto{\pgfpoint{12cm}{4cm}}     \pgfpathlineto{\pgfpoint{12cm}{5cm}}     \pgfpathclose     \pgfpathmoveto{\pgfpoint{11.5cm}{5cm}}     \pgfpathlineto{\pgfpoint{12.5cm}{5cm}}     \pgfpathlineto{\pgfpoint{12cm}{5.5cm}}     \pgfpathclose     \pgfpathmoveto{\pgfpoint{10cm}{4cm}}     \pgfpathlineto{\pgfpoint{10cm}{5cm}}     \pgfpathclose     \pgfpathmoveto{\pgfpoint{9.5cm}{5cm}}     \pgfpathlineto{\pgfpoint{10.5cm}{5cm}}     \pgfpathlineto{\pgfpoint{10cm}{5.5cm}}     \pgfpathclose     \pgfusepath{stroke}     \end{pgfpicture}     }          \begin{document}     \UEA \quad \UEB \quad \BSA \quad \BSB     \end{document}      ![enter image description here](http://i.stack.imgur.com/V5Ayo.png)


title: Double spacing within the caption of a figure

text: I am using the `memoir` class on my thesis and I have the `\DoubleSpacing` command in my document to set up double spacing through the document. This works great. However, I have a figure with subfigures using `\subbottom[]{\includegraphics{}}` command, and the text in the caption shows with single spacing. How can I activate double spacing in the caption?


title: Vertical positioning of content on page

text: I've got a document I'm going to generate from some input which basically is a tabularx for each page:               \begin{tabularx}{\textwidth}{lXlll}     \hline \\[3ex]     \commandOne \\     \hline \\[3ex]     \commandTwo \\     \hline      \end{tabularx}          \clearpage          \begin{tabularx}{\textwidth}{lXlll}     \hline \\[3ex]     \commandThree \\     \hline \\[3ex]     \commandFour \\     \hline      \end{tabularx}      where `\commandOne`...`\commandFour` generates the table's rows and columns. The problem is that I want each of the `\hline`s to be placed exactly at the same place on each page (I know that every `\commandN` takes less than half a page). Is there for example a way I can hardcode the position of the `\hline` and the text following?


title: How do I extend my text width while keeping the text in the center of the page

text: I don't like that latex makes the margins really huge. However, instead of changing my margin width, I want to change the width of my text. I added the following to my doc:               \global\setlength{\textwidth}{13.5cm}%      however, my text still starts from the same location. So it looks like it's not centered on the page. Is there a better way to do this?