title: tabularx \hline introduces blank line above

text: I am using `tabularx` and I successfully created some tables with it so far (not too nice ones, but thats another problem). One Table freaks me out, as the "header" is separated from the next lines not only by my usual `\hline` but also with an empty line or row it seems. Comparison with my successful tables did not give me any clue. The hopefully compilable code sniplet is:               \documentclass{scrreprt}     \usepackage[ansinew]{inputenc}     \usepackage[T1]{fontenc}     \usepackage{tabularx}     \usepackage{textgreek}          \begin{document}     \begin{table}     \caption{\label{tab:Nanoindent_Kenngroessen}a caption}     \begin{tabularx}{\linewidth}{XXXXX}     \, & Mesa0\_2 & Mesa3 & Mesa10 & Mesa15  \\ %my header     \hline     Eindringtiefe [nm] & 509,45\,\textpm\,15,52 & 344,25\,\textpm\,2,56 & 1264,56\,\textpm\,89,53 & 408,66\,\textpm\,13,42 \\     Kriechstrecke [nm] & 59,32\,\textpm\,3,71 & 37,29\,\textpm\,1,42 & 199,80\textpm 3,93 & 53,62\,\textpm\,0,46 \\     remanente Eindringtiefe [nm]& 82,08\,\textpm\,3,94 & 63,04\,\textpm\,2,38 & 294,70\,\textpm\,30,40 & 90,01\,\textpm\,13,20 \\     Relaxations\-strecke [nm] & 83,46\,\textpm\,4,23 & 64,43\,\textpm\,2,38 & 232,19\,\textpm\,9,37 & 63,33\,\textpm\,2,37     \end{tabularx}     \end{table}      The Result looks like this whenever I compile it. Although I use the exact same syntax for other tables, I always end up with this strange space inbetween. ![Table with additional line before \\hline](http://i.stack.imgur.com/esmlX.jpg)


title: Forward search with WinEdt when compiling PDF

text: There is a forward search option (`Shift+F8`) with WinEdt 7 which works well for me, but it is only to visualize a previously compiled PDF. I am looking for a way to force a new compilation of the PDF when doing a forward search.


title: Structure, Tuple or Dict for the foreach-loop in Tikz

text: How can I use something akin to the following in tikz?               foreach (\x, \y, \colour) in {(0, 0, blue), (1, 1, green)} {           \node[fill=\colour] at (\x,\y) {};     }


title: kpfonts and Computer modern

text: there are typographical contraindications to use kpfonts for the text and standard Computer modern for the Math mode?               \documentclass[a4paper]{memoir}          \usepackage[nomath,fulloldstylenums,fulloldstyle]{kpfonts}          \begin{document}     ciaostffi          \[\int a+b=c^2\sum\partial\nabla\psi\ell\]          \end{document}


title: Numbered Definitions, Theorems in beamer

text: How to get numbered Lemmas, Definitions, Theorems and so on in `beamer`?


title: LaTeX Expert in the World

text: Who knows LaTeX the best in the whole world? I'm just a newbie to the wonderful world of LaTeX and I'm wondering who's the go-to-guy (or girl) for help.


title: Redefine \emph inside theorem using \newshadedtheorem from ntheorem

text: Using the `ntheorem` package, the definition of `\newshadedtheorem` overwrites the `\theoremprework`, which I wanted to use to redefine `\emph` inside a custom shaded theorem. The definition of `\newshadedtheorem` is:               \def\newshadedtheorem#1{%     \expandafter\global\expandafter\xdef\csname#1@shadecolor\endcsname{%     \the\shadecolor}%     \ifx\theoremframecommand\relax     \expandafter\global\expandafter\xdef\csname#1@framecommand\endcsname{%     \noexpand\psframebox[fillstyle=solid,     fillcolor=\csname#1@shadecolor\endcsname,     linecolor=\csname#1@shadecolor\endcsname]}%     \else     \expandafter\global\expandafter\let\csname#1@framecommand\endcsname%     \theoremframecommand%     \fi     \theoremprework{%     \def\FrameCommand{\csname#1@framecommand\endcsname}%     \vskip\theoremframepreskipamount\framed}%     \theorempostwork{\endframed\vskip\theoremframepostskipamount}%     \newtheorem@i{#1}%     }      Minimal example of what I want to do:               \documentclass[a4paper]{scrartcl}     \usepackage{amsmath}     \usepackage{xcolor}     \usepackage{framed}     \usepackage[amsmath,hyperref,noconfig,framed]{ntheorem}     \usepackage{hyperref}          % bakup old emph     \let\oldEmph=\emph          \theoremstyle{plain}     \theorembodyfont{\upshape}     \theoremprework{\renewcommand{\emph}[1]{\oldEmph{{\color{blue}##1}}}}     \theorempostwork{\renewcommand{\emph}[1]{\oldEmph{##1}}}     \def\theoremframecommand{\colorbox{blue!10}}     \newshadedtheorem{definition}{\color{blue}Definition}[section]          \begin{document}     \begin{definition}       Test of \emph{emph} inside Definiton.     \end{definition}     \end{document}      Does anybody know how to achieve this?


title: pgfplots: Positioning "node near coord" at the bottom of the bar

text: I would like to position `nodes near coords` at the bottom of the corresponding bar, right by the X axis. Here's what I've got now:               \documentclass{report}     \usepackage{pgfplots}     \begin{document}     \begin{tikzpicture}         \begin{axis}[                 ybar,                 ymin=0, yticklabel style={/pgf/number format/fixed},                 symbolic x coords={0,1,2,3}, enlarge x limits=0.15,                 every node near coord/.append style={font=\tiny, yshift=-30}]                     \addplot+ [nodes near coords, point meta=explicit symbolic]                 table[x index=0, y index=1, meta index=3] {                     0   0.1872  0.0040  0                     1   0.0358  0.0017  22                     2   0.0358  0.0017  23                     3   0.0358  0.0017  24                 };         \end{axis}     \end{tikzpicture}     \end{document}      I assume if I could write something like `yshift=\getcurrentvalueofy` (or `yshift=\getbarheight`), the problem would be solved. I tried `\pgfkeysvalueof{/data point/y}`, but I must admit I did not really understand what I was doing, so it did not work out.


title: Including graphics for both DVI and PNG

text: I'm asking a question is quite similar to this one (where I don't seem to be able to leave comments): MikTex error for PNG images when trying to produce DVI I'm producing a PDF document, but I'm using the DVI previewer inside LeD while doing so. Including graphics is a bit problematic. Suppose I want to include a file simple_ambiguity.png.               \includegraphics[width=\textwidth]{simple_ambiguity.png}      doesn't work with the DVI, because of a bounding box error. This is a nuisance because I don't actually care about having the graphics display accurately inside the DVI, or even having it take up the right amount of space -- I just want it to compile. At the moment I'm using a workaround: I'm creating a dummy `empty picture' file simple_ambiguity.eps whose dimensions I don't really care about, and then writing               \includegraphics[width=\textwidth]{simple_ambiguity}      But this is a nuisance because I have to manually create an eps every time I add a new picture. What I'm looking for is some simple fire-and-forget solution that will make the DVI just compile. (Of the answers in the question I linked to, the first seems to involve manually creating bounding boxes, and the second involves invoking ImageMagick on every compile, which will be unnecessarily slow & introduce a rather awkward dependency.)


title: Is it possible to define a multicolumn environment with a background colour

text: _EDIT: I should have given a MWE based on memoir (which I am using) where the inner and outer margins are initially different. I would like the margins to be the same in that new environment. (Inner margin is the left margin on odd number pages and the right margin on even number pages ... or the other way around.)_ * * * I would like to be able to define an environment that   1. changes the width of the text;   2. changes the number of columns;   3. adds a background color;   4. works across page boundaries. So far, the best I can get is three out of four; items 2 and 3 seem to be non- compatible choices. Here's a MWE which shows the intent. (Unfortunately, like the documentation states, `adjusmulticols` and `mdframed` are not compatible.)               \documentclass{article}     \usepackage{adjmulticol}          \usepackage{mdframed}     \usepackage{lipsum}          \begin{document}     \lipsum[1]     %\begin{mdframed}[background=yellow]     \begin{adjmulticols}{2}{-1in}{-1in}     \lipsum     \end{adjmulticols}     %\end{mdframed}          \begin{mdframed}[backgroundcolor=yellow,leftmargin=-1,rightmargin=-1]     %\begin{adjmulticols}     \lipsum     %\end{adjmulticols}     \end{mdframed}     \end{document}


title: Decrease the space between formula and text, and the formula position of align environment

text: Please see the picture first. My two questions are described in the picture. ![enter image description here](http://i.stack.imgur.com/i0bxw.png)   1. As known to us, when we use "\begin{align}", it will appear at the next line automatically. Could I just move it just be after the "(2)"?   2. About the decreasing the space. I have tried to use "\begin{equation}", see `http://tex.stackexchange.com/questions/132965/different-space-between-align-and-equation`. However, I fail to compile("there is no line here to end") if there're more than 1 equation in this case. Shall we have other method to make it? My code:               \documentclass[CJK]{beamer}      \usepackage{beamerthemesplit}      \usepackage{CJK,CJKnumb}     \usepackage[english]{babel}     \usepackage{amsmath}     \begin{document}     \begin{CJK*}{GBK}{song} %some words are Chinese.     \begin{frame}     \frametitle{**********************************************************************     (1)Question;\\     (2)Question;\\     (3)Prove.      }     (1)$2S_1=a_2-\frac{1}{3}-1-\frac{2}{3}=a_2-2$,$S_1=a_1=1 \Rightarrow a_2=4$.\\     (2)     \begin{align}     2S_n&=na_{n+1}-\frac{1}{3}n^3-n^2-\frac{2}{3}n,~~~(n \ge 2) \\[-1.5ex]      \Rightarrow 2S_{n-1}&=(n-1)a_n-\frac{1}{3}(n-1)^3-(n-1)^2-\frac{2}{3}(n-1)     \end{align}     (1)-(2)得$2a_n=na_{n+1}-(n-1)a_n-\frac{1}{3}(3n^2-3n+1)-(2n-1)-\frac{2}{3}$,\\     整理$(n+1)a_n=na_{n+1}-n(n+1)$,即$\frac{a_{n+1}}{n+1}-\frac{a_n}{n}=1$,又$\frac{a_2} {2}-\frac{a_1}{1}=1$,\\     ∴数列$\{\frac{a_n}{n}\}$是以首项$\frac{a_1}{1}$为1,公差为1的等差数列,\\     所以$\frac{a_n}{n}=1+(n-1)\times 1=n \Rightarrow a_n=n^2$.     \end{frame}     \end{CJK*}     \end{document}


title: Integrating latexmk and TikZ external mode=list and make

text: I've been looking into using `latexmk` to create my documents because it automatically handles how many passes the document needs to be fully processed etc. So, for example, a simple run of `latexmk -pdf file.tex` will run `pdflatex` and `bibtex` as many times as necessary to resolve all references. I was wondering whether it's possible to not lose the ability to do so when using the `TikZ`/`external` library in the `list and make` mode. If `list and make` is used, the `TikZ`/`external` makefile is generated, but it is not automatically called by `latexmk`. You can run the makefile manually and, of course, that will generate the graphic files, but the problem is that, as far as `latexmk` is concerned, the `.tex` files remain unchanged, so running `latexmk` once more does not insert the newly-generated graphics into the document. So, given `file.tex` that uses `TikZ`/`external` in the `list and make` mode, this is what happens:   * `latexmk -pdf file.tex` generates the pdf and inserts placeholders for the not-yet-generated graphics.   * `make -f file.makefile` processes and generates the pdf files for the graphics.   * `latexmk -pdf file.tex` does nothing because the source files have not changed. I assume there's a way to force the generation of the pdf in the second `latexmk` pass, but that would mean that this would happen even if the source files remained unchanged. I was wondering whether there was a way to use `latexmk` to handle all of this "automagicaly"? That would be great! Here's a MWE to get everyone started:               \documentclass{article}          \usepackage{tikz,pgfplots}     \usetikzlibrary{external}     \tikzexternalize[mode=list and make]          \begin{filecontents}{plot.tikz}     \begin{tikzpicture}       \begin{axis}         \addplot coordinates {(1,1) (2,2) (3,3)};       \end{axis}     \end{tikzpicture}%     \end{filecontents}          \begin{document}       \input{plot.tikz}     \end{document}


title: Tabular output from Excel2latex going off the page

text: I've used excel2Latex to convert a table into tabular format. The code generated is this               % Table generated by Excel2LaTeX from sheet 'Sheet1'     \begin{table}[htbp]       \centering       \caption{Add caption}         \begin{tabular}{rlrrrr}         \toprule               &       & Start date & End date & Days spent \\         \midrule         \multicolumn{1}{c}{\multirow{6}[12]{*}{\textbf{Background research}}} & Research which existing technologies exist for recommendation systems & 06/10/2011 & 10/10/2011 & \multicolumn{1}{c}{\multirow{6}[12]{*}{22}} \\         \multicolumn{1}{c}{} & Investigate the problems being face by the current recommender systems & 11/10/2011 & 15/10/2011 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & Learn what Semantic Web is and how the it is being implemented to solve problems & 16/10/2011 & 20/10/2011 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & Investigate how semantic web is being used for recommendation systems & 16/10/2011 & 20/10/2011 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & Read research papers on to find out more on work about music recommendation that has already been done in the past & 21/10/2011 & 27/10/2011 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & Deliverable: Write a literature survey to summarize research findings & 21/10/2011 & 28/10/2011 & \multicolumn{1}{c}{} \\         \multicolumn{5}{r}{}                  & \\         \multicolumn{1}{c}{\multirow{4}[8]{*}{\textbf{Analysis \& Design}}} & Create a structured list of requirements from the problem statement & 29/10/2011 & 04/11/2011 & \multicolumn{1}{c}{\multirow{2}[4]{*}{6}} \\         \multicolumn{1}{c}{} & Deliverable produced: Create a structured list of requirements from the problem statement & 29/10/2011 & 04/11/2011 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & Begin prototyping and experimenting with Semantic Web & 05/11/2011 & 09/12/2011 & \multicolumn{1}{c}{\multirow{2}[4]{*}{34}} \\         \multicolumn{1}{c}{} & Deliverable produced: A basic prototype of the recommender system & 05/11/2011 & 09/12/2011 & \multicolumn{1}{c}{} \\         \multicolumn{5}{r}{}                  & \\         \multicolumn{1}{c}{\multirow{21}[42]{*}{\textbf{Implementation}}} & \textbf{Iteration 1  - Implementing and testing core functionality of the website} &       &       &  \\         \multicolumn{1}{c}{} & Let users register with the website & 10/12/2011 & 16/12/2011 & \multicolumn{1}{c}{\multirow{7}[14]{*}{34}} \\         \multicolumn{1}{c}{} & Simulate users listening to songs/albums & 10/12/2011 & 16/12/2011 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & Enable searching for music and playlists in the website & 17/12/2011 & 23/12/2011 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & Let users create playlists and add/remove songs to them & 24/12/2011 & 30/12/2011 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & Users can integrate with Facebook and find friends that are also registered on the website & 31/12/2011 & 06/01/2012 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & Users can comment on a playlist and Like a playlist & 07/01/2012 & 13/01/2012 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & Deliverable produced: The first iteration of the website without a recommendation system & 10/12/2011 & 13/01/2012 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & \multicolumn{4}{r}{}          & \\         \multicolumn{1}{c}{} & \textbf{Iteration 2 - Implemented and testing core functionality of the algorithm} &       &       &  \\         \multicolumn{1}{c}{} & Integrate Semantic Web so that recommendation algorithm can be implemented & 14/01/2012 & 20/01/2012 & \multicolumn{1}{c}{\multirow{5}[10]{*}{27}} \\         \multicolumn{1}{c}{} & The website shall allow users to get music recommendations based on the friend’s taste & 21/01/2012 & 03/02/2012 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & The website shall allow users to get music recommendations based on the user’s taste & 21/01/2012 & 10/02/2012 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & Deliverables produced: Algorithm for music recommendation & 14/01/2012 & 10/02/2012 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & Second iteration of the website with core functionality in place & 14/01/2012 & 10/02/2012 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & \multicolumn{4}{r}{}          & \\         \multicolumn{1}{c}{} & \textbf{Iteration 3 - Adding additional features (Could have's and Wont have's in the requirements)} &       &       &  \\         \multicolumn{1}{c}{} & Carry out the finishing touches of the website & 11/02/2012 & 24/02/2012 & \multicolumn{1}{c}{\multirow{4}[8]{*}{13}} \\         \multicolumn{1}{c}{} & View a feed which lets them find out what their friends are doing on the site through likes and comments & 11/02/2012 & 17/02/2012 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & Allow users to subscribe to a playlist & 18/02/2012 & 24/02/2012 & \multicolumn{1}{c}{} \\         \multicolumn{1}{c}{} & Deliverable: Final version of the website with added features & 11/02/2012 & 24/02/2012 & \multicolumn{1}{c}{} \\         \multicolumn{5}{r}{}                  & \\         \multicolumn{1}{c}{\multirow{2}[3]{*}{\textbf{Documentation}}} & Begin the final report & 25/02/2012 & 30/03/2012 & \multicolumn{1}{c}{\multirow{2}[3]{*}{34}} \\         \multicolumn{1}{c}{} & Deliverable: Final report with explaining all stages of the software development cycle & 25/02/2012 & 30/03/2012 & \multicolumn{1}{c}{} \\         \bottomrule         \end{tabular}%       \label{tab:addlabel}%     \end{table}%      The text doesn't get wrapped and it goes off the page. I tried setting the width for the second cell but it didn't work. How can I make it fit into page width? Also how can I make the table overflow go to the next page once the page gets filled up?


title: cannot add table of contents

text: I'm using somebody else's template creating my resume, but I just found that I cannot add toc using `\tableofcontents`. I'm not sure if it's because the the .sty style file I'm using. In this template, contents of resume are included in the environment `\begin{resume}`, in which `\section` is unnumbered automatically. I checked the template's .sty file, but didn't find any change the author did to `\section` or other common latex macros. When I added `\table of contents` in the author-defined `\begin{resume}` environment, only "*contents" is displayed, without anything below it. Could anybody help? thanks


title: Aligning mathematical inequalities

text: I want to align the following at the inequality signs, however it becomes very ugly:               \begin{alignat*}{2}                                                                                \sum\limits_{i=0}^{h-1} k^i &< n &\leq \sum\limits_{i=0}^h k^i \\                                                                                \frac{k^h-1}{k-1} &< n &\leq \frac{k^{h+1}-1}{k-1} \\                                                                                \log_k(k^h-1) - \log_k(k-1) &< \log_k(n) &\leq \log_k(k^{h+1}-1) - \log_k(k-1) \\                                                                                \log_k(k^h-1) &< \log_k(n) + \log_k(k-1) &\leq \log_k(k^{h+1}-1) \\                                                                                \lceil\log_k(k^h-1)\rceil &< \lceil\log_k(n) + \log_k(k-1)\rceil &\leq \lceil\log_k(k^{h+1}-1)\rceil \\                                                                               h < \lceil\log_k(n) + \log_k(k-1)\rceil \leq h+1 \\                                                                                h-1 < \lceil\log_k(n) + \log_k(k-1)\rceil - 1 \leq h \\                                                                                h-1 < \lceil\log_k(n) + \log_k(k-1) - 1\rceil \leq h \\                                                                                \end{alignat*}      ![Result](http://i.stack.imgur.com/v4paN.png)   1. How can I properly format this?


title: YAML Syntax Highlighting

text: The `listings` package does not support YAML out of the box. Does a package exist that extends `listings` with YAML support? More generally, is there a good listing somewhere of extensions to `listings`?


title: How can I add a zero line to a plot?

text: I frequently need to draw a horizontal or vertical line passing through the axis origin that spans the entire width or height of my plot area. I don't want to use `axis lines=middle`, because the tick labels clutter up the plot area. So far, I've been using something like `\addplot [black, no markers] coordinates (-5,0) (5,0);` to draw a horizontal line, but the approach doesn't feel right, and it's not very flexible: If I change my axis range, the line might be too short, and I have to explicitly set `xmin` and `xmax` because otherwise the line influences the plot limits. What's the proper way to add a vertical or horizontal line passing through a certain point (typically the axis origin) that spans the entire height/width of a plot? ![](http://i.stack.imgur.com/EUGyH.png)               \documentclass{article}     \usepackage{pgfplots}     \begin{document}     \begin{tikzpicture}     \begin{axis}[         xmin=-6,xmax=6     ]     \addplot {rand};     \addplot [red, no markers] coordinates {(-7,0) (7,0)};     \end{axis}     \end{tikzpicture}     \end{document}


title: Alignment problem between multiple line "bmatrices"

text: I'm having problems trying to align single and multiple line `bmatrices`:               \documentclass[12pt]{article}          \usepackage{amsmath}          \begin{document}          \begin{align*}         x = &\begin{bmatrix} 1&2&3 \end{bmatrix}\\         y = &\begin{bmatrix} 1&2&3\\3&2&1 \end{bmatrix}\\         z = &\begin{bmatrix} 1&2&3\\3&2&1\\4&4&4 \end{bmatrix}     \end{align*}          \end{document}      I guess the solution would be to force the same matrix tracing used in the one with the biggest amount of lines, but how to do it? The above example led to a false interpretation of the problem. What I want is to have the alignment on the beginning of each bracket:               \documentclass[12pt]{article}          \usepackage{amsmath}          \begin{document}          \begin{align*}         x = &\begin{bmatrix} 1&2&3&6&5 \end{bmatrix}\\         y = &\begin{bmatrix} 1&2&3\\3&2&1 \end{bmatrix}\\         z = &\begin{bmatrix} 1&2&3&4\\3&2&4&1\\5&4&4&4 \end{bmatrix}     \end{align*}          \end{document}      and the answers no longer work: ![enter image description here](http://i.stack.imgur.com/ieP2s.png)


title: Table alignment with inner table and hline

text: There are 3 issues with this table. After much experimenting, I can sort of resolve 1 or 2 of them but never all 3 at the same time. I have a very picky customer (aren't they all) and I have to get this right. Here is the code:               \PassOptionsToPackage{table}{xcolor}     \documentclass[twoside]{article}     \usepackage{longtable}     \usepackage{multirow}     \renewcommand{\familydefault}{\sfdefault}     \usepackage[table]{xcolor}     \usepackage{calc,adjustbox}     \usepackage[a4paper,top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry}     \usepackage{pbox}          \begin{document}          %Colours used in the table     \newcommand{\titlecolor}{\rowcolor{gray!50}} %Color of titlbar     \newcommand{\raa}{\rowcolor{gray!30}}  % alternate set a rows     \newcommand{\rab}{\rowcolor{gray!15}}     \newcommand{\rba}{\rowcolor{gray!20}}  % alternate set b rows     \newcommand{\rbb}{\rowcolor{gray!15}}     \newcommand{\altrows}{\rowcolors{2}{gray!20}{gray!30}}               %Column types for main table     \newcolumntype{I}{     >{\textbf\bgroup}p{0.2\linewidth-2\tabcolsep}<{\egroup}} %Item     \newcolumntype{T}{@{}p{0.8\linewidth-2\tabcolsep}} %Inner table     %Column types for inner tables     \newcolumntype{D}{@{}p{0.43\linewidth-2\tabcolsep}} %Description     \newcolumntype{Q}{>{\hfill}p{0.07\linewidth-2\tabcolsep}} %Qty     \newcolumntype{N}{p{0.50\linewidth-\arrayrulewidth}} %Notes     %The title bar for the main tables     \newcommand{\titlebar}{\titlecolor \textbf{Item} & \adjustbox{valign=t}{         \begin{tabular}{@{}D p{0.07\linewidth-2\tabcolsep} N}         \textbf{Description} & \textbf{Qty} & \textbf{Notes} \\         \end{tabular} } \\      }          \altrows     \begin{longtable}[t] {I T}          \titlebar \hline     \endfirsthead     \multicolumn{2}{l}{\textit{Continued from previous page}}\\     \titlebar \hline     \endhead          \rowcolor{white}\multicolumn{2}{r}{\textit{Continued on next page}} \\     \endfoot     \endlastfoot               Type One    & \adjustbox{valign=t}{         \begin{tabular}{D Q N}             \raa Green sprockets &  1 &  \\              \rab Painted Magnolia &  & not green\newline not old \\              \raa Yellow Legumes & 3 &  old and faded blue things which don't wash well.\\              \rab Red Carnations & &  \\          \end{tabular}} \\ \hline          Type Two    & \adjustbox{valign=t}{         \begin{tabular}{D Q N}             \rba Green sprockets & 1 & Army green\\              \rbb Painted Magnolia & & very messy\\              \rba Yellow Legumes & 3 &                      old and faded\newline                     another line\newline                     yet more lines\\             \rbb Red Carnations & & odour free\\          \end{tabular}} \\ \hline          Type Three  & \adjustbox{valign=t}{         \begin{tabular}{D Q N}             \raa Green sprockets &  1 &  \\              \rab Painted Magnolia &  & very messy\\              \raa Yellow Legumes & 3 &  old and faded blue things which don't wash well.\\              \rab Red Carnations & &  \\          \end{tabular}} \\ \hline          \end{longtable}          \end{document}      And here is what it produces: ![table3](http://i.stack.imgur.com/Z07T3.jpg) Issue 1: I cannot get the \hline's to exactly line up with the edge of the table. Issue 2: I need the text (Green sprockets, Painted Magnolia, etc) to start exactly at the point where the alternate shading starts and not have any padding. Issue 3: When viewed on acrobat at 100%, or on an iPad or Android device, the \hline's in between the major rows are not visible. Here is a screenshot of that. ![nolines](http://i.stack.imgur.com/VrKH0.jpg) Of course, as a beginner to LaTeX, I may be doing this all wrong and there may be a much better way of achieving my goals.


title: deleting pages from pdf

text: I am writing a replacement for `\include` that will only include the file if it has been modified. To do this I need to delete or extract files from a pdf. I am using lua to do all this. I see there are some cmd line tools to do it: http://www.verypdf.com/wordpress/201112/delete-specified-pdf-pages-using- command-line-15756.html But is there any easier way? Ultimately I would like to extract/copy only a subset of pages from a pdf to a new pdf rather than copy the whole file(which may be large) into another then delete the pages.


title: problem with cropping and alignment

text: I'm trying to make a layout suitable for two-side printing and cutting. I used geometry package with these parameters:               a4paper,     paperwidth=210mm,     paperheight=297mm,     bindingoffset=1cm,     layoutwidth=178mm,     layoutheight=235.5mm,     layouthoffset=0mm,     layoutvoffset=0mm,     includeheadfoot,     ignoremp,     textwidth=148mm,%180mm,     textheight=215.5mm,%257mm,     top=0.5cm,     bottom=0.5cm,     inner=2cm,     outer=1cm,     showcrop      How can I align the page content to different sides (or both in the middle) so I can cut the paper after printing. Here's an example of the result. ![enter image description here](http://i.stack.imgur.com/9otpj.jpg)


title: Automatic horizontal centering of beamer frame content

text: I would like to set some global option so that the content of all beamer frames is horizontally centered with respect to the page. In other words, I want to achieve the effect of wrapping all frame content in `\centering` ... `\par`, but _without_ actually having to type that in every frame:               \documentclass{beamer}     %% This is the sort of thing I want, but it only works in article mode     % \setbeamertemplate{frame begin}{\centering}     % \setbeamertemplate{frame end}{\par}     \begin{document}     \begin{frame}       \framebox{Automatically centered -- how?}     \end{frame}     \begin{frame}       \centering       \framebox{Centered by hand}       \par     \end{frame}     \end{document}      I have searched the documentation for some sort of hook that I can set, but to no avail. The tantalizingly named `frame begin` and `frame end` templates work only in article mode. How can this effect be achieved?


title: Use tikz external feature with beamer \only

text: I would like to use the beamer `\only` with `tikz` while `external` is activated. The problem is, that the `\only` get ignored. (see also the MWE). I would love to cache the `tikz` pictures, because it would definitely speed up the compile time.               \documentclass{beamer}     % main document, called main.tex     \usepackage{tikz}     \usetikzlibrary{external}     \tikzexternalize % activate!     \begin{document}          \begin{frame}         \begin{tikzpicture}             \node at (1,1) {test};             \only<2>{\node at (2,2) {test2};}         \end{tikzpicture}     \end{frame}          \end{document}      I tried the current version and also the cvs version (which is nicer because it uses checksums for the images).


title: How can I get lines to break automatically using the LaTeX listings package?

text: I am using the `listings` package to include sample Perl source code in LaTeX. I included the package with `\usepackage{listings}`, and used the following code:               \lstset{language=Perl}     \lstset{commentstyle=\textit}     \lstset{frame=shadowbox}     \begin{lstlisting}[numbers=left]     $subject = "<owamp:subject xmlns:owamp=\"http://ggf.org/ns/nmwg/tools/owamp/2.0/\" id=\"subject\">\n";     \end{lstlisting}      The resulting output is: ![Screenshot of the output](http://i.stack.imgur.com/B1knh.png) The line doesn't seem to breaking, but I read that lines break automatically when using the `listings` package. This line is the entire PDF snapshot of the code. Am I doing anything wrong as far as the code is concerned?


title: How do I make math symbols bigger?

text: I'm using Scrivener to convert multimarkdown to LaTeX and then using TeXshop to typeset my document.This work flow works great for me except for the fact that I'd like to be able to make certain math symbols bigger i.g. the integral sign. I've tried doing this like this: `\bigint`, `\Biggint`, etc but that doesn't work. I'm sure there is a syntax that does this but I can't find it.


title: In the hyperref-pkg, is there a way to (sometimes) use abbreviations; e.g. tab. _vs_ table?

text: "Manually", both of the following do the trick (as far as I can tell):               \ldots as presented in table~\ref{tab:birds_and_bees} \ldots          \ldots as presented in tab.~\ref{tab:birds_and_bees} \ldots      With the `hyperref`-pkg, "only" the following seems to be on offer:               \ldots as presented in \autoref{tab:birds_and_bees} \ldots      which produces the long version of "table" ( _not_ the abbreviated tab.). I guess it'd be o.k. to use `\autoref{tab:birds_and_bees}` sometimes, and `tab.~\ref{tab:birds_and_bees}` at other times (in the same document ! ), but is there a way of having the abbrev. done via `hyperref/autoref`, too? PS: one disadvantage of using `tab.~\ref{tab:birds_and_bees}` is that the "tab."-part is _not_ linkified (not "blue", in my output). IMO, it looks beta if "tab." is blue, too. PPS: for in-depth discussion (providing _many_ pointers and food for thought): Cross-reference packages: which to use, which conflict?


title: Change marginpar Font

text: How do you change the font used for a `\marginpar`? I am using `xltxtra`, and am seeking to use an OpenType font. MWE:               \documentclass{book}     \usepackage{xltxtra}     \usepackage{titlesec}     \setmainfont[Ligatures=TeX]{Font A}          \begin{document}          Hello world.\marginpar{A margin note in Font B}          \end{document}


title: Beamer - too much text one one slide

text: I'm making a beamer presentation with lots of text in itemize. How to tell latex to move the text to next slide, if the text does not fit the current one? (of course, without creating a new slide) Also, the apparent "duplicate" is about tables, and the answer did not help.


title: How to set the size of a single symbol defined via \DeclareMathSymbol?

text: I am using the following definition for a symbol I call `\nstn`:               \DeclareSymbolFont{largesym}{OML}{cmm}{m}{it}     \DeclareMathSymbol{\nstn}{0}{largesym}{"22}      How can I set the size of this single symbol (which is basically `\varepsilon`) to a specific number (I would like it to be larger than usual/default)?


title: Automatic repetition of mathematical operators after a line break

text: In handwritten mathematics it is common for the sake of clarity to repeat the last mathematical operator in those line breaks that occur in the middle of a formula. I mean something like:               We compute 1 + 2 + 3 + 4 + 5 +     + 6 + 7 + 8 to know the answer.      In LaTeX I always do this repetition in displayed environments such as align or multline by manually adding the symbol after the `\\` but this is much more difficult in inline formulas because the breaking point may change during different compilations. In this case I only do it occasionally for the multiplication \cdot. Anyway, this makes my mathematical style not coherent, so I would like to know if there is any package to implement this option. If you think that this practice is bad I would like to read the reasons.


title: Include aux file in tex source?

text: I have a large book broken into several chapters, each of which reference each other heavily. I would like to be able to distribute individual chapters as self-contained .tex files. I can do this except for the fact that references will not work unless I have the .aux file for the entire book (and I use the xr package for external references). I would thus like to be able to include the large .aux file in the individual chapter files when distributing the individual files. Is there a way I can do this?


title: Cross in particular plane in 3D

text: I'm creating tikz graphics in `(x,y,z)` Cartesian coordinate system. I'm defining objects (circle in my WE) in some plane using `\tikzset{xyplane/.style={canvas is yx plane at z=#1}}`. I noticed it doesn't work for cross marking some point (cross is always in `yz` plane in my WE). I'm affraid my skill isn't enough to define `cross/.style` so that it would render cross in particular plane. Is it possible? **MWE:**               \documentclass[a4paper,fleqn,leqno]{article}     \usepackage{tikz,tikz-3dplot}     \usetikzlibrary{arrows.meta,decorations.markings,shapes.misc,3d}     \DeclareMathSizes{12}{12}{6}{12}     \tikzset{cross/.style={cross out,draw=black,minimum size=2*(#1-\pgflinewidth),inner sep=0pt,outer sep=0pt},cross/.default={3pt}}     \tikzset{xyplane/.style={canvas is yx plane at z=#1,very thin}}     \tikzset{xzplane/.style={canvas is zx plane at y=#1,very thin}}     \tikzset{yzplane/.style={canvas is zy plane at x=#1,very thin}}     \begin{document}     \begin{tikzpicture}[cm={-1,-1,1,0,(0,0)},x=3.85mm,z=-1cm]     \def\Sx{0} \def\Sy{0} \def\Sz{2}     \pgfmathsetmacro\Sρ{"sqrt((\Sx)^(2)+(\Sy)^(2)+(\Sz)^(2))"}     \pgfmathsetmacro\Sθ{ifthenelse(\Sx==0&&\Sy==0&&\Sz==0,0,"acos(\Sz/(sqrt((\Sx)^(2)+(\Sy)^(2)+(\Sz)^(2))))")}     \pgfmathsetmacro\SΦ{ifthenelse(\Sx==0&&\Sy==0,0,ifthenelse(\Sy<0,"-acos(\Sx/(sqrt((\Sx)^(2)+(\Sy)^(2))))","acos(\Sx/(sqrt((\Sx)^(2)+(\Sy)^(2))))"))}     \tdplotsetcoord{S}{\Sρ}{\Sθ}{\SΦ}     \draw[xyplane=\Sz,color=black,semithick] (S) circle (2cm) node[cross] {};     \draw[dashdotted,color=black] ($(S)-(0,0,2.5)$) -- ($(S)+(0,0,2.5)$) node[anchor=south,color=black] {$o$};     \end{tikzpicture}     \end{document}


title: macro that deletes whatever symbol follows after the code and leave no space

text: How would the following macro X be defined in TeX?               word in previous sentence?\macroX . Next sentence      gives output identical to               word in previous sentence? Next sentence      The motivation: a period is placed by another macro automatically, to automate repetitive data entry and display in parts of a document. Sometimes however different punctuation is required. The period is appropriate in 95% of all cases but in the exceptions such a macro X would be required to allow the data entry to remain automated. One may imagine this has been done before somewhere already, likely for the same reason? To clarify, the idea is that whatever character is after the macro simply gets ignored. EDIT: My question itself was actual simpler than question that was answered (I must add here that, in my case, egreg suggested a better solution to the concrete problem I was trying to solve in the first place). My question was merely (1): _what macro deletes whatever character is found to the right of it?_ For future knowledge and general completeness of the question for anyone else searching for this type of output, perhaps myself later, does anyone know what macro fits the description in my question (1)? (In case the object to be deleted is not a period but some arbitrary letter or number.) MWE (this general case):               \documentclass[12pt]{article}     \usepackage{amsfonts,mathtools,amsthm,amssymb}     \def\relevantpartofbigmacro{\textit{#1}.\egroup\par}     \begin{document}     \relevantpartofbigmacro{test}     \end{document}      gives               \textit{test}.      whereas the idea is to write (in the exceptional cases)               \documentclass[12pt]{article}     \usepackage{amsfonts,mathtools,amsthm,amssymb}     \def\relevantpartofbigmacro{\textit{#1}.\egroup\par}     \begin{document}     \relevantpartofbigmacro{test?\macroX}     \end{document}      to give               \textit{test?}      Or again               \documentclass[12pt]{article}     \usepackage{amsfonts,mathtools,amsthm,amssymb}     \def\relevantpartofbigmacro{\textit{#1}5\egroup\par}     \begin{document}     \relevantpartofbigmacro{test}     \end{document}      gives               \textit{test}5      whereas the idea is to write (in the exceptional cases)               \documentclass[12pt]{article}     \usepackage{amsfonts,mathtools,amsthm,amssymb}     \def\relevantpartofbigmacro{\textit{#1}5\egroup\par}     \begin{document}     \relevantpartofbigmacro{test7\macroX}     \end{document}      to give               \textit{test7}


title: positioning table

text: I would like to have a table in my latex. If use this code. I am loosing a part of my table. could you please tell me how can I fix this problem?               \documentclass[12pt,ngerman]{report}     \usepackage[a4paper]{geometry}     %\usepackage[T1]{fontenc}     \usepackage[utf8]{inputenc}     \usepackage[ngerman]{babel}     %\usepackage{ngerman}{babel}     \usepackage[T1]{fontenc}     \usepackage{graphicx}     \usepackage{float}     \selectlanguage{ngerman}     \begin{document}     Interval wertvolle Informationen extrahiert werden kann, betrachten wir die Spalte 6457, in der die Ereignisse anerkannt worden sind.     \begin{center}     \begin{table}[H]         \begin{tabular}{|l|l|l|l|l|l|l|l|l|l|}         \hline         Spalte & Ereignisse & Spalte & Ereignisse & Spalte & Ereignisse & Spalte & Ereignisse & Spalte & Ereignisse \\ \hline         6480   & 0          & 6487   & 88         & 6494   & 26         & 6501   & 57         & 6508   & 87         \\ \hline         6481   & 0          & 6488   & 288        & 6495   & 42         & 6502   & 89         & 6509   & 50         \\ \hline         6482   & 0          & 6489   & 356        & 6496   & 80         & 6503   & 105        & 6510   & 72         \\ \hline         6483   & 7          & 6490   & 92         & 6497   & 415        & 6504   & 124        & 6511   & 74         \\ \hline         6484   & 48         & 6491   & 126        & 6498   & 343        & 6505   & 135        & 6512   & 29         \\ \hline         6485   & 34         & 6492   & 97         & 6499   & 100        & 6506   & 30         & 6513   & 1          \\ \hline         6486   & 45         & 6493   & 70         & 6500   & 176        & 6507   & 41         & 6514   & 0          \\ \hline         \end{tabular}     \end{table}     \end{center}     \end{document}


title: Remove unnecessary horizontal space from amsmath align between two &

text: How do you remove unnecessary horizontal space in an amsmath align environment between two &? Consider:               \documentclass{article}     \usepackage{amsmath}          \begin{document}          Version 1:     \begin{align*}     a &= b = d\\      bb &= cc = d      \end{align*}          Version 2:     \begin{align*}     a &= b &= d\\      bb &= cc &= d      \end{align*}          \end{document}      I want all the equal signs to line up. I could do manual spacing, but thats a horrible solution. I apologize if this a repost: I cannot find this answer anywhere.


title: control package not found

text: I'd like to control the LaTeX `Error File fictitiuspack.sty not found`, for example. This is a MWE               \documentclass{article}      \usepackage{fictitiuspack}     \begin{document}          Hello world     \end{document}      Of course, the `fictitiuspack.sty` doesn't exist. If I compile the MWE, I obtain               ! LaTeX Error: File `fictitiuspack.sty' not found.          Type X to quit or <RETURN> to proceed,     or enter new name. (Default extension: sty)          Enter file name: X      It's possible to control this error before this error happens? For example, If I could control, I could write:               ifnonexist{\usepackage{goodpackage}}


title: Geo Sans Light Font

text: Does anyone know what settings are required for **Geo Sans Light** Font in Latex as can be found HERE.


title: How can I customize different nodepart with different textures?

text: My question is how can I customize hatch patterns(grid, vertical line, etc.) for different nodepart in a node? The following is a failed try.               \documentclass[border=2mm,convert]{standalone}     \usepackage{tikz}     \usetikzlibrary{shapes.multipart,patterns}          \begin{document}     \begin{tikzpicture}     \node[rectangle split,rectangle split parts =2,rectangle split part fill={red!30,red!10},     rectangle split part pattern={grid,},draw]{one \nodepart{second}two};     \end{tikzpicture}     \end{document}


title: Legend of picture, caption

text: I would like to assign one caption to a picture in my report, without this caption begin in the listing of figure. I use the following:               \begin{figure}[htbp]     \begin{minipage}[l]{.645\linewidth}     \begin{center}     \includegraphics[scale=0.94]{images/4.JPG}     \caption{Yearling inspecté, de profil}     \end{center}     \end{minipage}     \end{figure}      How can I do that? (Sorry for my English.)


title: Copy oldstyle numbers from pdf (Minion Pro)

text: I can't get LuaLaTeX (0.76.0-2013061707, current TeXLive) to produce a pdf with copyable (in adobe reader) oldstyle numbers with the Minion Pro font. I tried the method here, but I get the error > that font has been accessed already, changing it is forbidden I don't like using accsupp, as I would have to use a macro everytime a number is used. My test code is here:               \documentclass{scrartcl}     \usepackage{fontspec}     \defaultfontfeatures{Numbers=OldStyle}     \setmainfont{Minion Pro}     \begin{document}     1234567890     \end{document}


title: Section and subsection numbering

text: I'm new to LATEX language and now a have a problem with section and subsection numbering. I want to make my text look like this: **1\. Sun** **1.1 Moon** **2\. Bed** I was tried to figure out how to make it, but it doesn't work for me. This is my code:                \documentclass[12pt,a4paper,oneside]{article}     \usepackage{titlesec}     \titleformat{\section}[block]{\Large\bfseries\filcenter}{}{1em}{}     \titleformat{\subsection}[hang]{\bfseries\filcenter}{}{1em}{}     \renewcommand{\thesection}{\arabic{section}}     \begin{document}     \section{Sun}     \subsection{Moon}     \section{Bed}     \end{document}


title: Hyphenate long acronyms

text: I'm using the package `acronym` but I have a problem. I have a very long acronym "ADD1/SREBP1". I defined it like this:               \acro{srebp}[ADD1/\-SREBP1]{adipocyte determination-and differentiation-dependent         factor 1/ste\-rol regulatory element binding protein 1}      But in the text it is not separated and it creates a badbox. How can I fix this problem? I add a MWE:               \documentclass[a4paper,11pt,titlepage,twoside,openright,draft]{book}          \usepackage[italian,english]{babel}     \usepackage[T1]{fontenc}     \usepackage[utf8]{inputenc}     \usepackage{acronym}     \usepackage{etoolbox}          \makeatletter      \patchcmd\@acf{\hskip\z@}{}{}{}     \patchcmd\@acf{\hskip\z@}{}{}{}     \makeatother%this patch fixes white spaces after acronyms          \begin{document}          I cite the acronym first here \ac{srebp}. Then in the end of a row like this     but depends pf course on margins \ac{srebp}.          \begin{acronym}[AAAAAAA]     \acro{srebp}[ADD1\slash SREBP1]{adipocyte determination-and differentiation-dependent         factor 1/ste\-rol regulatory element binding protein 1}          \end{acronym}          \end{document}


title: pgfplots - How to use figures with commas when comma separator is defined empty?

text: As the MWE shows, the separator for every 1000th count was defined empty (for the lack of a better term) since the first column represents the year. So running the MWE does not work, since pgfplots does not parse numbers with `,` as 1000 separators/indicators. I'm a bit confused and would like to reassure if this is the right thought: should every figure in the input file then just consist of numbers and no other character whatsoever? **data01.csv**               2006;50,000     2007;100,000      **data02.csv**               2006;100000     2007;150000      **MWE**               \documentclass[     a4paper     ]{scrartcl}          \usepackage{     tikz,     pgfplots,     amsmath     }          \usepackage[T1]{fontenc}     \usepackage{     lmodern,     textcomp     }          \usetikzlibrary{calc,trees,shadows,positioning,arrows,chains,shapes.geometric,%         decorations.pathreplacing,decorations.pathmorphing,shapes,%         matrix,shapes.symbols,patterns,intersections}          \pgfdeclarelayer{background layer}     \pgfdeclarelayer{foreground layer}     \pgfsetlayers{background layer,main,foreground layer}          \def\parsedate#1-#2!{%         \pgfmathparse{#1+1/12*(1#2-101)}%     }          \begin{document}     \begin{center}     \begin{tikzpicture}     \begin{semilogyaxis}[         %height=7cm,             %width=14cm,         %axis lines*=left,             ymin=0,             xmin=2006,             xlabel={abc},             ylabel={def},             enlargelimits=upper,         /pgf/number format/1000 sep={},             legend style={at={(0.6,1.2)}},             stack plots=y,             %legend columns=4,             legend cell align=left,             every axis x label/.style={                     at={(ticklabel* cs:1.02)},                     anchor=west,                     },             every axis y label/.style={                     at={(ticklabel* cs:1.02)},                     anchor=south,                     },     ]     \addplot [mark=*, mark indices={1,6}] table [col sep=semicolon] {data01.csv}     node[pos=0, above right=5pt, fill=white]{257,000}     node[pos=1, anchor=south, yshift=3pt, fill=white]{244,862};     \addlegendentry{Text 1}     \addplot [mark=x, mark indices={1,7}] table [col sep=semicolon] {data02.csv}     node[pos=0, above right=5pt, fill=white]{2.000}     node[pos=1, above right=5pt, fill=white]{1.998};     \addlegendentry{Text 2}     \end{semilogyaxis}     \end{tikzpicture}     \end{center}     \end{document}


title: Compiling error Runaway argument

text: Here is an error I get when compiling               Processing: ./myaclatex.tex          Document Class: article 2007/10/19 v1.4h Standard LaTeX document class          Runaway argument?          ./myaclatex.tex:47: Paragraph ended before \href@split was complete.      the tex-document can be found here http://f.cl.ly/items/0L2F2o2a21040T0N242t/latex_error_130625.txt


title: Bibliography appears as part of the last appendix

text: I am writing my thesis and found that the bibliography appears as part of the last appendix. I am using `natbib` and A&A style Here you are the code I am using. I include the whole code:               \documentclass[a4paper,12pt,english]{book}          \usepackage{fancyhdr}          \usepackage{multicol}          \usepackage{graphicx}          \usepackage{amsmath}          \usepackage{amsfonts}          \usepackage{amssymb}          \usepackage{lscape}          \usepackage{graphics}          \usepackage{natbib}          \usepackage{epsfig}          \usepackage{booktabs}          \usepackage{multirow}          \usepackage{multicol}          \usepackage{ctable}          \usepackage{rotating}          \usepackage{epigraph}          \usepackage{appendix}          \usepackage{ctable}          \usepackage{color}          \usepackage{fix-cm}           \usepackage{setspace}           \usepackage{morefloats}          \usepackage{hyperref}          \usepackage{pageno}          \usepackage{fixltx2e}          \usepackage{textcomp}          \usepackage{amssymb}          \usepackage{psfrag,color}          \usepackage{txfonts}          \usepackage{caption}          \renewcommand{\captionfont}{\small}           \renewcommand{\captionlabelfont}{\sffamily\bf}          \usepackage{subfig}          \setlength{\textwidth}{17cm}          \setlength{\textheight}{25cm}          \setlength{\headwidth}{17cm}          \setlength{\evensidemargin}{-1.0cm}          \setlength{\oddsidemargin}{-1.0cm}          \addtolength{\topmargin}{-1.0cm}          \setlength{\voffset}{-1.65cm}          \setlength{\hoffset}{0cm}          \onehalfspacing          \pagestyle{fancy}          \fancyhf{}          \fancyhead[LO]{\leftmark}          \fancyhead[RE]{\rightmark}          \fancyhead[RO,LE]{\thepage}           \renewcommand{\chaptermark}[1]{\markboth{\textbf{\thechapter. #1}}{}}          \renewcommand{\sectionmark}[1]{\markright{\textbf{\thesection. #1}}}          \renewcommand{\headrulewidth}{0.6pt}          \setlength{\headheight}{2\headheight}          \renewcommand{\textfraction}{0.00}          \renewcommand{\topfraction}{0.0}          \renewcommand{\bottomfraction}{0.0}          \renewcommand{\floatpagefraction}{0.0}          \setcounter{totalnumber}{6}           \newcommand{\Rsolar}{\mbox{$\rm R_{\odot}\:$}}          \newcommand{\Rsol}{\mbox{$\rm R_{\odot}$}}          \newcommand{\VR}{$V\hskip-0.0275cmR$}          \newcommand{\Rsolit}{$\rm \textit{R}_{\odot}\:$}          \newcommand{\Msol}{\mbox{\,$\rm M_{\odot}$}}          \newcommand{\Nestel}{\mbox{\,$\rm N_{\star}\:$}}                  \newcommand{\Testel}{\mbox{\,$\rm T_{\star}\:$}}                  \newcommand{\Restel}{\mbox{\,$\rm r_{\star}\:$}}                  \newcommand{\Bestel}{\mbox{\,$\rm B_{r_{\star}}\:$}}              \newcommand{\ba}{\begin{eqnarray}}          \newcommand{\ea}{\end{eqnarray}}          \newcommand{\be}{\begin{equation}}          \newcommand{\ee}{\end{equation}}          \begin{document}          \frontmatter          \pagenumbering{roman}          \fancyhead[RE]{My thesis.}          \tableofcontents          \mainmatter          \pagenumbering{arabic}                 \chapter{Chapter1}\label{Chapter1}          ble ble ble \citep{Andrews}               \appendix              \chapter{Appendix1}\label{Appendix1}          bla bla bla                 {            \backmatter             \cleardoublepage             \addcontentsline{toc}{chapter}{Bibliography}            \newpage             \bibliographystyle{aa}             \bibliography{aamnem99,tesi-bib}           \begin{description}           \bibitem[Andrews(2222)]{Andrews} Andrews, H.C. (Prentice-Hall, Inc., EnglewoodCliffs, New York).           \end{description}            }               \end{document}      If I substitute the last part between brackets by...                       {         \cleardoublepage              \renewcommand{\chaptermark}[1]{\markboth {#1}{#1}}              \renewcommand{\sectionmark}[1]{\markright{#1}}              \lhead[\fancyplain{}{\bf\thepage}]{\fancyplain{}{}}              \rhead[\fancyplain{}{\bf {\bf Bibliography}}]{\fancyplain{}{\bf\thepage}}              \chead{}              \addcontentsline{toc}{chapter}{Bibliography}              \bibliographystyle{aa}              \bibliography{aamnem99,aabib}                    \begin{description}           \bibitem[Andrews(2222)]{Andrews} Andrews, H.C. (Prentice-Hall, Inc., Englewood Cliffs, New York).           \end{description}                  }      ...then I cat separate the bibliography from the appendix but I don't get a page with the title "bibliography". Any help on this?


title: Miktex update:latex> (Fatal format file error; I'm stymied)

text: I did an update to my LaTeX packages two days ago _(I needed XeLaTeX for`beamer`, and this is why I did the update)_, then tried to continue writing my notes using LaTeX (MiKTeX2.9; Texniccenter2.0 Beta 1; SumatraPDF), and here came the surprise               latex> (Fatal format file error; I'm stymied)      I've tried many suggested solutions in the English FAQ and The LaTeX Community, but nothing worked.... Any ideas? PS: I use Windows 7 as an OS.


title: Combination (mix) of enumerate and tabular environments with labels giving the number from the enumerate environment

text: I'm trying to do something similar to How can I mix itemize and tabular environments?. However, I'm trying to use an enumerate environment, I want the items lined up like in a tabular environment, and I would like to reference the items in the enumerate environment using labels so that the references appear as the numbers in the enumerate environment. Conceptually, the idea is like that of a bibliography style environment, but each item is a line in an enumerate environment. Conceptually, the layout would look something like this, but with the header and the lines in the body lining up, of course.               \documentclass{article}     \begin{document}     \newcommand{\corr}[4]{%     \begin{tabular}{llll}     %Date & From & To\\     #1 & #2 & #3 & #4     \end{tabular}     }          \section{List of Correspondence}          \begin{tabular}{llll}     \textbf{Date} & \textbf{From} & \textbf{To} & \textbf{Summary}\\     \end{tabular}     \begin{enumerate}     \item\label{c1} \corr{September 26th 2011}{Sender1}{Recepient1}{Some stuff}     \item\label{c2} \corr{September 23rd 2013}{Sender2}{Recepient2}{Some other stuff}     \end{enumerate}          Here is \ref{c1} and \ref{c2}.          \end{document}      ADDENDUM: The `multienum` package does something close to what I want, except that I don't see how to include the headers. ADDENDUM2: If there was some way to directly reference the `itemize` counter without the overhead of placing labels, that would be helpful.


title: What's the best way to write matrix together with its dimensions on top and left?

text: I'm trying to show that matrix A (m rows, n columns) times matrix B(n rows, k columns), results as matrix C ( m rows, k columns). ![enter image description here](http://i.stack.imgur.com/zpQ76.png) I wonder what's the easier way to write it? there are several posts here, I found Block matrix equation with dimensioning and Equation with Large Matrix Dimension a bit too complex, while Matrix decomposition dimensions diagram put the dimensions at the bottom of the matrix, while I hope this can be displayed on the left and top.


title: Table taking up full width

text: I am looking to adjust this table in two ways: -Firstly, I would like the second `=` to be more to the right, next to the `$P_{S}(K|GB)$`. -Secondly, I would like the table to take up as much width as possible, such that it almost forms one single line (it won't really be a single line as the text is just too long for that, which is the whole reason I am constructing this table like this). Thank you for your insight.               \begin{table}[h]     \begin{center}     \begin{tabular}{lllcrrrcc}     \multicolumn{2}{l}{$P_{S}(A|GB)$} & $=$ & & $=$ & \multicolumn{2}{r}{$P_{S}(K|GB)$} &     \multirow{2}{*}{for} & \multirow{2}{*}{$p>\frac{1}{2}$}\\      & \multicolumn{2}{r}{$p(1-e_{1})+(1-p)(e_{1})$} & $>$ & \multicolumn{2}{l}{$p(1-e_{2})+(1-p)(e_{2})$} & & &      \end{tabular}     \end{center}     \caption{Receiver's conditional payoffs}     \label{eq:Label}     \end{table}


title: CircuiTikZ: draw transformer without conductors going to the side

text: I would like to draw a transformer in CircuiTikZ without the small parts of conductor going to the sides. Left: Current situation. Right: What I want. ![Transformer. Left: Current situation. Right: What I want.](http://i.stack.imgur.com/6ukws.jpg) Code:               \documentclass{article}     \usepackage{tikz}     \usepackage[siunitx,cuteinductors]{circuitikz}     \begin{document}     \begin{figure}[bth]         \begin{center}         \begin{circuitikz}         \draw             (0,0) node[rground] {}             to [vsourcesin, l^=$F_A$] (0,2)             to [generic, l_=$Z_A$] (0,4)             to [short, i^>=$V_S$] (1,4)             to [short] (1,3)             (2,3) node[transformer]{}             (1,1) node {}             to [short] (1,0)             to [short] (0,0);         \end{circuitikz}         \end{center}         \caption{Position1.}\label{fig:position1}     \end{figure}     \end{document}


title: Adjusting line-spacing in headline template

text: How can the line-spacing inside the `headline`-template be adjusted? Consider the following code, if it is used inside a normal frame I can control the line-spacing by modifying the `baselineskip` in `\fontsize{size}{baselineskip}`. But if I try to use it within the `headline`-template, changing the `baselineskip` does not make any difference.               \documentclass[t]{beamer}          % Fonts     \setbeamerfont{title}{series=\bfseries,size=\fontsize{16}{24}}          % Headline     \setbeamertemplate{headline}{%         \begin{minipage}[b][0mm][t]{85mm}%             \usebeamerfont{title}{%                 \inserttitle             }%         \end{minipage}%          }          \title{Really long title to test all the three possible lines is not yet long enough but know}            \begin{document}              \begin{frame}[t]         \end{frame}              \setbeamertemplate{headline}{}         \begin{frame}[t]                 \begin{minipage}[b][0mm][t]{85mm}%                     \usebeamerfont{title}{%                         \inserttitle                     }%                 \end{minipage}%          \end{frame}            \end{document}      ![enter image description here](http://i.stack.imgur.com/f0Nw5.png) * * * I also tried the answer http://tex.stackexchange.com/a/66208/36296, but the line-spacing remains unchanged.               \documentclass[t]{beamer}          \def\beamer@typesetheadorfoot#1{% typeset the head or footline         {\parskip0pt %\offinterlineskip%             \hbox{%                 \hskip-\Gm@lmargin%                 \hbox{%                     \vbox{%                         \@tempdima=\textwidth%                         \textwidth=\paperwidth%                         \hsize=\textwidth%                         \def\\{,}%                         \usebeamertemplate***{#1}%                     }}%                     \hskip-\Gm@rmargin%                 }}\hfil%             }               % Fonts     \setbeamerfont{title}{series=\bfseries,size=\fontsize{16}{24}}          % Headline     \setbeamertemplate{headline}{%         \begin{minipage}[b][0mm][t]{85mm}%             \usebeamerfont{title}{%                 \linespread{3.}                 \inserttitle \par             }%         \end{minipage}%          }          \title{Really long title to test all the three possible lines is not yet long enough but know}            \begin{document}              \begin{frame}[t]         \end{frame}              \setbeamertemplate{headline}{}         \begin{frame}[t]                 \begin{minipage}[b][0mm][t]{85mm}%                     \usebeamerfont{title}{%                         \inserttitle                     }%                 \end{minipage}%          \end{frame}            \end{document}


title: Use of new command resets page numbers

text: I defined a command in the preamble that allows something to be repeated n times               \def\myrepeat#1#2{\count0=#1 \loop \ifnum\count0>0 \advance\count0 by -1 #2\repeat}      so \myrepeat{3}{foo} is the same as typing foofoofoo. Every time I use the \myrepeat command in the body, the page numbering is reset to 0. Why is that happening, and is there an easy way to fix this? Here is an example that illustrates the problem:               \documentclass[]{article}          \def\irepeat#1#2{\count0=#1 \loop \ifnum\count0>0 \advance\count0 by -1 #2\repeat}          \begin{document}     The page number here is 1.     \newpage     \irepeat{3}{foo}     The page number here is 0.     \newpage     And 1 again.     \end{document}      Thank you.


title: Using plot instead of text in pgfplot legend

text: I am curious if it is possible to use a custom image (e.g. plot) instead of text inside the legend of a chart generated with pgfplots. Specifically, given this MWC:               \documentclass{standalone}     \usepackage{pgfplots}          \pgfplotsset{compat=newest}          \begin{document}         \tikzset{every mark/.append style={scale=0.75}}         \begin{tikzpicture}              \begin{axis}[xlabel=$x$, ymin=0, xmin=-1.1, xmax=1.1, samples=300, ylabel=$f(x)$,                      smooth,                      legend style={ legend cell align=left, at={(1.03, 1)}, anchor=north west}                      ]             \addplot coordinates {                                   (-1, 0)                                   (0, 0.5)                                   (1, 1)                                   };             \addlegendentry{Uniform(0,1)};             \addplot coordinates {                                   (-1, 1)                                   (0, 0.2)                                   (1, 0)                                   };             \addlegendentry{Exponential(1)};         \end{axis}         \end{tikzpicture}     \end{document}      which produces the chart below ![http://i.imgur.com/T2zVNe5.png](http://i.stack.imgur.com/LUpJp.png) I would like to insert the actual density function of a Uniform distribution in the legend text, e.g. I want to see this (scaled down) ![PDF of Uniform distribution](http://i.stack.imgur.com/t4G69.png) instead of the "Uniform(0, 1)" text. Of course, similar for the Exponential(1) part. The Uniform PDF plot is also generated with pgfplots (MWC below) so the question, perhaps, is if it possible to embed a pgfplot inside a legend entry.               \documentclass{standalone}     \usepackage{pgfplots}          \pgfplotsset{compat=newest}          \begin{document}         \tikzset{every mark/.append style={scale=0.75}}         \begin{tikzpicture}              \begin{axis}[ymin=0, xmin=0, xmax=1, ymax=2,xticklabels=none, yticklabels=none]             \addplot[color=black, fill=black] (x,1) \closedcycle;         \end{axis}         \end{tikzpicture}     \end{document}      **Later Edit** Torbjorn's proposed solution works; it does what I want: ![Plot with two images in legend](http://i.stack.imgur.com/66UQZ.png) I will let the question open to see if there is another possibility to generate everything on the fly, without embedding previously compiled files.


title: Variable Column Names using longtable?

text: I've been using the `longtable` package in order to create a multiple page table. However, I want all of my column names to be different and am having a hard time getting it to work properly. While I've found examples that show how to vary the column names across two pages, I haven't been able to get three pages (or more) to show the proper column names. The first set of names shows up on the first page, but then the third set is at the top of the remainder of pages. I have 43 columns, so trying to force them all onto 2 pages would probably render them illegible. Any advice or suggestions?               \begin{longtable}{lcccccccccccr}     \textbf{HIP}& \textbf{(X,Y,Z)}& \textbf{[Li/H]}& \textbf{[C/H]}& \textbf{[N/H]}& \textbf{[O/H]}& \textbf{[Na/H]}& \textbf{[Mg/H]} & \textbf{[Al/H]}& \textbf{[Si/H]}& \textbf{[S/H]} & \textbf{[K/H]}& \textbf{[Ca/H]} \\     \hline     \endfirsthead          \multicolumn{13}{c}%     {\tablename\ \thetable\ -- \textit{Continued from previous page}} \\     \hline     \textbf{HIP} & \textbf{[CaII/H]} & \textbf{[Sc/H]}& \textbf{[ScII/H]}& \textbf{[Ti/H]}& \textbf{[TiII/H]}& \textbf{[V/H]}& \textbf{[VII/H]}& \textbf{[Cr/H]} & \textbf{[CrII/H]} & \textbf{[Mn/H]} & \textbf{[Fe/H]}& \textbf{[FeII/H]} \\     \endhead     \hline \multicolumn{13}{c}{\textit{Continued on next page}} \\     \endfoot          \multicolumn{13}{c}%     {\tablename\ \thetable\ -- \textit{Continued from previous page}} \\     \hline     \textbf{HIP} & \textbf{[Co/H]} & \textbf{[Ni/H]}& \textbf{[Cu/H]}& \textbf{[Zn/H]}& \textbf{[Sr/H]}& \textbf{[Y/H]}& \textbf{[YII/H]}& \textbf{[Zr/H]} & \textbf{[ZrII/H]} & \textbf{[Mo/H]} & \textbf{[Ru/H]}& \textbf{[Ba/H]} \\     \endhead     \hline \multicolumn{13}{c}{\textit{Continued on next page}} \\     \endfoot     \hline     \endlastfoot          [data]          \end{longtable}


title: Is it possible to change the appearance of a \ref ?

text: I am using article class, and by default, the numbers of the sections, subsections appear like `1 section, 2 section` in time I want them to appear like `1. section, 2. section` (with dots). I have redefined the format of my section, subsection, etc. as follows:               \renewcommand\thesection{\arabic{section}.}     \renewcommand\thesubsection{\arabic{section}.\arabic{subsection}.}      because I wanted `.` after the number of the section and the subsection. Fortunately, I got the format that I want, but now I have another problem, when I use the cross-reference to the section or the subsection, I got extra `.` after the reference, like: `as we have seen in section 1..`, or `section 2..` it is unwanted. How can I get rid of this extra `.`? Is there anyway to change or redefine the appearance of the `\ref`?


title: Emphasizing a string in code example using showexpl

text: I am writing documentation for a package using the showexpl package which in turn uses the listings package. When using listing I can highlight a portion of the code like this:               \documentclass{article}          \usepackage{xcolor}     \usepackage{listings}          \lstset{       moredelim=[is][\color{red}]{<}{>}     }          \begin{document}          \begin{lstlisting}       This is an <emphasized string>.     \end{lstlisting}          \end{document}      But passing the `moredelim` option to a `LTXexample` environment does not have the desired effect, the code remains black.               \documentclass{article}          \usepackage{xcolor}     \usepackage{showexpl}          \lstset{       basicstyle=\ttfamily\small,       moredelim=[is][\color{red}]{<}{>}     }          \begin{document}          \begin{LTXexample}       This is an <emphasized string>.     \end{LTXexample}               \end{document}      Is there something I am missing about passing the `moredelim` option to the `LTXexample` environment correctly?


title: How is bytefield inducing differences between Pdf-and Xe-TeX and LuaTeX, and what's the fix?

text: This is a simplification of 'Please explain a strange interaction between bytefield, unicode-math, and mathtools', which arises from a comment by @JLDiaz (to whom my thanks). Here is the MWE:               \documentclass[a4paper]{article}     \usepackage{bytefield}     \begin{document}     \begin{bytefield}{16}       \bitheader{0,15}\\       \begin{rightwordgroup}{LuaLaTeX} % <= Processed with           \bitbox{16}{Without}\\       \bitbox{16}{Etc}       \end{rightwordgroup}\\     \end{bytefield}     \end{document}      I've processed this with PdfLaTeX, XeLaTeX, and LuaLaTeX, with the results that follow. (Note that I have checked that it depends on the processor used, _not_ on the name in braces.). Here are the results: ![enter image description here](http://i.stack.imgur.com/Q5AS9.png) ![Result: XeLaTeX](http://i.stack.imgur.com/mHleB.png) ![enter image description here](http://i.stack.imgur.com/5ivXL.png) So, any ideas what's wrong, and how to fix?


title: Everyday LaTeX and workflow?

text: I'm a LaTeX beginner and am wondering what a typical workflow looks like when writing a (longish) document. The draw for me is the ability to separate content and presentation, but it still seems like you need to know enough markup for sectioning and basic formatting, ie. italic, bold, etc. Do people write directly with LaTeX, or go through afterwards and mark things up? Similarly, are authors thinking about how to structure multiple chapter files from the beginning, or is this generally done at the end phase, alongside page layout? (In this case I was looking at the Memoir package.) So if an author is about to start a book, is it reasonable to just give them a limited number of formatting and section commands to work through the book, then at the end give them the big manual to dive in?


title: sample texts for a template

text: I am looking for some sample text, or a sample document which includes most basic LaTeX code structures such as sections, paragraphs, item lists, equations, tables, figures. I would like to include it in my template to show how it will be printed. It should be more than 3 pages so that the effect of headings become visible. And it should make some sence. Currently I only have lispum texts, which is not optimal. So far I only found these:   * http://sip.clarku.edu/tutorials/TeX/intro.html   * https://pangea.stanford.edu/computing/unix/formatting/latexexample.php Since this will be published in a public code repository and the template be available for everyone I must of course have the right to use and publish the text.


title: Qcircuit: How to insert a vertical dashed line in a circuit?

text: I want to insert vertical dashed lines between parts of the following circuit to make some comments:               \documentclass{amsart}     \usepackage[matrix,frame,arrow]{xy}     \input{Qcircuit}     \vfuzz2pt % Don't report over-full v-boxes if over-edge is small     \begin{document}     \[         \Qcircuit @C=1em @R=1em {          \lstick{\ket{x}} & \qw & \ctrl{1} & \qw & \rstick{\ket{x}} \qw \\          \lstick{\ket{y}} & \gate{H} & \gate{\pi} & \gate{H} & \rstick{\ket{y \oplus x}} \qw         }     \]     \end{document}      **Output:** ![enter image description here](http://i.stack.imgur.com/kGYfj.png) I have found a similar question (xypic: How to typeset the dashed line in this diagram? ) concerning xy-pic, it is the same idea, it should be the same solution. But it's not working, I don't know why. Note: Q-circuit is a `Qcircuit.tex` macro package for drawing quantum circuit diagrams in LaTeX


title: LaTeX3: \fp_pow:Nn giving wrong results

text: I want to draw the square-root from a rational number using the `l3fp` package. As the package does not provide an sqrt function, I played with `\fp_pow:Nn`. Unfortunately, I could only get the correct result for $\sqrt{4}$:               \documentclass{article}     \usepackage{expl3}          \begin{document}          \ExplSyntaxOn          \fp_set:Nn\a_fp{0.04}     \fp_pow:Nn\a_fp{0.5}     \fp_use:N\a_fp\par    %wrong          \fp_set:Nn\a_fp{4.0}     \fp_pow:Nn\a_fp{0.5}     \fp_use:N\a_fp\par    %ok          \fp_set:Nn\a_fp{9.0}     \fp_pow:Nn\a_fp{0.5}     \fp_use:N\a_fp\par    %wrong          \fp_set:Nn\a_fp{16.0}     \fp_pow:Nn\a_fp{0.5}     \fp_use:N\a_fp\par    %wrong          \ExplSyntaxOff          \end{document}


title: How to place the subject line under the greeting line in t-letter module in ConTeXt?

text: I'm writing a letter using the t-letter module available with ConTeXt. I want the subject line to be underneath the greeting line, but I can't work out how to do it. I think it is something like:               \setupletterstyle[subject][after=opening]      The relevant documentation is, I think, at page 55 here, but I still can't work it out: http://dl.contextgarden.net/modules/t-letter/doc/context/third/letter/correspondence.pdf


title: Georgia font lookalike

text: Is there a free lookalike font for the Microsoft's Georgia font that I could use with XeLaTeX or LuaLaTeX?


title: Arithmetic overflow with fontspec and LuaTeX

text: I have the following code using this font:               \documentclass{minimal}          \usepackage{lettrine}     \usepackage{fontspec,xunicode}          \newfontfamily\EBLettrineFont{EBGaramondInitialsF2}     \renewcommand{\LettrineFontHook}{\EBLettrineFont}          \begin{document}          \lettrine{T}{his} is a test               \end{document}      It works fine with `xelatex`, but crashes with `lualatex`:               ! Arithmetic overflow.     \LettrineFont ...\divide \@tempcnta by \@tempcntb                                                        \advance \@tempcnta by -99...     l.11 \lettrine{T}{his}                            is a test     ?       What is wrong?


title: newlfm - addrfrom and addrto on the same vertical height

text: Is there a way to put addrfrom and addrto on the same vertical height when one of them is left-justified and another is aligned to the right? This is basically the layout I'm trying to achieve:               --------------------------     [\addrto]      [\addrfrom]          ...          [\greetto]     [...msg...]     --------------------------


title: Algorithm spanning two columns error with \prevdepth

text: I am trying to use the `algorithm` command to display an algorithm that spans two columns in a two column document. However, I am getting an error message with `\prevdepth` that I do not understand. Below is a minimal example that illustrates the problem. Note that this example uses the sigplanconf.clf class file:               \documentclass[preprint]{sigplanconf}     \usepackage{subfigure}     \usepackage{fixltx2e}     \usepackage{algorithm}          \begin{document}          \title{a title }           \authorinfo{an author}     \maketitle          \begin{abstract}       abstract      \end{abstract}          \section{a section }          \begin{algorithm*}     \begin{verbatim}     a long line of text goes here that will take up too much space and need to span columns     \end{verbatim}     \end{algorithm*}          \end{document}      If I run latex with `algorithm` instead of `algorithm*` (note the difference with `*`) I do not get any error messages. However the algorithm text gets mixed with text in the right hand column. However, if I use `algorithm*` I get the following error message that I do not understand:               ! Improper \prevdepth. <recently read> \prevdepth                                  \subfig@end@float ...-\@Miv \@tempdima \prevdepth                                                        \vbox {}\prevdepth \@tempd...          \end@dblfloat ...\expandafter \@gobble \end@float                                                        \fi \else \end@float \fi  \end #1->\csname end#1\endcsname                                       \@checkend {#1}\expandafter \endgroup \if@e... l.291 \end{algorithm*}                            ?  ! Emergency stop. <recently read> \prevdepth                                  \subfig@end@float ...-\@Miv \@tempdima \prevdepth                                                        \vbox {}\prevdepth \@tempd...          \end@dblfloat ...\expandafter \@gobble \end@float                                                        \fi \else \end@float \fi  \end #1->\csname end#1\endcsname                                       \@checkend {#1}\expandafter \endgroup \if@e... l.291 \end{algorithm*}      I guess there is some conflict with the combination of `subfigure` `fixltx2e` and `algorithm` because when I was creating an example to illustrate the problem I found that if I removed either `fixltx2e` or `subfigure` the problem disappeared. So I will check my paper to see if I need both of those packages (I'm helping with editing so I'm not sure if they are needed). But if anyone happens to look at this example and understands what is causing the error I would be interested in understanding the root cause.


title: defining a command

text: how can I define a command so that in the preamble of my document I can have something like               \FigureFolder{name}      So that the following two commands will work               \newcommand{\FigureCaption}[3]{\begin{figure}[h!]\centering\includegraphics[scale=#1]{FIGURES/\FigureFolder/#2}\caption{#3}\label{#2}\end{figure}}          \newcommand{\FigureNoCaption}[2]{\begin{figure}[h!]\centering\includegraphics[scale=#1]{FIGURES/\FigureFolder/#2}\label{#2}\end{figure}}      Basically I want to associate with every of my LaTeX files a separate figure folder (to keep things a bit organised), and specify the name of that folder at the beginning of the document. Of course, I know I could just copy the `\newcommand` codes in the preamble but I prefer to put those commands in a `.sty` file and not have too many things at the top of my document.


title: Stacking symbols

text: How could I stack two symbols on top of each other, so that they would appear smaller, i.e. something like `\begin{array}a\\b\end{array}`, but would fit nicely in a single line with the rest? So for example, I want to write `blah blah blah $S(\begin{array}a\\b\end{array})$ blah blah` in one single line. Thanks a lot!


title: Slight change in algorithm

text: This is my MWE for an algorithm however its throwing an error and I don't know how to get inputs and initialize. I want it to look like the attached image.               \documentclass[a4paper,10pt,twocolumn]{article}     \usepackage[utf8]{inputenc}     \usepackage{booktabs,lipsum}     \usepackage{algorithm}     \usepackage{algpseudocode}          \begin{document}     \begin{algorithm}             \caption{Algorithm 2: Boosted $K$ Nearest Neighbor}             \begin{algorithmic}[1]     %         \qinput{Input:} \\     %    \State $S={s_i}={\left(x_i,y_i\right)$              \For{t = 1 to T} \do             \State $S_t \gets S_{t-1}$             \For{$s_q \in S_t$} \do               \State $N_q \gets$ k nearest neighbors                \State of $s_q$ using $D(s_q,s_i)$               \State label($s_q$)$=argmax\sum_{s_i \in N_q}D(s_q,s_i)$;             \If{label($s_q$)$\ne y_q$}                 \For{$s_i \in N_i$} \do                 \If{$y_i \ne y_q$}                   \State $w_{i}^{t} \gets w_{i}^{t} - \lambda/d(x_q,x_i)$;                 \Else                   \State $w_{i}^{t} \gets w_{i}^{t} + \lambda/d(x_q,x_i)$;                 \EndIf                 \EndFor             \EndIf             \EndFor             \If{label($s_q$)$=y_q \forall_{s_q}$}               \State break             \EndIf          \EndFor             \end{algorithmic}     \end{algorithm}     \end{document}      ![](http://i.stack.imgur.com/nLu2y.png)


title: Colored mark in margin notes in the middle of the \marginparsep

text: It's code, thanks for @Harish Kumar,               \documentclass{book}     \usepackage{mathtools}     \usepackage{xcolor}     \definecolor{background}{RGB}{255,255,170}     \usepackage{empheq}     \newcommand*\mybox[1]{%     \colorbox{background}{\hspace{1em}#1\hspace{1em}}}     \usepackage{kantlipsum}     \usepackage[fulladjust]{marginnote}     \setlength{\marginparsep}{5mm}     \setlength{\marginparwidth}{1in}     \begin{document}     \begin{empheq}[box=\mybox]{align}R_A+R_B &=\frac{R_3(R_1+R_2){R_1+R_2+R_3}\marginnote{Some margin note here}     \end{empheq}     \clearpage     \begin{empheq}[box=\mybox]{align}R_A+R_B &=\frac{R_3(R_1+R_2)}{R_1+R_2+R_3}\marginnote{Some margin note here}     \end{empheq}     \end{document}      It's code very well working. That I want add to colored mark in margin notes in the middle of the \marginparsep. Odd page \blacktriangleleft and even page \blacktriangleright. Like that,               \checkoddpage     \ifoddpage     \newcommand{\marginmacro}{\marginnote{ {\color{red}$\blacktriangleleft$} Some margin note here}}     \else     \newcommand{\marginmacro}{\marginnote{Some margin note here {\color{red}$\blacktriangleright$}}}     \fi      That is, add first attach red color **\blacktriangleleft** in the middle of \marginparsep add second attach **margin not** in the \marginnote area in the odd pages. In the other hand, add first attach **margin not** in the \marginnote area, add second attach red color **\blacktriangleleft** in the middle of \marginparsepin the even pages. For example, for odd pages. ![enter image description here](http://i.stack.imgur.com/z3Q7H.png) I'm sure this is a duplicate of another question that I just can't find. So, does anyone know how to fix it?


title: Can a latex IF loop take a perl variable?

text: I have a script written in perl which harvest data from an sql database, then produces a printed report in latex. I was looking to put an IF loop in the latex part of the script to print one set of text if the data existed in the sql database, and a different set of text if it does not. Looks like etoolbox is promising here, but can it take a variable (which I can set to be anything - 1,0,T,F etc)? I found this example on the site which shows how to set up the loop but without a variable (LaTeX conditional expression).               \newtoggle{paper}      which is set with either               \toggletrue{paper}     \togglefalse{paper}      And to use it:               \iftoggle{paper}{%       % using paper     }{%       % electronic     }      EDIT: What I am wondering is if I can use a variable from earlier in my script (e.g. $myo_text) in the eftoolbox toggle. e.g.               \newtoggle{$myo_text}      Or is there another way of doing this? Is it even possible to carry a variable into the latex part of the script **from the sql query** and use it in a conditional loop? EDIT 2: Here is a trimmed latex chunk from my script. Just now it prints out these perl variables just fine ($myo_test, $myo_reporter1 etc).               print FH <<END;          \\textbf{EXERCISE TOLERANCE TEST} \\newline     \\begin{small}     \\textbf{Stress Test:} $myo_test \\newline     \\textbf{Rest ECG:} $myx_rest_ecg \\newline     \\textbf{Stress ECG:} $myx_stress_ecg \\newline       \\textbf{Performed by:} $myx_performed1 \\newline     \\end{small}          \\textbf{Reported By:} $myo_reporter1 \\hspace{2em} \\textbf{Signature:}          \\end{document}               END      I would like to put a loop in this latex chunk that does not print this part of the report if $myo_text is blank/empty.


title: How to generate a separate legend picture?

text: I want to generate a tikzpicture which only contains the legends, and not the plots themselves. I use the following code and it returns an error: `! Package pgfplots Error: Sorry, the supplied plot command is unknown or unsupp orted by pgfplots! Ignoring it..` How to correctly add a legend to an empty axis?               % defining custom colors     \definecolor{mycolor1}{rgb}{0.02,0.06,0.18}     \definecolor{mycolor2}{rgb}{0.048,0.144,0.432}     \definecolor{mycolor3}{rgb}{0.076,0.228,0.684}     \definecolor{mycolor4}{rgb}{0.136,0.328,0.904}     \definecolor{mycolor5}{rgb}{0.388,0.524,0.932}     \begin{tikzpicture}          \begin{axis}[hide axis,legend entries={{111},{222},{333},{444},{555}},     legend columns=-1 ]     \addplot [     color=mycolor1,     solid,forget plot     ]          \addplot [     color=mycolor2,     solid,     forget plot     ]          \addplot [     color=mycolor3,     solid,     forget plot     ]          \addplot [     color=mycolor4,     solid,     forget plot     ]          \addplot [     color=mycolor5,     solid,     forget plot     ]          \end{axis}          \end{tikzpicture}%


title: pgfplots, bar graph, axis distance

text: I have a following chart, and I am trying to decrease the distance between the x-axis ticks FCC and Beta pi. Any suggestions on how to reduce this?               \documentclass{standalone}     \usepackage{pgfplots}     \pgfplotsset{compat=newest}     \usetikzlibrary{decorations.pathmorphing}          \begin{document}     \begin{tikzpicture}     \begin{axis}[     %legend columns=-1,     legend cell align=left,     every axis plot post/.style={/pgf/number format/fixed},     ybar=2pt,     bar width=10pt,     x=5cm,     y=4.5cm,     ymin=0,     axis on top,     %ymax=12,     xtick=data,     %xlabel=Cores,     ylabel=Peak Energy (E),     enlarge x limits=0.2,     %enlarge y limits={abs=0.5},     symbolic x coords={FCC,Beta pi},     %restrict y to domain*=0:11, % Cut values off at 14     visualization depends on=rawy\as\rawy, % Save the unclipped values     after end axis/.code={ % Draw line indicating break     \draw [ultra thick, white] (rel axis cs:0,1.05) -- (rel axis cs:1,1.05);         },     nodes near coords={\scriptsize{\pgfmathprintnumber{\rawy}}         },     axis lines*=left,     clip=false,     area legend     %legend style={at={(0.6,0.8)},anchor=west}     ]     \addplot[fill=red!40] coordinates {(FCC,0.7) (Beta pi,0.66) };     \addplot[fill=yellow!40] coordinates {(FCC,1) (Beta pi,0.81) };     \addplot[fill=blue!40] coordinates {(FCC,0.6) (Beta pi,0.74)};     \addplot[fill=green!40] coordinates {(FCC,0.5) (Beta pi,0.7)};     \legend{x264,bodytrack,swaptions,blacksholes};     \end{axis}     \end{tikzpicture}     \end{document}      ![Unreasonably big empty white space](http://i.stack.imgur.com/2zC5V.png)


title: Box with same vertical height, even when empty

text: I'm trying to draw a vertical box around one or more lines of text (for a field in a pre-filled form), but some of the fields may be empty and in these cases, the box should be the same vertical height as when there is only one line (or even just one character) of content within the box. I am currently defining a `\field` command for this, like so:               \newcommand{\field}[1]{         \framebox[\textwidth][l]{                     \parbox[l]{0.96\textwidth}{                 \raggedright #1 \addvspace{0.1\baselineskip}             }         }     }      But this gives me a 'missing item' error because `\addvspace` isn't in vertical mode. If I add a `\par` to fix this, the box has too much vertical padding after the last line of text. If I remove the `\addvspace` entirely then the box is not tall enough when it contains no text. Could someone please suggest the best way of creating a box, the full width of the page, that is a minimum of one line of text high (even when empty) but can expand to contain multiple lines of text?


title: Latex figure numbering as part a,b,c

text: I am writing an article and I have to display figures side by side. I used the commands from the following link http://tex.stackexchange.com/questions/10245/how-to-order-3-images- horizontally to do that. However, the figures are numbered in sequence, eg. Figure 1, Figure 2 Figure 3. I would like all of them to be part of same figure 1 and have subsections as (a) , (b) and (c).


title: Accents in TeXworks

text: I am using TeXworks to write documents, but as I am doing some stuff in spanish, accents are required. When I write               áéíóú      I get               Ã¡Ã c      If I do `\'a \'e \'i \'o \'u` I get the desired result `áéíóú` I have changed in Edit->preferences->Editor->Coding->ISO-8859-1 instead of UTF-8 but get the same results.


title: Can sgame work together with array?

text: When I insert a game environment provided by "sgame", all the other environments which are related to "array" will break. Here is a MWE:               \documentclass{article}     \usepackage{color,sgame}     \usepackage{array,calc}          \begin{document}     \begin{game}{3}{2}       & F     & O    \\     F & 2, 2  & 0, 1 \\     O & 0, 0  & 1, 3 \\     P & 0, 0  & 1, 3     \end{game}               \begin{tabular}{p{\textwidth - 3cm}|p{1cm}<{foo}}        Caption1 & Caption2\\        Text & \\        Text & \\        Text & \\        % much more rows     \end{tabular}     \end{document}       So can I make game work together with array in my document? Thx.


title: Add Partition to table entrys

text: I want to get a table like this ![http://i.imgur.com/gKZzEem.png](http://i.stack.imgur.com/zdCxd.png) How can I add the small square into the Table entry? My current table looks like this:               \documentclass[a4paper, 12pt] {article}       \usepackage{amsmath}       \usepackage{amssymb}       \usepackage{tabularx}       \begin{document}           \begin{tabular}{c||cccc||cc}           &$W_1$&$W_2$&$W_3$&$W_4$\\           $S_0$&60&-&-&-&60\\           $S_1$&20&50&-&-&70\\           $S_2$&-&10&15&10&35\\           $S_3$&-&-&-&55&55\\           \hline           &80&60&15&65           \end{tabular}       \end{document}


title: Suppress page break before table

text: I have a large, horizontal table that spans multiple pages. LaTeX puts a page break before the table, but I don't want a page break. I want the text to fill the page before the table. I've tried \nopagebreak, but it doesn't work. How can I not allow a page break before the table and fill the page preceding the table with text? Here is a small example:               \documentclass{article}          \usepackage{longtable}     \usepackage{threeparttablex}     \usepackage{lscape}     \usepackage{tabu}          \begin{document}          I do not want a page break here     \nopagebreak          \begin{landscape}       \begin{ThreePartTable}         \begin{longtabu}{X[l] X[l] X[l]} \hline          Column1 & Column2 & Column3            \end{longtabu}       \end{ThreePartTable}     \end{landscape}          I want this text to go before the table          \end{document}


title: Lining up leaf nodes in pstree

text: I am a TeX newbie, trying to make a syntax tree. What I'm going for is this:                       X            / \           X   \          / \   \         X   \   \        / \   \   \       X   \   \   \      / \   \   \   \     A   B   C   D   E     a   b   c   d   e      where the bottom row includes some subscripts. My code is as follows:               \pstree[levelsep=5ex]{ \TR{X} }{       \pstree{ \TR{X} }{         \pstree{ \TR{X} }{           \pstree{ \TR{X} }{             \TR{\shortstack{{\em A}\\a}}             \TR{\shortstack{{\em B}\\b}}           }           \TR{\shortstack{{\em C}\\c}}         }         \TR{\shortstack{{\em D}\\d}}       }       \TR{\shortstack{{\em E}\\e}}     }      Two questions: a) How can I align the leaf nodes at the bottom instead of immediately beneath their mother node? b) The vertical spacing of the things in the `shortstack` is inconsistent (probably by some sort of "if it fits" criterion - if if there's an "j" or a "g" on the upper word, the spacing increases to accomodate the downstroke). Is there a better way of writing things one beneath another that will always have the same vertical spacing? **EDIT** : as requested, minimal example of node-internal formatting problem:               \pstree[levelsep=5ex]{ \TR{Compare:} }{       \TR{\shortstack{h\\j}}       \TR{\shortstack{m\\n}}     }      Notice how higher "h" is compared to "m" ("j" and "n" being level).


title: Color page inside of the set height and width

text: I am trying to make a colored page in LaTeX. But so far, what I have tried colors the entire page. Which I think does not look that good.               \documentclass[10pt,a4paper]{article}     \usepackage{xcolor}     \usepackage{afterpage}     \usepackage{lipsum}     \widowpenalty=300     \clubpenalty=300          \begin{document}          \lipsum[5]          \newpage          \pagecolor{SkyBlue}\afterpage{\nopagecolor}          \lipsum[1]          \newpage          \lipsum[4]          \end{document}      To be able to set the height and width of the colored box would be great. I also have no idea how to make it fit inside of the standard margins. ![Example of pageoutput](http://i.imgur.com/VMQew.png)


title: Change figure caption name only in one figure, not all

text: I saw here Change caption name of figures , by               \renewcommand{\figurename}{Fig.}      but if you do that, it changes all of the figures captions. How to change only some of them? but I have 3 figures, I want default caption for figure 1 and 3, but Photo caption for figure 2. so it should be like, Figure 1, Photo 1, Figure 2.               \begin{figure}            ...           \caption{This is a figure.}     \end{figure}               \begin{figure}             ....            \caption{This is a photo.}     \end{figure}               \begin{figure}            ...            \caption{This is a figure.}     \end{figure}


title: Subscripts for primed variables

text: When I add a subscript to a primed variable, the subscript is rendered lower than when it is a subscript to an unprimed variable. For example, when I compile               $l_x l'_x l_x l'_x l_x l'_x$      I get ![](http://i.stack.imgur.com/DNhQL.png) The subscript x is at a different height for the primed variables and the unprimed ones. Any one have any idea why this is happening? And how I can fix this so that the subscript of the primed variable appears at the same height? (Or am I doing something wrong?)


title: Subscript vertical position dependent on presence of superscript - how to change?

text: > **Possible Duplicate:**   >  Subscripts for primed variables If I have a variable which is always subscripted but only sometimes superscripted, the vertical position of the subscript varies. For instance, `$s^*_i$` and `$s^{}_i$` are different from `$s_i$`. Can I define the subscript such that it is always in the same position regardless of the presence of a superscript?


title: How to use Ubuntu font with TeXLive 2012?

text: I really like the `Ubuntu` sans font, I want it be the section and title font as a replacement of Linux-Biolinum? With Ubuntu 12.04 LTS + Texlive 2012, how to figure this out?


title: Preventing page break after title page

text: I am trying to create a title page for my thesis proposal, which is using the article class. I have the page formatted correctly, but it does not act like the default article title page where the document starts on the title page. Instead, I get the body of the proposal starting on the second page, which is not what I want. Also, it is not sufficient to just put the abstract on the title page; the first section should also start on the title page if there is room. Here is my code right now:               \begin{titlepage}         \begin{center}             {\LARGE Insert Title Here \par}             \vskip 2em             A Master's Thesis Proposal \\             {\tiny by} \\             Christopher J. Lieb \\             \vskip 2em             Thesis Advisor \par             Professor Gary Pollice \par             \vskip 1em             Reader\\             {\Large \makebox[3in]{\hrulefill} \par}             \vskip 1em             {\small                 \today \\                 Department of Computer Science\\                 Worcester Polytechnic Institute\\                 100 Institute Road\\                 Worcester, MA  01609\\}         \end{center}         \par     \end{titlepage}      I am just inserting it right at the beginning of my document environment. I started this from the article.cls where I thought the title page was being created, but apparently I missed the part that gets rid of the page break. How do I make the document start on the title page like the article class does?


title: Is there any possibility to validate a LaTeX file?

text: I want to validate my LaTeX file. I.e. the file should contain only `\textit` not `\it`. i want to validate throughout the file with my style command. is there any possibility to do this?


title: Overbracket with tikz square arrow style

text: I am trying to place text to the right of the brackets so that it doesn't overlap the equation.               \documentclass{amsart}     \usepackage{tikz}     \usetikzlibrary{calc}          \usepackage{amsmath}             \newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}     \tikzset{square arrow/.style={to path={-- ++(0,.25) -| (\tikztotarget)}}}          \begin{document}     \[     =\, -\nu_{gx}\,  \dfrac{\partial \, \left<\tikzmark{a}n\right>}{\partial\,x} \, =\, -\nu_{gx} \, \dfrac{\partial \left<\tikzmark{b}\eta_{0}\right>}{\partial \,x} \, \dfrac{\partial \,T}{\partial \,x}     \tikz[overlay,remember picture]     {\draw[<->,square arrow] ($(a.north)+(0.25em,1.25ex)$) to ($(b.north)+(0.50em,1.25ex)$) node [above,right] {local thermal equilibrium!};}     \]     \end{document}      ![enter image description here](http://i.stack.imgur.com/b6GIc.png)


title: Lining up edges of a tree with TikZ

text: I'm drawing trees with TikZ and               \begin{tikzpicture}         \node {$C$}             child[missing]      child{node {$i$}      child[missing]      child{node {$j$}}         };     \end{tikzpicture} produces edges that don't line up as I want them to. If I were to draw circles around the nodes, an edge goes from the bottom center of the parent's circle to the top center of the child's, making the arm appear jagged. I've tried moving the anchors around, but that wasn't it. What I want seems to occur automatically in the examples in the pgf manual (see the final tree example on page 192). What am I not doing?