title: newcommand, section

text: I just received a new task in LaTex with a predefined structure and predefined commands. There was also the command `\mysection`. I think it shouldn't show the text of the section in the document, but should use it for the headline on each side and for the table of contents:               \newcommand{\mysection}[1]{\refstepcounter{section}\sectionmark{#1}     \addcontentsline{toc}{section}{\numberline{\arabic{section}}{#1}}}      There was an already completed document, and the command was used like this:               \mysection{Die rationalen Zahlen $\Qe_0^+$}      So I think it worked, but when I try to compile, it always shows me the error: > ! Argument of \XKV@d@fine@k@y has an extra }.\par \mysection{Die rationalen > Zahlen $\Qe_0^+$} > > ! Paragraph ended before \XKV@d@fine@k@y was complete.\par \mysection{Die > rationalen Zahlen $\Qe_0^+$} In fact, a friend of mine try to compile it on his mac and it's working. Is it just a missing package? What should I try do fix it?


title: Table with vertical and horizontal text

text: I need to mimic this awful Word table in LaTeX: ![enter image description here](http://i.stack.imgur.com/EJg1y.png) This is as far as I got: ![enter image description here](http://i.stack.imgur.com/rCibw.png) My main problem is that when header text is rotated it doesn't align vertically to the bottom anymore. Any tips? This is what I have so far:               \newcommand\rot[1]{\rotatebox{90}{\textbf{#1}}}     \newcommand\MyHead[2]{\multicolumn{1}{l|}{\parbox{#1}{\centering #2}}}          \begin{tabular}{|p{2.5cm}|l|b{1em}|b{1em}|c|c|c|c|}     \hline       \textbf{Participants}     & \MyHead{1cm}{\textbf{Legal\\Entity\\Short\\Name}}     & \rot{Academic}     & \rot{Non-academic}     & \textbf{Country}     & \MyHead{2.1cm}{\textbf{Dept. / \\Division / \\Laboratory}}     & \textbf{Supervisor}     & \MyHead{2.5cm}{\textbf{Role of\\Partner\\Organisation}} \\     \hline     \underline{Beneficiary} & & & & & & & \\\hline     - NAME  & & & & & & & \\\hline     \underline{Partner} \underline{Organisation} & & & & & & & \\\hline     - NAME  & & & & & & & \\\hline     \end{tabular}


title: Hyperref a subfloat figure

text: Here is a sample code from my document,               \begin{figure}[H]     \centering     \begin{tabular}{cc}     \subfloat[$a=0.2$]{\includegraphics[width=2in]{Chapters/BMethods/figures/Airy_Rings_0.pdf}}~~~~~&~~~~~     \subfloat[$a=1$]{\includegraphics[width=2in]{Chapters/BMethods/figures/Airy_Rings_1.pdf}}\\     \subfloat[$a=2.5$]{\includegraphics[width=2in]{Chapters/BMethods/figures/Airy_Rings_2.pdf}}~~~~~&~~~~~     \subfloat[$a=4$]{\includegraphics[width=2in]{Chapters/BMethods/figures/Airy_Rings_3.pdf}} \\     \end{tabular}     \caption{Airy rings with central Airy disk, constant $\lambda$=1 and with varying aperture factor.}     \label{Airy rings with central Airy disk}     \end{figure}      How can I apply `hyperref` to the `subfloat` figures , so that if I want to refer to just one of the sub figures in specific.


title: New table-environment, spaces and enclosing { } in a new environment

text: It was hard for me to find a proper title (feel free to change it) for my question which I want to introduce with an example: ## Situation In my document I sometimes use `tabu`s directly in the document without nesting them in a `table`-environment.               \documentclass[a4paper, 11pt]{scrbook}     \usepackage{blindtext}          \usepackage{tabu, booktabs}          \begin{document}     \section{TEST}     \blindtext     \\ \\     This is how I want my table to look like:          \ \\     {\centering     \begin{tabu} to 0.9\textwidth {X[l,2] X[l,2] X[l,3]}    \toprule \rowfont{\bfseries}     Test1   &   Test2   &   Test3   \\ \midrule     Test1   &   Test2   &   Test3   \\     Test1   &   Test2   &   Test3   \\ \bottomrule     \end{tabu}\par} \medskip \ \\     \blindtext     \end{document}      Now, I wanted to create a new environment to help me building this table and I tried something like this:               \newenvironment{texttab}[1]         {\ \\ \centering%         \begin{tabu} to 0.9\textwidth {#1} \toprule \rowfont{\bfseries}}%         {\end{tabu}\par \medskip \ \\}      where `#1` gives the `tabu`-specifications of course. It kind of works, but if you run the following MWE (adding and testing the new environment)               \documentclass[a4paper, 11pt]{scrbook}     \usepackage{blindtext}          \usepackage{tabu, booktabs}          \newenvironment{texttab}[1]         {\ \\ \centering%         \begin{tabu} to 0.9\textwidth {#1} \toprule \rowfont{\bfseries}}         {\end{tabu}\par \medskip \ \\}          \begin{document}     \section{TEST}     \blindtext     \\ \\     This is how I want my table to look like:          % no new environment          \ \\     {\centering     \begin{tabu} to 0.9\textwidth {X[l,2] X[l,2] X[l,3]}    \toprule \rowfont{\bfseries}     Test1   &   Test2   &   Test3   \\ \midrule     Test1   &   Test2   &   Test3   \\     Test1   &   Test2   &   Test3   \\ \bottomrule     \end{tabu}\par} \medskip \ \\     \blindtext          \begin{texttab}{X[l,2] X[l,2] X[l,3]}              % WITH NEW ENVIRONMENT     Test1   &   Test2   &   Test3   \\ \midrule     Test1   &   Test2   &   Test3   \\     Test1   &   Test2   &   Test3   \\ \bottomrule     \end{texttab}     \blindtext     \end{document}      you will see that there is an indentation at the begin of the blindtext after the second table. Even adding `\noindent` into the new environment like this               \newenvironment{texttab}[1]         {\ \\ \centering%         \begin{tabu} to 0.9\textwidth {#1} \toprule \rowfont{\bfseries}}         {\end{tabu}\par \medskip \ \\ \noindent}         % added \noindent here      doesn't help as it still leaves some space (which I could remove with `\\!\\!`, but...). This wouldn't be a problem if I could use the `{` and `}` that enclose `{\centering` and `\par}` in the very first code example. However, I cannot put them into the definition of the new environment as this will cause delimiter-problems... I don't want to use the `center`-environment due to unwanted vertical spaces (which seems kinda hilarious at this point of writing...)               \newenvironment{texttab}[1]         {{\\centering%               % } missing!         \begin{tabu} to 0.9\textwidth {#1} \toprule \rowfont{\bfseries}}%         {\end{tabu}\par} \medskip \ \\}      % { missing!      ## Questions   1. **Is there a way to, either, get rid of those "uncontrollable spaces" that appear in the running version, or, make the last piece of code workable?** (I don't want to use a `minipage` here, as I maybe want to make it breakable with `longtabu`.)   2. Then, sticking with the (for now) working "new environment": Why doesn't              \newenvironment{texttab}[2]         {\ \\ \centering%         \begin{#1tabu} to 0.9\textwidth {#2} \toprule \rowfont{\bfseries}}         {\end{#1tabu}\par \medskip \ \\}      work, so that I could easily change the `tabu` into a `longtabu` by setting the first argument `long`?   3. Should I rather try to pack all this into a new _command_ with several arguments?   4. Do you think that maybe the whole idea is...stupid?


title: Abstract environment: interaction between hyperref and acronyms in ettauth.cls

text: I am submitting a paper for a journal that uses class `ettauth.cls`. Inside `abstract` I use some acronyms with the help of `acronym` package. I also load `hyperref` package for the cross-referencing. With that I noticed that `latex` issues the message: `LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.` Even in the end of last run. The `abstract` is defined as follows:               \newcommand{\absize}{\fontsize{11.5pt}{14pt}\selectfont}      \def\volumeyear{0000}      \gdef\copyrightline{Copyright \copyright\ \volumeyear\ John Wiley \& Sons, Ltd.}      \newbox\absbox      \def\abstract{\lrbox\absbox\minipage{\textwidth}%       \normalfont%       {\noindent\sffamily\bfseries\absize{ABSTRACT}}\par\vspace{10pt}\normalsize%       }     \def\endabstract{\copyrightline\endminipage\endlrbox}      And the MWE:               \documentclass{ettauth}          \usepackage[nolist]{acronym}     \usepackage{hyperref}          \begin{document}          \begin{acronym}     \acro{SDR}{Software Defined Radio}     \end{acronym}          \title{Test}     \author{Me}          \begin{abstract}     \ac{SDR}     \end{abstract}     \maketitle               \section{Intro}          \end{document}      The class `ettauth.cls`, maybe downloaded at: http://onlinelibrary.wiley.com/journal/10.1002/(ISSN)2161-3915/homepage/ettauth.cls I think something is missing at the end of `abstract` definition, as this doesn't happen when I use, e.g., `IEEEtran`.


title: What are the names of the characters used in beamer's itemize themes?

text: I know that I can modify an `itemize` environment via `\setbeamertemplate` and either `circle` `square`, `triangle`, `ball`. What's the best way to mix different symbols within the same level of hierarchy? Which are the correct commands to put into the optional arguments below to access the item shapes of `beamer`?               % this does not work as the optional arguments are not the right commands     \begin{itemize}     \item[\circle]  first bullet point     \item[\triangle] second bullet point     \item[\square] third bullet point     \end{itemize}


title: Forcing TikZ minimum size for nodes

text: I have a tree structure consisting of many unlabelled nodes. However, for some reason the nodes are far larger than I would like and appear to have a minimum size below which the `minimum size` key is ignored:               \documentclass{minimal}     \usepackage{tikz}     \usetikzlibrary{shapes}     \begin{document}       \begin{tikzpicture}[root/.style={draw,diamond, minimum size=1mm},                           branch/.style={draw,rectangle},                           leaf/.style={draw,circle, minimum size=1mm},                           level 1/.style={sibling distance=5.5em, level distance=1.5em},                           level 2/.style={sibling distance=2em},                           level 3/.style={sibling distance=1.5em}]      \node [root] {}       child { node[branch] {}        child { node[leaf] {} }        child { node[branch] {}         child { node[leaf] {} }         child { node[leaf] {} }        }       }       child { node[branch] {}        child { node[leaf] {} }        child { node[leaf] {} }        child { node[leaf] {} }       }       child { node[branch] {}        child { node[branch] {}         child { node[leaf] {} }         child { node[leaf] {} }         child { node[leaf] {} }        }        child { node[leaf] {} }        child { node[leaf] {} }       }       child { node[branch] {}        child { node[leaf] {} }        child { node[branch] {}         child { node[leaf] {} }         child { node[leaf] {} }        }        child { node[leaf] {} }      };     \end{tikzpicture}     \end{document}      Although the minimum size for the `root` and `leaf` keys is tiny the nodes are still relatively large.


title: Reference(Source) directly under the caption

text: Is there a way to write the refernce of a figure directly under the Figure? ![enter image description here](http://i.stack.imgur.com/oCicE.png)               \documentclass{article}     \usepackage[ngerman]{babel}     \usepackage{filecontents}     \usepackage[backend=biber, citestyle=authoryear]{biblatex}     \addbibresource{my.bib}     \usepackage{caption}     \usepackage[demo]{graphics}     \usepackage{booktabs}             \begin{filecontents}{my.bib}         @article{somebody-sgt,           ids       =   {someone-sgt},           author    =   {Somebody, Someone},           title     =   {Some Great Title},           journal   =   {Best Journal},           year      =   3019,           pages     =   {32--39},           volume    =   3,           number    =   4}     \end{filecontents}          \begin{document}          \begin{figure}[t!]     \centering     \includegraphics{whatever}     \caption[Test Test,]   {%       \tabular[t]{@{}l@{}}Test Test, 1. Zeile\\%       Test Test 2. Zeile \\%       \hspace{-2.2cm} Quelle:~\cite[S. 23]{somebody-sgt} \endtabular \label{fig:MIMOKanal}}     \end{figure}                              \end{document}


title: How to write a multiline case in latex?

text: I am trying to get the output similar to this: ![First case is an equation spanning two lines.](http://i.stack.imgur.com/sjCpy.png) I have written this code:               \begin{equation}     \text{RHS} \rightarrow       \begin{cases}      \vert 1 \rangle \left[\frac{2\beta}{\sqrt{\alpha^2 + 4\beta^2}}\vert B\rangle  - \frac{\alpha}{\sqrt{\alpha^2 + 4\beta^2}}\vert A \rangle\right] , &D_1\textrm{ clicks, probability $\frac{\alpha^2}{4}$}\\     \vert 2 \rangle\vert A \rangle, &D_2\textrm{ clicks, probability $\frac{\alpha^2}{4}$}\\     \vert \text{scattered} \rangle\vert A \rangle, &\textrm{ no clicks with probability $\frac{\alpha^2}{2}$}     \end{cases}     \end{equation}      And the following is the output: ![The first case becomes too long.](http://i.stack.imgur.com/xbwD1.png) How then, should I modify the code to get the output similar to first image? If I just add a line break in the first case it gives an error. Thank you.


title: TikZ and subfigures in math nodes

text: I have a tikzpicture with a matrix of math nodes. It by itself compiles fine. If I put it in a figure environment, it still compiles fine. However, if i put it in a subfigure environment, it returns that there is a `$` missing. Any ideas? EDIT (@Werner): Here's something that reproduces the problem:               \documentclass{article}     \usepackage{subfig}% http://ctan.org/pkg/subfig     \usepackage{tikz}% http://ctan.org/pkg/pgf     \usetikzlibrary{matrix}     \begin{document}     \begin{figure}     \subfloat[something]{% <---- \subfloat begin       \begin{tikzpicture}[every node/.style={anchor=west}]         \matrix (m) [matrix of math nodes, nodes in empty cells]{           \quad & 1.\quad (x)(Q\supset Fx) & \\           & 2.\quad Q\supset Fx & \textrm{I,\textbf{UI}} & \\           & 3.\quad Q \\           & 4.\quad Fx & 2, 3, \textrm{ M.P.}\\           & 5.\quad (x)Fx & 4, \textrm{ \textbf{UG}} \\           & 6.\quad Q\supset(x)Fx & 3-5, \textrm{ C.P.} \\           & 7.\quad \parbox[t]{2.9cm}{%             $(x)(Q\supset(x)Fx)\supset$\\             $[Q\supset(x)Fx]$} & 1-6, \textrm{ C.P.}\\};         \draw[-stealth] (m-7-2.north east)                      -| (m-1-1.west) |- (m-1-2);         \draw[-stealth] (m-6-2.north east)                      -| (m-3-1.east) |- (m-3-2);       \end{tikzpicture}%     }% <---- \subfloat end     \caption{This is a caption}     \end{figure}     \end{document}


title: Overlay bar plots to do asymmetric errorbars?

text: To illustrate the problem, I use the code from the answer of this link for asymmetric errorbars in pgfplots.               \documentclass{article}      \usepackage{pgfplots}     \usepackage{pgfplotstable}          \pgfplotstableread{     x         y    y-max  y-min     Lighting  0.12 0.31   0.03     Computers 0.06 0.12   0.01      Total     0.07 0.14   0.02     }{\mytable}          \begin{document}         \begin{tikzpicture}[scale=1.3]      \begin{axis} [symbolic x coords={Lighting,Computers,Total},xtick=data]     \addplot+[forget plot,only marks]        plot[error bars/.cd, y dir=plus, y explicit]       table[x=x,y=y,y error expr=\thisrow{y-max}] {\mytable};     \addplot+[only marks,xticklabels=\empty]        plot[error bars/.cd, y dir=minus, y explicit]       table[x=x,y=y,y error expr=\thisrow{y-min}] {\mytable};     \end{axis}      \end{tikzpicture}          \end{document}      I need for my presentation a barplot with asymmetric errorbars. Is it possible to overlay two errorbarplots to draw the error bars? How can it be done?


title: XeTeX (xdvipdfmx) Option to reduce all graphics to 300dpi

text: I am preparing a Document to be downloadable from the web. The original file has some really high resolution images included (png result images, some >1200dpi), so the original file is 23 MB. Using a Standard technique in Mac OS that converted the images to have 300dpi reduced the size to beautiful 4,5 MB, but the fromt matter isn't numbered with i,ii,... anymore. So i would like to get a similar result already with XeTeX (i.e. the xdvipdfmx driver). Is there an option to specify that?


title: tikzipicture have different arrow tip colors in pdf output and dvi output

text: i have the following mwe               \documentclass[tikz,border=4pt]{standalone}     \usetikzlibrary{arrows}     \begin{document}       \begin{tikzpicture}[->,>=angle 45,scale=3,ultra thick]         \draw[help lines] (-.1,-.9) grid (1.1,.1);         \draw[>=triangle 60,fill=red,draw=teal](0,-0.1)--++(1,0);         \draw[>=latex,fill=blue,draw=violet](0,-0.2)--++(1,0);         \draw[>=stealth,fill=blue,draw=violet](0,-0.3)--++(1,0);         \draw[](0,-0.4)--++(1,0);         \draw[draw=cyan](0,-.5)--++(1,0);         \draw[draw=orange](0,-.6)--++(1,0);       \end{tikzpicture}     \end{document}      the compiled pdf file is expected as follows, ![enter image description here](http://i.stack.imgur.com/w7cAp.png) but the compiled dvi file have different arrow tip color, ![enter image description here](http://i.stack.imgur.com/6ofdP.png) after commenting one line               \documentclass[tikz,border=4pt]{standalone}     \usetikzlibrary{arrows}     \begin{document}       \begin{tikzpicture}[->,>=angle 45,scale=3,ultra thick]         \draw[help lines] (-.1,-.9) grid (1.1,.1);         \draw[>=triangle 60,fill=red,draw=teal](0,-0.1)--++(1,0);         \draw[>=latex,fill=blue,draw=violet](0,-0.2)--++(1,0);         \draw[>=stealth,fill=blue,draw=violet](0,-0.3)--++(1,0);         % \draw[](0,-0.4)--++(1,0);         \draw[draw=cyan](0,-.5)--++(1,0);         \draw[draw=orange](0,-.6)--++(1,0);       \end{tikzpicture}     \end{document}      the output pictures are normal and consistant again, ![enter image description here](http://i.stack.imgur.com/wqULb.png) is there anything special about the commented line, or that is just a bug somehow? i was think of exploiting that to change the arrow tip color only without resorting to the advanced `decoration` option. now it seems that changing color of `angle 45` type arrow tip is indeed tricker than `latex/stealth` type.


title: Span text across columns in multicol

text: I am writing a long document with memoir class and multicol package, mostly writing in 2 columns. I am trying to insert a framed text that spans across the two columns, but does not break the flow of text inside the columns. I can end the multicol, insert my framed text, and re-enter the multicol, but it breaks the flow of the text -- as in this answer. Here is an image of what I am trying to achieve: ![enter image description here](http://i.stack.imgur.com/uKXet.png) The text flows from 1's to 4's. The text of A's in the middle does not break the 1-4 flow. Is it possible to do so with multicol?


title: Changing background color of text in Latex

text: How can I make change a text background in LaTeX? For example using Latex code               \textsc{Extra Curricular Achievements}\\      I get ![enter image description here](http://i.stack.imgur.com/6y5pM.png) However, I want the background of this heading to be changed so that it looks like this:- ![enter image description here](http://i.stack.imgur.com/q2nPI.png) I want the background to be extended to the right upto line break. Please ignore the underline in the previous image. Thanks.


title: Multicolumn vspace

text: I am trying to make a trifold brochure, and `vspace` is proving ineffective. Given:               \documentclass{article}          \usepackage[letterpaper,margin=1cm,landscape]{geometry}     \usepackage{multicol}     \usepackage{blindtext}          \begin{document}     \begin{multicol*}{3}          \vspace{2.5in}     \hline     \blindtext     \hline     \columnbreak          \end{multicol*}     \end{document}      It appears how I would expect if I had put in the `multicol*` environment:               \hline     \vfill     \blindtext     \hline     \columnbreak      with the text at the bottom of the page. How do I make `vspace` in `multicol*` appear normally?


title: Bar plot with error bars and two data rows

text: I am already close to the solution I'm searching for. I want this graph http://tex.stackexchange.com/a/35749/38544 with two data rows. Thus I took the code, duplicated the addplot-section and removed the labels:               \documentclass{article}     \usepackage{pgfplots}     \begin{document}               \begin{tikzpicture}     \begin{axis}[         title = {Optimization based upon co-occurences},         xbar,         width=10cm,         xtick={1,...,8},         xticklabels={%             atpB,             atpE,             atpF,             atpH,             atpA,             atpG,             atpD,             atpC},         grid=major,         ]          \addplot[         fill=blue!25,         draw=black,         ybar,         point meta=y,         every node near coord/.style={inner ysep=5pt},         error bars/.cd,             y dir=both,             y explicit     ]      table [y error=error] {     x   y           error    label     1   -0.279535   0.015982 2      2   0.739360    0.031211 4     3   -0.279302   0.017384 1      4   -0.602794   0.022327 1      5   0.487714    0.015970 8      6   -0.294501   0.014923 4      7   0.526527    0.016725 5      8   -0.297469   0.021122 1     \addplot[         fill=red!25,         draw=black,         ybar,         point meta=y,         every node near coord/.style={inner ysep=5pt},         error bars/.cd,             y dir=both,             y explicit     ]      table [y error=error] {     x   y           error    label     1   -0.279535   0.015982 2      2   0.739360    0.031211 4     3   -0.279302   0.017384 1      4   -0.602794   0.022327 1      5   0.487714    0.015970 8      6   -0.294501   0.014923 4      7   0.526527    0.016725 5      8   -0.297469   0.021122 1     };          \draw ({rel axis cs:0,0}|-{axis cs:0,0}) -- ({rel axis cs:1,0}|-{axis cs:0,0});     \end{axis}     \end{tikzpicture}               \end{document}      The bar plot already looks nice, but the error Bars get "stuck" in the middle both bars. ![Plot](http://i.stack.imgur.com/S75We.png)


title: Locally change font style from sfmath to amsmath

text: I am using the package `sfmath`. It is rather hard to explain why, but the reason should not matter for my question. If it is required I can try to explain why I need `sfmath`. Nevertheless, the main message is that it can not be turned off. Although I am using `sfmath`, I do would like to use the typical "a" in the mathmode of `amsmath`. How can I achieve this? Is it possible to change the font style for single words/letter such that I, per command, can change the font style locally when required? For illustration purposes a simple working example looks like this:               \documentclass{article}          \usepackage{sfmath}     \usepackage{amsmath}          \begin{document}          \begin{equation}      a = a     \end{equation}          \end{document}      `sfmath` seems to be overruling `amsmath` as it does not produce the "a" that I would like. The code above results in: ![enter image description here](http://i.stack.imgur.com/USA3V.png) Whereas the lower "a = a" is obtained by turning off `sfmath` in order to illustrate the "a" that I would like to include. Thank you very much!


title: Super and subscripts with \DeclarePairedDelimiter

text: I defined a macro for the supremum norm by               \DeclarePairedDelimiter{\supnorm}{\|}{\|_\infty}      which works nicely. However, as soon as I want to place a superscript like               \supnorm{f}^2      things look funny, as the 2 appears _after_ the infty-sign. However, I would like to look things more like what you get by               \|f\|_\infty^2      Of course, one can achieve this by using               \newcommand{\supnorm}[1]{\|#1\|_\infty}      but then one looses the nice functionality of \DeclarePairedDelimiter, which I really started to like a lot. Any ideas how one can combine the benefits of both?


title: Position a full width logo in scrlttr2 header

text: How can I position a fullwidth logo in the top left corner of my `scrlttr2` document? The following code leaves a small but noticable gap.               \documentclass[12pt,ngerman]{scrlttr2}     \usepackage{babel}     \setkomavar{fromname}{Just me}          \makeatletter     \@setplength{firstheadhpos}{0mm}     \@setplength{firstheadvpos}{0mm}     \makeatother          \firsthead{     \rule{\paperwidth}{3cm}     }          \begin{document}     \begin{letter}{John Doe \\ Berlin}     \opening{Dear John,}          \closing{Mit freundlichen Scherzen,}          \end{letter}     \end{document}      ![scrlttr2](http://i.stack.imgur.com/LIlTP.png)


title: Align text and numeric values by decimal in table body using dcolumn

text: How can I align numeric values in the body of my table by decimal point when some of those values are accompanied by character values? For example, say I wanted to report some standard deviations in a column aligned by decimal point such that each one is enclosed in parentheses. How can I do things like this? **Update** Based on answer by David Carlisle                   \begin{table}[h]         \begin{tabularx}{\textwidth}{lD{.}{.}{7.4}}         \toprule         \multicolumn{1}{c}{Test} & \multicolumn{1}{c}{Test 2} \\         \midrule         Test & \mathrm{abcde}(1.23)\\         Test2 & (4.321)\\         \bottomrule         \end{tabularx}         \end{table}


title: LyX: reduce spacing in TOC

text: Is it possible to reduce line spacing in the Table of Contents? I have tried adding `\singlespacing` before the TOC but I get "Undefined control sequence" I have also tried `\setlength{\itemsep}{0mm}`


title: Text aligning like numbers aligning

text: I am trying to align such that               Some_Text  1. Other Text                       2. Other Text      I used               \begin{align*}     \text{Some_Text}&\text{Other Text}\\     &\text{Other Text}\\     \end{align*}      But it did not work. Here is my Preamble:               \documentclass{book}     \usepackage[paperwidth=500mm,paperheight=50]{geometry}


title: Memoir showtrims breaks auto-pst-pdf

text: I have set of large documents that need to go to printers and I want to show the trim edges. I'm using a large number of pstricks images in the documents (these are science and maths textbooks) so I'm using `auto-pst-pdf` with `pdflatex -shell-escape`. My problem is, when I enable `showtrims` as shown below, the ghostscript step fails and I don't get the PDF file with the images. If I remove `showtrims` it works but of course the trim marks doesn't appear. Is there a way around this besides using `xelatex`? I can use that option but the books take forever to compile.               \documentclass[11pt, a4paper, openright, showtrims]{memoir}          \usepackage{pst-all}     \usepackage{auto-pst-pdf}     \usepackage{lipsum}          % Custom stock paper and page size     \setstocksize{317mm}{230mm}     \settrimmedsize{297mm}{210mm}{*}     \setlength{\trimedge}{\stockwidth}     \addtolength{\trimedge}{-\paperwidth}     \setlength{\trimtop}{\stockheight}     \addtolength{\trimtop}{-\paperheight}     \settrims{0.5\trimtop}{0.5\trimedge}     % set some lengths     \setlength{\sidebarhsep}{1cm}     \setlength{\sidebarwidth}{3.5cm}     \setlength{\headheight}{0pt}     \setlength{\headsep}{0pt}     \setulmarginsandblock{3\baselineskip}{4\baselineskip}{*}     \setlrmarginsandblock{2cm}{5cm}{*}     \setlength{\footskip}{2\baselineskip}     \checkandfixthelayout          \begin{document}     \lipsum[1]          \begin{pspicture}     (1.5,-.5)(8.5,2)     \psline{->}(2,1)(8,1)     \rput[l](2,0){Tail}\psline{->}(2.3,.3)(2,.9)     \rput[r](8,0){Head}\psline{->}(7.7,.3)(8,.9)     \rput(5,1.5){Magnitude}     \psline{|-|}(2,1.3)(8,1.3)     \end{pspicture}          \lipsum[2]          \end{document}


title: How do I import a text file so that it becomes the body text of my LaTeX document?

text: I want to completely separate formatting and content creation. The articles I will write are all plain prose that requires minimum or zero LaTeX formatting. Also, the text file doesn't have the **one-blank-line gap** between paragraphs. They are separated only by one linefeed. **SUMMARY:**   Is there a way to import it roughly like:               \begin{document}       \importtextfile{my_essay.txt}     \end{document}      Can I also tell LaTeX to interpret the _single_ linefeeds as _new paragraph_?


title: Texmaker portable with Miktex portable

text: I am trying to setup texmaker portable to work with Miktex portable. I found instructions here: http://jimstitzel.com/2010/01/configuring-texmaker-usb- with-miktex-portable/. Updating of Miktex doesn't seem to work for me since it keeps searching for packages, so I skipped that step since I didn't think it was necessary. Also, I did not add the tikz files and change the ghostscript and r directories etc since I don't use them anyway. So the only thing I really changed was to change the directories in texmaker to these: > LaTeX: "../MiKTeX/miktex/bin/latex.exe" -interaction=nonstopmode %.tex > > PdfLaTeX: "../MiKTeX/miktex/bin/pdflatex.exe" -interaction=nonstopmode %.tex > > XeLaTeX: "../MiKTeX/miktex/bin/xelatex.exe" -interaction=nonstopmode %.tex > > LuaLaTeX: "../MiKTeX/miktex/bin/lualatex.exe" -interaction=nonstopmode %.tex > > Latexmk: "../MiKTeX/miktex/bin/latexmk.exe" -e "$pdflatex=q/pdflatex > -interaction=nonstopmode/" -pdf %.tex > > Bib(la)tex: "../MiKTeX/miktex/bin/bibtex.exe" % > > Makeindex: "../MiKTeX/miktex/bin/makeindex.exe" %.idx > > dvips: "../MiKTeX/miktex/bin/dvips.exe" -o %.ps %.dvi > > Dvipdfm: "../MiKTeX/miktex/bin/dvipdfm.exe" %.dvi > > ps2pdf: "../MiKTeX/miktex/bin/ps2pdf.exe" %.ps > > metapost: "../MiKTeX/bin/mpost.exe" --interaction nonstopmode > > Dvi Viewer: "../MiKTeX/miktex/bin/yap.exe" -1 -s @%.tex %.dvi However, whenever I compile I get the error that Texmaker "could not start the command" for pdflatex. What could be the issue here? Also, on a sidenote, I noticed that whenever I execute texmaker from a different computer, the settings are lost. I know I can save them and load them each time, but is there no way to do this quicker?


title: Incompatibility of zref-perpage and amsmath

text: If `amsmath` is loaded after `zref-perpage`, `zref-perpage` will not reset counters in each page. What should be done to fix this except changing the loading order:               \documentclass{article}     \usepackage{zref-perpage}     \zmakeperpage{footnote}     \usepackage{amsmath}     \begin{document}     This is a test \footnote{test}     \newpage     This is another test \footnote{test}     \end{document}


title: Multirows, multicolums and vertical centring in the tabu environment

text: I have a table, using the `tabu` environment, in which I would like multirow and multicolumn cells. Inside the cells, any content that doesn't vertically fill the cell should be vertically centred. However, I can't seem to get it to behave sensibly - everything looks slightly jumbled and uncomfortable and some text spills over the cell boundaries. I have tried to use `X[-1,m]` for every column in the column descriptor, without success.               \documentclass{article}          \usepackage{tabu}     \usepackage{multirow}          \begin{document}         \begin{table}             \centering             \caption{Recommendations for treatment }                  \begin{tabu} {X[-1]|X[-1]|X[-1]|X}                 \hline                 T1 & \multicolumn{2}{l|}{N0}  & Radiotherapy or surgery to the primary tumour.\\                 \cline{2-4}                 & N+ & $ <2{cm}$ & Radiotherapy or surgery to the primary tumour and neck.\\                 \cline{3-4}                 &  & $ >2{cm}$ & Radiotherapy or surgery to the primary tumour. Surgery to neck.\\                 \cline{1-4}                 T2 & \multicolumn{2}{l|}{N0}  &  \multirow{3}{*}{\vbox{Radiotherapy or surgery to the primary tumour and neck.}}\\                 \cline{2-3}                 & N+ & $ <2{cm}$ & \\                 \cline{3-4}                 &  & $ >2{cm}$ & Surgery to the primary tumour and neck.\\                 \cline{1-4}                 T3 & \multicolumn{2}{l|}{N0}  & \multirow{3}{*}{\vbox{Radiotherapy or surgery to the primary tumour and neck.}}\\                 \cline{2-3}                 & N+ & $ <2{cm}$ & \\                 \cline{3-4}                 &  & $ >2{cm}$ & Surgery to the primary tumour and neck. Postoperative radiotherapy in selected cases.\\                 \cline{1-4}                 T4 & \multicolumn{2}{l|}{N0} & \multirow{3}{*}{\vbox{Surgery to the primary tumour and neck with planned postoperative radiotherapy to primary site, and to neck if indicated.}}\\                 \cline{2-3}                 & N+ & $ <2 {cm}$ & \\                 & & $>2 {cm}$ &\\                 \hline             \end{tabu}         \end{table}          \end{document}      Result is: ![Result of the above code](http://i.stack.imgur.com/Xv130.png) What is the "right" way to achieve this kind of result in `tabu` enviroments? Or should I be using a different environment?


title: Font Size while using tikz

text: I am trying to write code for a diagram I have in tikz. I am very new to tikz so this may be an easy question but here goes. I have some code like the following:               \begin{tikzpicture}[scale=.95]     \draw [<->, thick] (0,0) coordinate (a_1) -- (2,1.8) coordinate (a_2)node[right]{$\mathcal{M}$};     \draw [<->, thick, color=black!40!blue] (1,0) coordinate (b_1) node[right]{$\mathcal{N}$}-- (1,2) coordinate (b_2);          \coordinate (c) at (intersection of a_1--a_2 and b_1--b_2);     \fill (c) circle (2pt) node[right]{$X$};     \end{tikzpicture}      But the issue I am having is that in more complicated diagrams, the text labels are in too large of font and intersects with lines. How can I make the font in the label nodes smaller?


title: Enumeration in continuous text

text: I am trying to use enumeration in a text. It would look like in this example: > "Among pets the most common ones are (i) dogs, (ii) cats and (iii) rabbits.   >  (i) Dogs are very nice animals. However they need to be walked several > times a day....[continuous long passage spreading over multiple lines] > > (ii) Cats are often considered easier animals but.... > > [...] " I guess I will not need to refer to each passage more than once, so I can also just type out the brackets and the numbers. However, just typing "(ii)" doesn't seem very nice when using LaTeX. Is there an easy and more elegant way to enumerate like in the example?


The following trivial example illustrates my objective to create a converting operator `ptcm` (`pt` to `cm`). Unfortunately, it produces errors in TeX world as opposed to PS world.               \documentclass{beamer}     \usepackage{pstricks}     \usepackage[active,tightpage]{preview}     \PreviewEnvironment{pspicture}     \PreviewBorder=12pt          \SpecialCoor          \begin{document}     \begin{frame}     \begin{pspicture}[showgrid=top](4,4)     \makeatletter     \pstVerb{/ptcm {\pst@number\psunit\space div} bind def}     \makeatother     \psline(!4 12 ptcm sub 0)     \end{pspicture}     \end{frame}     \end{document}      The error messages are:               ! Undefined control sequence.     <argument> /ptcm {\pst                             @number\psunit \space div} bind def     l.17 \end{frame}          ?      ! Emergency stop.     <argument> /ptcm {\pst                             @number\psunit \space div} bind def     l.17 \end{frame}      How to create a new converting operator?


title: which variable controls separation of entries in entry set

text: using `\defbibentryset` and `block=nbpar` I would like to replace the default semicolon by a new line to separate entries in the entry sets. Which `biblatex` variable controls it?


title: Problem with accented characters in ClassicThesis template

text: I've just downloaded the template for ClassicThesis in CTAN and I was trying to use it writing some spanish text. I've only changed the title and name of the document (in the `classicthesis-config.tex` file). The document compiles, but the accented characters (like in 'Teoría') are wrong. Now, I tell you what changes I made that are supposed to prepare the template to recieve accented characters:   * In the `classicthesis-config.tex` file I have the following lines:              \PassOptionsToPackage{utf8}{inputenc}   % latin9 (ISO-8859-9) = latin1+"Euro sign"     \usepackage{inputenc}         (as you see, the author recommends using latin9 encoding, but i'm using TeXworks, which works in utf8. Anyway, neither latin9 nor latin1 work.)              \PassOptionsToPackage{T1}{fontenc} % T2A for cyrillics     \usepackage{fontenc}          \usepackage{textcomp} % fix warning with missing font shapes        * I have the following ones, too, but I think this has nothing to do with the encoding problem:              % Spanish languages need extra options in order to work with this template     \PassOptionsToPackage{spanish,es-lcroman}{babel}     \usepackage{babel}        * And in the `ClassicThesis.tex` file I've put `spanish` option in the `\documentclass`and selected the spanish language via `\selectlanguage{spanish}`, but, as I said, I think this has nothing to do with the encoding, it must be related with the 'Figure', 'Table', etc. stuff. My distribution is MiKTeX 2.9 in Windows 7. PS: I'm compiling with pdfLaTeX.


title: pgfplots: minor ticks starting at 1.5, not 0.5

text: The following code is used to produce the plot below.               \pgfplotsset{         axis equal image,         xtick={1,2,3,4},         ytick={1},         minor y tick num={1},         minor x tick num={1},         xmin=-0.3,          xmax=4.2,          ymin=-0.3,          ymax=2.2,         axis x line=middle,         axis y line=middle,         axis equal image,         xlabel=$t$,         every axis plot/.append style={line width=1pt}     }             (...)               \begin{tikzpicture}         \begin{axis} [ylabel=$s_6(t)$]         \end{axis}     \end{tikzpicture}          ![enter image description here](http://i.stack.imgur.com/sdZNM.png) Now I wonder why there is no 0.5 tick, neither at the X, nor the Y axis. I know that I can manually add them, but then there will be captions as well (which I don't like). Can anyone help me out to explain what wrong assumptions I made or which pitfall I ran into?


title: Vertical line next to a block, across page breaks

text: I'd like to mark examples, in an `example` environment in the text by drawing a vertical bar along the margin. I found a piece of code that uses the `framed` package to do this, but since the content of the environment in a box, this doesn't break across pages. To show the example will continue on the next page, the line should extend vertically a bit further before/after the page break. That shouldn't be a problem using tikz, if one manages to place coordinates at the first/last lines of the environment and at the lines before/after each page break. It looks like Martin Scharrer was working on something like this, but I haven't found if that's ended up in a package by now… In my case, I need support for at most one page break per environment.


title: Math inside tables and formatting

text: I'm trying to make a little summary of mathematic analysis, useful for my university, in LaTeX. I'm stuck in the problem of creating nice table, with alternate colouring containing equations with various alignments. I succeeded in building such a table only with `displaymath` inside a `\parbox`, which doesn't allow equation alignments, but not with `align*`. Here is my code:               \documentclass[a4paper]{article}     \usepackage{multicol}     \usepackage[table]{xcolor}     \usepackage{amsmath}     \usepackage{amsfonts}     \usepackage{lipsum}     \begin{document}         \begin{multicols}{2}         \lipsum[1-3]         % Row color alternating         \rowcolors{1}{gray!25}{white}         \begin{tabular}{c}             \hline             \parbox{\linewidth}{$$f : \mathbb{R} \to \mathbb{Q}$$}\\             \parbox{\linewidth}{$$g : \mathbb{Z} \to \mathbb{C}$$}\\             \parbox{\linewidth}{$$h : \mathbb{R} \to \mathbb{Q}$$}\\             $f(g(x)) = \frac{\pi}{2}$\\                  % This doesn't work             %\begin{align*}&f(g(x)) = \frac{\pi}{2}&&\forall x > 0\end{align*}\\             \hline         \end{tabular}         \lipsum[4-6]         \end{multicols}     \end{document}


title: Frame line width within DefineVerbatimEnvironment

text: I am trying to define an environment which requires a frame line as wide as \textwidth               \DefineVerbatimEnvironment%      {code}{Verbatim}{...,frame=lines,%                    xleftmargin=7pt,fontsize=...}      I am not sure how I could constrain the width of the line?


title: How to create a PDF presentation for each available Beamer theme automatically?

text: Rather than changing the theme by hand and compiling it for each available theme, is there an easier way to do so such that I can get a PDF presentation for each available theme automatically?


title: Tabular environment column specification

text: I am using the `tabular` environment.               \begin{table*}[ht]     \renewcommand{\arraystretch}{1.3}     {\small     \begin{center}     \begin{tabular}{|l||>{\centering\arraybackslash}m{1.6cm}|       >{\centering\arraybackslash}m{1.6cm}|       >{\centering\arraybackslash}m{1.6cm}|}     .     .      I would like to reduce the width of the first column in table. To do so if I use the below:               \begin{tabular}{|l{1.8cm}||       >{\centering\arraybackslash}m{1.6cm}|       >{\centering\arraybackslash}m{1.6cm}|       >{\centering\arraybackslash}m{1.6cm}|}      I get an error               Package array Error:  Illegal pream-token (1.8cm): `c' used.      Am I missing something here? Is there a way to reduce the first column width in the above example?


title: Global legend for multiple figures

text: Similar to this question, I need output as follows but in a neat way. My solution code is not neat any more: I added a dummy `axis` to use its legend. Also the legend must be at top of the page. ![enter image description here](http://i.stack.imgur.com/swhur.jpg) Here its code:               \documentclass{article}     \usepackage{pgfplots}     \newcommand{\realplot}[1]{     \begin{tikzpicture}         \begin{axis}             \addlegendimage{empty legend}\addlegendentry{Matrix #1}             \addplot {0};             \addplot {1};             \addplot {2};             \addplot {3};         \end{axis}     \end{tikzpicture}}     \begin{document}     \begin{figure}[ht]     \realplot{1}\realplot{2}\realplot{3}     \realplot{4}\realplot{5}\realplot{6}     \begin{tikzpicture} % here starts the dummy tikzpicture         \begin{axis}[             legend columns=4,              legend style={%                 at={(-100,-100)},%                 anchor=north east,%                 at={(axis description cs:1,10),%             },%             /tikz/column 2/.style={column sep=5pt,},},]             \addplot {0};             \addlegendentry{Method A}             \addplot {0};             \addlegendentry{Method B}             \addplot {0};             \addlegendentry{Method C}             \addplot {0};             \addlegendentry{Method D}         \end{axis}     \end{tikzpicture}     \end{figure}     \end{document}


title: add mult, etc in LaTeX

text: I tried to see how `mult`, `div`, `add`, etc work but I am unable to understand what is going on in one concrete example. Say i want to put a point at x = y = 2 but the x and y coordinate come from some complicated geometric computation. The following code snipped does this:               \begin{pspicture}[showgrid=true](0,0)(5,5)     \pnode(!0 2 add 2){C}     \psdot(C)     \end{pspicture}      However, I am absolutely confused about what is going on: a point consists of two parts of information, x- and y-coordinate. The most intuitive thing I would expect is               \pnode(!0 2 add, !0 2 add){C}      but this produces an error. So it took me some time to figure out that               \pnode(!0 2 add 0 2 add){C}      does what I want. My question: What is going on? Why do people code it like this? This is not intuitive, it is *ANTI*intuitive :-) Is there some sense in this that I cannot see right now?


title: How can I use the same parameter for \Tree and \exi

text: The `qtree` package permits drawing syntactic trees with a syntax like this:               \ex. \Tree [.S [.NP This ] [.VP [.V is ] [.NP an example ]]]      The `linguex` package typesets bracketed expressions with a similar syntax:               \exi. [S [NP This ] [VP [V is ] [NP an example. ]]]      As you see, the only difference is that the labels in `\Tree` command (S, NP, VP etc.) are preceded by a dot. Now, I want to write a macro which gets such an argument and first produces a bracketed expression with `\exi.` and then a tree with `\Tree`. In order to achieve this I tried to define the following macro, which would add dots after the [ bracket:               \newcommand{\dotify}[1]{\catcode`[=13 \def[{\[.} {#1} \catcode`[=12}      This doesn't work, however. Could anyone help me out with this? Or maybe there is a simpler way to achieve my goal?


title: How to set lines, arrows and text in this block diagram on tikz?

text: Im quite new learning tikz, it rocks!. Well, Im trying to get the following block diagram working, but having kinda trouble: ![Image that I want](http://i.stack.imgur.com/vzEWc.png) And this is what I got so far:               \documentclass[12pt,a4paper]{article}     \usepackage{tikz}          \begin{document}     \begin{figure}     \begin{center}     \begin{tikzpicture}[arr/.style={->,thick}, line/.style={thick},     nonterminal/.style={rectangle, minimum size=12mm, very thick, draw=black!50!black!50, top color=white, bottom color=blue!50!black!20}, >= triangle 90, font = \small     ]          \matrix[row sep=20mm,column sep=5mm] {     % First row:     \node (ic)  [nonterminal] {$\begin{array}{cc}Impedance\\control \end{array}$}; &     \node (id)  [nonterminal] {$\begin{array}{cc}Inverse\\dynamics \end{array}$}; &     \node (rme) [nonterminal] {$\begin{array}{cc}Robot \: manipulator\\and \: environment \end{array}$}; & \\     % Second row:     & \node (dk) [nonterminal] {$\begin{array}{cc}Direct\\kinematics \end{array}$}; & \\     };          \draw [->] (ic) -- (id)  node[pos=0.5, above] {$\alpha$};     \draw [->] (id) -- (rme) node[pos=0.5, above] {$\tau$};     \draw [->] (rme.15)   -- ++ (1.8,0)   node[pos=0.3, above, yshift = -2] {$h_{e}$} -| ++ (0,-5) -| (ic.230);     \draw [->] (rme.0)    -- ++ (1.2,0)   node[pos=0.4, above, yshift = -2] {$q$} -| ++ (0,-3.50) --   (dk.-10);     \draw [->] (rme.-15)  -- ++ (0.6,0)   node[pos=0.8, above, yshift = -2] {$\dot{q}$} -| ++ (0,-2.50) -- (dk.10);     \draw [->] (dk.170)   -- ++ (-1,-0) node[pos=0.5, above, yshift = -3] {$p_{e} \, R{e}$}  -| (ic.310);     \draw [->] (dk.190)   -- ++ (-1.4,-0) node[pos=0.7, above, yshift = -3] {$v_{e}$} -|  (ic.270);               \end{tikzpicture}          \end{center}          \end{figure}     \end{document}      Well there are a couple of things, I don´t know how to do: 1) How to make double lines on the text inside the boxes for better fitting? **Solved, with arrays for multilines. Is there another way to do this?** 2) How do I properly draw the lines and arrows? Still need to draw left and right arrows for the first and last block... 3) How to place text? Kinda solved. I appreciate all of your answers.


title: How to decompose a number

text: I'd like to define a command (namely `\myproduct`) with two arguments so that when I call it as `\myproduct{125}{497}` for example, the result would be 3 new commands for each argument, like this:               \ci=1     \di=2     \ui=5     \dii=4     \cii=9     \uii=7      so that I could use each one inside `tikz` pictures as coordinates. More precisely, I'd like to factor both numbers as `100+20+5` and `400+90+7` and save each number on a command. ## Just to exemplify The purpose was to draw this ![enter image description here](http://i.stack.imgur.com/FFxQ1.png) I'm improving the code to show the intersections. Maybe I'll post it on TeXample.net. The actual code is below. The problem is that it works only for numbers with 3 digits, including leading zero (that is, 98 produces error, but 098 does not).               % !TeX spellcheck = en     % !TeX encoding = utf8     % !TeX program = pdflatex     % Author: Thiago de Melo     % www.rc.unesp.br/tmelo     \documentclass[12pt]{report}     \usepackage[a4paper,landscape,margin=2cm]{geometry}     \usepackage{tikz}          \newlength{\numberspace}     \setlength{\numberspace}{40mm}     \newlength{\linelength}     \setlength{\linelength}{110mm}          \definecolor{centscolor}{rgb}{1,0,0}     \definecolor{dozenscolor}{rgb}{0,1,0}     \definecolor{unitscolor}{rgb}{0,0,1}          \newcount\total     \def\myproduct#1#2{\xmyproduct#1#2}     \def\xmyproduct#1#2#3#4#5#6{%     \def\numberi{#1#2#3}     \def\numberii{#4#5#6}     \def\centsi{#1}%     \def\dozensi{#2}%     \def\unitsi{#3}%     \def\centsii{#4}%     \def\dozensii{#5}%     \def\unitsii{#6}%     \total=#1#2#3     \multiply \total by #4#5#6     }          %%%%%%%%%      % insert numbers with 3 digits including 0          \begin{document}\pagestyle{empty}%     \myproduct{645}{298}%     \centering     %     \begin{tikzpicture}[rotate=-45,thick]     \expandafter\ifnum\centsi>0      \foreach \c in {1,...,\centsi}{%     \draw[centscolor,xshift=3*\c mm] (0,0)--+(0,\linelength);     }     \expandafter\ifnum\centsi>1      \draw[centscolor,yshift=-3mm,|-|] (3mm,0) --node[rotate=-45,below=2mm] {$\centsi$}  (3*\centsi mm,0);      \else     \draw[centscolor] (3mm,0) node[rotate=-45,below=5mm] {$\centsi$};      \fi\else \fi          \expandafter\ifnum\dozensi>0      \foreach \d in {1,...,\dozensi}{%     \draw[dozenscolor,xshift=3*\d mm] (\numberspace,0)--+(0,\linelength);     }     \expandafter\ifnum\dozensi>1     \draw[dozenscolor,yshift=-3mm,|-|] (\numberspace+3mm,0) --node[rotate=-45,below=2mm] {$\dozensi$}  (\numberspace +3*\dozensi mm,0);      \else     \draw[dozenscolor] (\numberspace+3mm,0) node[rotate=-45,below=5mm] {$\dozensi$};      \fi\else \fi          \expandafter\ifnum\unitsi>0      \foreach \u in {1,...,\unitsi}{%     \draw[unitscolor,xshift=3*\u mm] ( 2\numberspace,0)--+(0,\linelength);     }     \expandafter\ifnum\unitsi>1      \draw[unitscolor,yshift=-3mm,|-|] (2\numberspace+3mm,0) --node[rotate=-45,below=2mm] {$\unitsi$}  (2\numberspace + 3*\unitsi mm,0);     \else     \draw[unitscolor] (2\numberspace+3mm,0) node[rotate=-45,below=5mm] {$\unitsi$};      \fi \else \fi           %%%          \expandafter\ifnum\centsii>0      \foreach \c in {1,...,\centsii}{%     \draw[centscolor,yshift=3*\c mm] (0,0)--+(\linelength,0);     }     \expandafter\ifnum\centsii>1      \draw[centscolor,xshift=-3mm,|-|] (0,3mm) --node[rotate=45,above=2mm] {$\centsii$}  (0,3*\centsii mm);      \else     \draw[centscolor] (0,3mm) node[rotate=45,above=5mm] {$\centsii$};      \fi \else \fi               \expandafter\ifnum\dozensii>0      \foreach \d in {1,...,\dozensii}{%     \draw[dozenscolor,yshift=3*\d mm] (0,\numberspace)--+(\linelength,0);     }     \expandafter\ifnum\dozensii>1     \draw[dozenscolor,xshift=-3mm,|-|] (0,\numberspace+3mm) --node[rotate=45,above=2mm] {$\dozensii$}  (0,\numberspace +3*\dozensii mm);      \else     \draw[dozenscolor] (0,\numberspace + 3mm) node[rotate=45,above=5mm] {$\dozensii$};      \fi \else \fi          \expandafter\ifnum\unitsii>0      \foreach \u in {1,...,\unitsii}{%     \draw[unitscolor,yshift=3*\u mm] (0,2\numberspace)--+(\linelength,0);     }     \expandafter\ifnum\unitsii>1      \draw[unitscolor,xshift=-3mm,|-|] (0,2\numberspace+3mm) --node[rotate=45,above=2mm] {$\unitsii$}  (0,2\numberspace + 3*\unitsii mm);     \else     \draw[unitscolor] (0,2\numberspace+3mm) node[rotate=45,above=5mm] {$\unitsii$};      \fi \else \fi               \begin{scope}[xshift=-1cm,yshift=-1cm]     \node[inner sep=0pt]  at (0,0)[left=1cm]       {\large $\times$};     \node[inner sep=10pt] at (0,0)[below left] {\large $\numberi\searrow$};     \node[inner sep=10pt] at (0,0)[above left] {\large $\numberii\nearrow$};     \end{scope}     \node[inner sep=0pt] at (\linelength,\linelength)[right=1cm] {\large $=\the\total$};     \end{tikzpicture}          \end{document}


title: Where is the auto correction in TeXnicCenter

text: I was looking for the auto correction in TeXniCenter, and found a ticket from 2009 here: http://sourceforge.net/p/texniccenter/user-reports/1066/ Tino Weinkauf said: "It is already in our feature list" but I can't find it anywhere. Am I blind, or is it actually missing? I want that, everytime I type `nm$`, it changes to `\,$nm`. Is there any possibility to do that?


title: Can someone explain how to fix this error when trying to add a picture?

text: I am trying to add a picture using:               \begin{figure}[!h!t]         \centering             \includegraphics[width=90mm]{Hollywood and Beverly Hills}         \caption{Hollywood and Beverly Hills}         \label{fig: h&bh}     \end{figure}       but am getting the error:               ! Argument of \@xfloat has an extra }.     <inserted text>                      \par      l.15 \begin{figure}[!h!t]          ?      I want it so that the picture appears at the beginning of the document in a section that is not twocolumn, so I tried using two @columnfalse but I can't get it to work. Here is a minimal example of my document:               \documentclass[twocolumn,12pt]{article}     \usepackage{graphicx}     \usepackage{setspace}     \doublespacing          \begin{document}          \pagestyle{plain}     \twocolumn[     \begin{@twocolumnfalse}     \begin{center}     \section*{Neighborhoods}     \end{center}               \begin{figure}[!h!t]         \centering             \includegraphics[width=90mm]{neighborhoods}         \caption{Hollywood and Beverly Hills}         \label{fig: hbh}     \end{figure}           \vspace{.25 in}     \end{@twocolumnfalse}]          \section*{Hollywood}          \section*{Beverly Hills}          \end{document}      Can someone help me fix this?


title: longtable: how to avoid duplicated midrules below table title?

text: I want to typeset a longtable which is structured by `midrules`, as the rows are divided in groups. If it happens (which is in general desirable!) that a group is not split by a page break, in other words a new page of the table starts with a new group, I have duplicated `midrules` as there is one from the headline definition and one from the table code. See following example:               \documentclass{scrbook}          \usepackage{booktabs, longtable}          \begin{document}          here comes the table with the pagebreak          \vspace{0.6\textheight}                    \begin{longtable}{p{2cm}p{2cm}p{2cm}l}          \toprule     A & B & C & D\\     \midrule     \endfirsthead          \mbox{table continued from last page}\\     \toprule     A & B & C & D\\     \midrule     \endhead     \bottomrule     \mbox{to be continued on following page}     \endfoot     \bottomrule     \endlastfoot          a & b & c & d\\      & b & c & d\\      & b & c & d\\      \midrule     a & b & c & d\\      & b & c & d\\      & b & c & d\\      \midrule      a & b & c & d\\      & b & c & d\\      & b & c & d\\      \midrule      a & b & c & d\\      & b & c & d\\      & b & c & d\\     \midrule     a & b & c & d\\      & b & c & d\\      & b & c & d\\      \midrule     a & b & c & d\\      & b & c & d\\      & b & c & d\\      \midrule     a & b & c & d\\      & b & c & d\\      & b & c & d\\      \midrule     a & b & c & d\\      & b & c & d\\      & b & c & d\\      \midrule     a & b & c & d\\      & b & c & d\\      & b & c & d\\      \midrule     a & b & c & d\\      & b & c & d\\      & b & c & d\\     \end{longtable}          \end{document}      ![enter image description here](http://i.stack.imgur.com/AArr9.png) ## Questions:   * Is there a way to make `LaTeX` automatically ignore a second `midrule`?    * another way could be to define the table _head_ without `midrule` and only allow pagebreaks before the `midrules` - how could I do that?


title: ConTeXt: Height fitting with row spanning in a table

text: How can I shrink the `height` of the foo cell to fit its content?               \starttext          \startTABLE         \NC foo \NC[nr=2]\input knuth   \NC \NR         \NC bar \NC                         \NR     \stopTABLE          \stoptext      ![enter image description here](http://i.stack.imgur.com/aEXzH.png)


title: mdframed package conflicting with \bgroup, \egroup

text: I'm using XeLaTeX because of language problem. The following code has no problem:               \documentclass{article}          %\usepackage{mdframed}          \newenvironment{mynote}{\footnote\bgroup}{\egroup}     \begin{document}     Hello\begin{mynote} world\end{mynote}.     \end{document}      However, the following code gives an error:               \documentclass{article}          \usepackage{mdframed}          \newenvironment{mynote}{\footnote\bgroup}{\egroup}     \begin{document}     Hello\begin{mynote} world\end{mynote}.     \end{document}      What is the reason for the error and how can I resolve it?


title: Including pictures in subdirectories with standalone package

text: After using `standalone` package extensively, I ran into one problem, which I cannot solve. The problem is that I need to include a TikZ picture in main files subdirectory. What is more I want to build it with standalone `mode = buildnew`. Consider the following filetree:               /mwe.tex     /sub/mwefig.tex      File `mwe.tex` contains the following:               \documentclass{article}     \usepackage{standalone}     \usepackage{tikz,pgfplots}     \standaloneconfig{mode=buildnew}     \pgfplotsset{compat=newest}          \begin{document}     Time is money!          \includestandalone{sub/mwefig}          \end{document}      And the file `mwefig.tex` contains the following code:               \documentclass{standalone}     \usepackage{tikz,pgfplots}     \pgfplotsset{compat=newest}          \begin{document}          \begin{tikzpicture}     \draw (0,0) circle (2);     \end{tikzpicture}          \end{document}      After execution of `mwe.tex` I would expect `mwefig.tex` to be built, which would result in `mwefig.pdf` file created in `/sub/` directory, which could then be used for later compilations. What I rather get is a warning: `Package standalone Warning: Graphic 'sub/mwefig.pdf' could not be build.` Even though, the main PDF is produced containing the required graphics. I also noticed, the `mwefig.pdf` file is actually created, however in a separate directory and with different name:               /sub'/mwefig'.pdf      So after compilation I have the following filetree (excluding aux and log files):               /mwe.tex     /mwe.pdf     /sub/mwefig.tex     /sub'/mwefig'.pdf      I am probably using something wrong, so if anyone could give any hints on how to solve this problem I would be very grateful. (Note: `\--enable-write18` is enabled, MikTex 2.9)


I started using `showkeys` in one of my documents and see this error               \pdfendlink ended up in different nesting level than \pdfstartlink      A bit of google suggests that this "happens when hyperref is used under pdftex and a citation splits across a page boundary". (See: http://tug.org/errors.html). But this package is only useful at drafting stage where the text is changing frequently i.e. the chance of the error is high. Is there a general way to smoothly use `showkeys` with `hyperref`? Thanks.


title: If you know errors occurred in article & minimal, which one will you use for the subsequent attempts in troubleshooting?

text: Assume that > For the first and second investigation you know errors occurred when using > article and minimal. Which one will you use for the subsequent investigation, `article` or `minimal`?


title: biblatex-biber: Segmentation fault (core dumped)

text: I noticed some time ago that `biber` seem to have stopped working for me: Example taken from here:               \documentclass[]{article}          \usepackage[autostyle]{csquotes}          \usepackage[     backend=biber,     style=authoryear-icomp,     sortlocale=de_DE,     natbib=true,     url=false,      doi=true,     eprint=false     ]{biblatex}     \addbibresource{biblatex-examples.bib}          \usepackage[]{hyperref}     \hypersetup{     colorlinks=true,     }          %% ##############################     \begin{document}     Lorem ipsum dolor sit amet~\citep{kastenholz}.     At vero eos et accusam et justo duo dolores et ea rebum~\citet{sigfridsson}.     \printbibliography      \end{document}      Results in > fish: Job 1, “biber test.bcf” terminated by signal SIGSEGV (Address boundary > error) or in `zsh` > [1] 21077 segmentation fault (core dumped) biber test.bcf ![Rendered pdf](http://i.stack.imgur.com/31FDr.png) Do you have any idea why this happens? I'm running out of ideas... Thanks for any suggestions in advance! * * * Edit: Maybe I should add that I'm using a freshly installed `biblatex-biber 1.8-2` with all the up-to-date perl-dependencies in AUR.


title: Swap definition of starred and non-starred command

text: I don't like the fact that I am required to use `\abs*` when I want the vertical line of the absolute value to automatically re-size. I pretty much always want it to re-size, so would like to swap the definition of the two commands, but not sure how to do that. My attempt below is commented out as it does not compile. I can't think of a case where I'd want to use the version that does not resize, but in case some corner case arises in the future I don't want to loose that. Or, is there a good reason to not to do this swap, and go and change all occurrences of `\abs` to `\abs*`.               \documentclass{article}          \usepackage{amsmath}     \usepackage{mathtools}          \DeclarePairedDelimiter\abs{\lvert}{\rvert}          %\let\oldabs{\abs}%     %\let\oldabs*{\abs*}%     %\let\abs{oldabs*}%     %\let\abs*{\oldabs}%          \begin{document}     Not sure why this is the default behavior, but it is:     \[\abs{\frac{1}{2}}\]          Would prefer to get this behavior using \textbackslash{abs},     instead of having to use \textbackslash{abs*}.     \[\abs*{\frac{1}{2}}\]     \end{document}


title: Floating image spanning over newpage

text: I m wiring one report in which i need to add images in each section. Each section start on new page but i found when there is not enough space on one section, image float to another section and there is no more new page. How can i keep image within the section so that it can not float to next section (page break).                  <Section1>             some text xyz            image1        </Section1>        \newpage        <Section2>             Some Text ABC            image2        </Section2>      In the above example is image1 is bigger than space left for section1, it floats to section2 and image remove pagebreak. How can i control it?


title: Bibliography with TexnicCenter

text: Recently I got the latest version of TexnicCenter version 2.0.2 (Stable) and I realised there is a new feature where "bibliography" is shown below: ![enter image description here](http://i.stack.imgur.com/FMo2y.png) When putting the mouse "bibliography", we get this: ![enter image description here](http://i.stack.imgur.com/A7UrR.png) What is this function used for? I assume it means I can search for my bibliography entries in my .bib file? However, how do I get texniccenter to detect my .bib file? Currently, I cite references in the following steps:   1. Put my .bib file in the same folder as my .tex file. Assume my .bib file is called 'bibliography.bib'. I also put apa-good.bst in the same folder as my .tex file.   2. To use this .bib file, at the end of my .tex file I write: > >     \bibliographystyle{apa-good} >     \bibliography{bibliography} >   However, this method is quite cumbersome as everytime when I have a new .tex file, but need to call upon references in my .bib file, I have to copy the 'bibliography.bib' file into the new folder where I have my new .tex file (along with apa-good.bst) and add in new references. I was wondering is there a way to have a "central hub" where I can just leave my bibliography.bib file, add entries to it, but can use it on ANY .tex file located anywhere on my computer?


title: How do I arrange 2 subfigures on top of 1 subfigure?

text: I'd like the arrange these figures so there are two figures next to each other and one below, like an upside down triangle, so that they all fit on one page and are a reasonable size. How do I do this?               \begin{figure}[H]     \centering        \begin{subfigure}[H]{0.75\textwidth}        \centering        \includegraphics[width=0.75\linewidth]{dragratio}        \caption{}        \label{fig:dragratio}      \end{subfigure}          \begin{subfigure}[H]{0.75\textwidth}        \centering        \includegraphics[width=0.75\linewidth]{dragratio2}        \caption{}        \label{fig:dragratio2}     \end{subfigure}          \begin{subfigure}[H]{0.75\textwidth}        \centering        \includegraphics[width=0.75\linewidth]{dragratio3}        \caption{}        \label{fig:dragratio3}     \end{subfigure}     \centering     \caption{(a) Numerical solutions for the constant-curvature body, $F(x)=x(1-x), x \in (0,1)$, at small times. This figure shows the drag force $D$ versus the scaled mass $M$ for various values of the ratio between the inertia $I$ and the mass $M$, i.e. for various values of $R=\frac{I}{M}$. Here $g=10$ and $A=0.7$. (b) As for (a) but with $A=0.5$. (c) As for (a) and (b) but with $A=0.25$.}     \end{figure}


title: Where do I save my files to be imported into TeXShop?

text: I'm new to TeXShop. I have a jpeg called "figure1" in my folder containing my TeX files. Yet, when I hit "Typeset" I get an error that the file isn't found. What can I do?               \documentclass[reprint, amsmath,amssymb, aps,]{revtex4-1}          \usepackage{graphicx}     \usepackage{caption}     \usepackage{subcaption}          \begin{document}          \begin{figure}     \centering     \begin{subfigure}{.5\textwidth}       \centering       \includegraphics[width=.4\linewidth]{figure1}       \caption{A subfigure}       \label{fig:sub1}     \end{subfigure}%     \begin{subfigure}{.5\textwidth}       \centering       \includegraphics[width=.4\linewidth]{figure2}       \caption{A subfigure}       \label{fig:sub2}     \end{subfigure}     \caption{A figure with two subfigures}     \label{fig:test}     \end{figure}          \end{document}


title: how to draw a hexagonal grid with numbers in the cells

text: The problem of drawing hexagonal grids has been discussed here: Drawing Hexagons I want the shape of the grid to be hexagonal and furthermore, I want to be able to add numbers in the hexagonal cells. Any idea?


title: XeTeX, microtype and fontspec

text: I am using XeTeX from TL2010 with microtype 2.5 beta and fontspec. My main font is Linux Libertine O. I do not see a single difference with and without including the microtype package. Am I doing something wrong, is there a better way to optimize character protrusion in XeTeX to get nicer paragraphs and spend less time fixing overfull lines? This is what I'm doing:               % This line doesn't change anything at all     \usepackage[protrusion=true,final]{microtype}     \usepackage{fontspec}     \usepackage{xunicode}         \setmainfont[Mapping=tex-text]{Linux Libertine O}                                    % other fonts and settings...      The logs do indicate that microtype seems to work:               LaTeX Info: Redefining \microtypecontext on input line 54.                           Package microtype Info: Character protrusion enabled (level 2).                      Package microtype Info: Using default protrusion set `alltext'.                      Package microtype Info: No adjustment of tracking.                                   Package microtype Info: No adjustment of spacing.                                    Package microtype Info: No adjustment of kerning.        **Edit:** Actually, protrusion does work properly it seems, but it doesn't seem to help with overfull lines. Does protrusion not help with it, and is it only font expansion that helps with overfull lines?


title: Determine height and depth of letters relative to the font size

text: I would like to scale graphical elements (like images, `tikz` and `tikz- timing` diagrams) relative to the font size, so that they have the same height as an normal uppercase letter (i.e. `X` or `M`; I noticed they have about the same height, but the tip of `A` is slightly higher). I also sometimes like to do this with the normal letter depth (e.g. the depth of `y` or `g`). I know that besides the possibility to use the `ex` or `em` units for font size relative length (1.6ex =~ height of `X`), the current font size is stored inside `\f@size` as string length with the `pt` stripped. So for normal 10pt font it contains `10`. There is also `\ht\strutbox` and `\dp\strutbox` which are `.7\baselineskip` and `.3\baselineskip`, respectively, which in turn is about 1.2x the font size. However, a `\rule{1pt}{10pt}` is significant higher than a 10pt `X`. This is not that surprising, because `\ht\strutbox` (which is anyway supposed to by higher than `X`) is 10pt x 1.2 x 0.7 = 8.4pt in size. **Question:** How is the actual letter height and depth calculated if the font size is known? Is this always a constant factor? Is this font dependent? I would like to avoid to have to box an `X` and measure its size, but this would be plan B.


title: Little indentation despite \noindent after tabu custom-environment

text: this question is about a (to me) mysterious little indent (looks like an ordinary blank...) after a custom-environment using the `tabu`-environment. Please compile this MWE:               \documentclass[a4paper, 11pt]{scrbook}     \usepackage{blindtext}     \usepackage[cm]{fullpage}          \usepackage{tabu, booktabs}          \newenvironment{texttab}[1]{                 \par\centering                 \begin{tabu} to 0.9\textwidth {#1} \toprule \rowfont{\bfseries}}                 {\end{tabu}\par\noindent}          \begin{document}     \section{TEST}     \blindtext     %     \begin{texttab}{X[l,2] X[l,2] X[l,3]}     Test1   &   Test2   &   Test3   \\ \midrule     Test1   &   Test2   &   Test3   \\     Test1   &   Test2   &   Test3   \\ \bottomrule     \end{texttab}     %     HERE HAPPENS INDENT\blindtext     \end{document}      * * * Following the answers from similar questions I put `%` into the blank lines and `\noindent` works fine here. However, there is this little blank-like indentation of the paragraph after the table. I figured out that I can make it disappear when adding a `%` after the `\end` part in the text, so:               <table content> \\ \bottomrule     \end{texttab}% (!)     %     NOINDENT THIS TIME...      * * * Please explain; how is this? Can I somehow include the solution into the definition of the environment or is it necessary to put that `%` everytime I use this environment?


title: How to make \ref display only subsection

text: I am using the revtex4 package and wanted to change the section numbers to arabic for all levels. Furthermore, I wanted the sections to be displayed as 1.2. (as opposed to 2. only). I only use sections and subsections, so I did the following:               \def\thesection{\arabic{section}}     \def\thesubsection{\thesection.\arabic{subsection}}      Now the sections and subsections are displayed how I want them. However, referencing subsections is now broken. It displays like this ( **edited example** ):               \documentclass[twocolumn,pre,floats,aps,amsmath,amssymb,a4,floatfix]{revtex4}     \usepackage{acronym}     \usepackage[english]{babel}          \setcounter{secnumdepth}{3}     \pagenumbering{arabic}     \def\thesection     {\arabic{section}}     \def\thesubsection  {\thesection.\arabic{subsection}}          \begin{document}          \section{First Section}          \subsection{A Subsection}     \label{sub:example}     And then some text.          \section{Second Section}     Let's ref Section \ref{sub:example}.          \end{document}      ![what gets displayed](http://i.stack.imgur.com/uEYMH.png) ... instead of `1.1`. I see two resolutions, but don't know how to go about any of them:   1. Change the display numbers of sections in a smarter way, OR   2. Change what \ref displays (so that it displays only the subsection when subsections are referenced. How can I achieve any of these, or is there another way?


title: Using Bibtex with LyX help

text: I am currently using LyX, and I have a .bib file with all of my BibTeX references. Everything seems to work fine at first, but then goes terribly wrong when I try to view the pdf. I have added the .bib file in LyX by going: `Insert -> List/TOC -> Bibtex Bibliography` and it seems to work perfectly fine. When I click `Insert -> Citation`, all of my references appear, and I can click them easily and put them where I like. Now here is the strange part: Lets say for example that I cite two different papers in my LyX document, and then view it as a pdf. Where I referenced the documents, there will be the numbers [1] or [2], depending on, which is exactly what I want, however the References section is all wrong. At the end of the paper, the references section will have the numbers [1] and [2], but **no text** following, just blank. It is just a blank references section with the numbers [1] and [2], that is all. What is going on here? Why didn't it put in the information which is in my BibteX file? Thanks for your help, **Edit:** When I convert the lyx document to LaTeX, this is the code which appears at the end `\bibliographystyle{plain} \addcontentsline{toc}{section}{\refname}\bibliography{bibtex_file_name}` Do I have to do something extra to my bibtex file to make it work? At the moment it is just a TeX file saved as .bib with text of the form `@article {ArticleName AUTHOR = {}, TITLE = {}, ETC.... }`


title: How to make page numbering continuous after a second \mainmatter?

text: I am writing a document with multiple `\mainmatter`s and `\backmatter`s. The structure is basically:               ...     \mainmatter     \backmatter     ...     \mainmatter     \backmatter     ...      Is there a simple way of preventing LaTeX to reset the page counter? Also `\backmatter` should not reset the counter.


title: How might I get rid of these vertical blue boxes on the side of pages that are either blank, or first in the chapter?

text: I've been looking for a method of having different designs on odd/even pages, and from what I found on Google, `background` seems to be the package to do it; but in using it, it indiscriminately puts my design on EVERY page, even ones that I specify to be blank. How might I make it so that completely blank pages don't have this design, nor do the start of chapters?               \documentclass{book}     \let\cleardoublepage\clearpage          \RequirePackage[       left=2.25in,       right=0.75in,       top=1.25in,       bottom=1.25in,       marginparwidth=1.75in,       marginparsep=.25in]{geometry}      \RequirePackage{graphicx}     \RequirePackage[hidelinks]{hyperref}     \RequirePackage{amsthm, amsfonts, amsmath}     \RequirePackage{thmtools}     \RequirePackage{paralist}     \RequirePackage{tikz}     \RequirePackage[explicit]{titlesec}     \RequirePackage{blindtext, xcolor}     \RequirePackage[T1]{fontenc}     \RequirePackage{mdframed}     \RequirePackage{DejaVuSansCondensed}     \RequirePackage[normalem]{ulem}     \RequirePackage{environ}     \RequirePackage[strict]{changepage}     \RequirePackage{fancyhdr}     \RequirePackage{calc}     \RequirePackage{titletoc}     \RequirePackage{ifthen}     \RequirePackage[contents={}]{background}     \RequirePackage{lipsum}          \setlength{\oddsidemargin}{1in}     \setlength{\evensidemargin}{1.25in}          \renewcommand*\familydefault{\sfdefault} % Set default font          %%% Table of Contents ----------------------------------------------------------     \setcounter{tocdepth}{1} % Show only Chapters and Sections     \makeatletter     \g@addto@macro{\appendix}{%       \addtocontents{toc}{\protect\renewcommand*{\protect\@chapapp}{\protect\appendixname}}%     }            %%% Change font/color/layout of TOC          % START OF MODIFIED CODE          \contentsmargin{1.5cm} % global right margin, perhaps also global left          \titlecontents{part}[3cm]       {\color{cyan}\bfseries\Huge\addvspace{3mm}}       {\makebox[0cm][r]{\hspace{.5em}\thecontentslabel\hspace{.75cm}}}       {} %     ^^^ pretendously zero width box puts its contents in the left margin       {\hfill\makebox[-3cm]{\thecontentspage}}  % 3cm = twice 1.5cm       [\titleline{\color{cyan}\titlerule[1pt]}]          \titlecontents{chapter}[3cm] % <-- seems to set some specific left margin       {\color{cyan}\bfseries\LARGE\addvspace{3mm}}       {\makebox[0cm][r]{\@chapapp\hspace{.5em}\thecontentslabel\hspace{.75cm}}}       {} %     ^^^ pretendously zero width box puts its contents in the left margin       {\hfill\makebox[-3cm]{\thecontentspage}}  % 3cm = twice 1.5cm          \titlecontents{section}[3cm] % <-- again this left (additional?) margin       {\color{cyan}\large\itshape\addvspace{3mm}}       {\makebox[0cm][r]{\thecontentslabel\hspace{.75cm}}} % box pushed to the left       {}       {\hfill\makebox[-3cm]{\thecontentspage}}  % 3cm = twice 1.5cm       [\addvspace{0mm}]          % END OF MODIFICATIONS          \makeatother          \AddEverypageHook{%       \ifthenelse{\isodd{\thepage}}%       {         \begin{tikzpicture}[remember picture, overlay]           \fill [cyan!50] (18.25,3) rectangle (19,-26);         \end{tikzpicture}       }%       {         \begin{tikzpicture}[remember picture, overlay]           \fill [cyan!50] (-3,3) rectangle (-1.85,-26);         \end{tikzpicture}       }%     \BgMaterial}          \titlecontents{section}[5.3em]     {\color{cyan}\large\itshape\addvspace{3mm}}     {\contentslabel{0em}\hspace{3.2em}}     {}     {\hspace{3em}\contentspage}     [\addvspace{0mm}]          %%% Chapter Header ----------------------------------------------------------     \makeatletter     \titleformat{\chapter}       {\normalfont\sffamily\Huge\scshape}       {}{0pt}       {\thispagestyle{empty}    % Remove page number on new chapters       %\setcounter{definition}{0}       \begin{tikzpicture}[remember picture,overlay]         \node[yshift=-3cm] at (current page.north west)           {\begin{tikzpicture}[remember picture, overlay]             \draw[fill=cyan!50] (0,-1) rectangle               (25cm,3cm);             \draw[fill=cyan!50] (0,-24) rectangle               (25cm,-25cm);             \ifttl@label% <---------------------- Added condition on \ifttl@label               \node[anchor=west,xshift=.21\paperwidth,yshift=-.01\paperheight,rectangle]                   {\color{white}\LARGE \MakeUppercase{\@chapapp} \Huge\thechapter};             \fi% <------------------------------- end condition on \ifttl@label            \end{tikzpicture}           };        \end{tikzpicture}\endgraf       \vskip-.7cm       \color{cyan}\Huge\raggedright\leftskip-1cm        \noindent\MakeUppercase{#1}\endgraf       }     \makeatother          \titlespacing*{\chapter}{0pt}{10pt}{0pt}{}          \titleformat{\section}{\color{cyan}\itshape\LARGE}{\llap{\thesection} #1}{1em}{}[\titleline{\color{cyan}\titlerule[1pt]}]     \titleformat{\subsection}{\color{cyan}\normalfont\large}{\; #1}{1em}{}          \begin{document}       \tableofcontents       \newpage\mbox{\thispagestyle{empty}}\clearpage       \chapter{One}         \lipsum[1-10]       \chapter{Two}         \lipsum[2-20]     \end{document}


title: Neuroscience Graphics with TikZ

text: Does anyone know of packages for displaying neuroscience schematics with tikz? For example, I would like to place a raster plot next to the diagram of a Markov process to help explain how Markov models could be used to simulate the firing of neurons. I know that I could do this by including an image of neural activity in the tikz picture. But, I wondered if there was a solution that could only use tikz. Below is the, admittedly, amateurish, version I made in PPT. The raster plot refers to the horizontal lines of ticks. Each tick is the same and marks where a neuron fired. I know how to use the automata library in tikz to make the state diagram. I wondered if there was an easier way to draw many horizontal lines than the brute force approach with a for loop. ![Sketch of slide combining raster plots and Markov chain](http://i.stack.imgur.com/3fcvA.png) Sample neural data (times in ms that a neuron fired) for 50 ms:                2,10,12,14,15,20,25,34,35,48, 49


title: Are there any situtations where it is better to load a package after other code?

text: I always place all my packages immediately following the document class, followed by setting information (`\hypersetup` for example) and customization to my documents (header and footer customization for example), and macros for use in the document. Is there any case were you would want to load code before you load a package? This answers points out that for clarity you might want to have setting information immediately following the package, to reduce the amount of documentation you have to do (For example, I should move `\hypersetup` to be right after `\usepackage{hyperref}`, but before any packages that follow it, `achemso` or `cleverref` or whatever) I thought all packages had to be loaded first, but it seems that in some cases you need code before them, for example you need to set `\author`, `\title`, and `\date` before you load the `titling` package. So, are there cases where it is technically better (or required) to write some code before loading a package? By technically better I mean, makes a difference to the compiler, not just someone reading the code later.


title: column and row vectors with builtin math mode

text: Is there a way to make the solutions here typesetting column vector and here Typesetting a Row Vector work by including `\ensuremath` in their definitions?


title: (A Problem)Background without transparency in hardcopy printed out page, Why?

text: the pictures do not layout with transparency as watermark(appear behind text page) on printed page with using a printer unit.(My mean is the actual hardcopy printed out page) Why??? How can I do this work?               \documentclass{article}          \usepackage{background}     \usepackage{graphicx}     \usepackage{lipsum}          \backgroundsetup{      scale=1,      angle=0,      opacity=.4,      contents={\begin{tabular}{c}     \includegraphics[scale=.1]{sample 1}\\[1ex]     \includegraphics[scale=.2]{sample 2}                \end{tabular}      }}          \begin{document}     \lipsum[1-10]     \end{document}


title: How to preserve lenghts to use with \includegraphics scaling, when calculating them with pgf

text: This question is related to my earlier question here: How to define a macro that uses image width and height to define a variable for later use . There you can find a full MWE of the problematic code. Which I skip here for sake of brevity. I use a mixture of `\newlength`, `\setlength` and `\pgfmathsetmacro` to calculate the optimal height for two figures I want to plot. The code works fine and the resulting images are displayed correclty. **However** , I get the error message:               ERROR: Illegal unit of measure (pt inserted).      when using the calculated height (here `\finalheight`) for:               \includegraphics[height=\finalheight] .      My guess is that using e.g.               \pgfmathsetmacro{\finalheight}{\effwidth/\sumratio} ,      I change a length that has a physical unit, to a mere number. Is that right? However I had a problem using `\setlength` to calculate ratios, which is why I started to use `\pgfmathsetmacro` in the first place. Does someone know a clean way to perform the calculation below such that the results `\finalheight` has a unit?               \newlength\firstheight%     \newlength\firstwidth%     \newlength\secondheight%     \newlength\secondwidth%     \def\firstim{\includegraphics{pathToImage}}%     \def\secondim{\includegraphics{pathToImage}}%     \setlength{\firstheight}{\heightof{\firstim}}%     \setlength{\firstwidth}{\widthof{\firstim}}%     \pgfmathsetmacro{\firstratio}{\firstwidth/\firstheight}%     \setlength{\secondheight}{\heightof{\secondim}}%     \setlength{\secondwidth}{\widthof{\secondim}}%     \pgfmathsetmacro{\secondratio}{\secondwidth/\secondheight}%     \pgfmathsetmacro{\gapspace}{0.5cm}%     \pgfmathsetmacro{\effwidth}{\textwidth-\gapspace}%     \pgfmathsetmacro{\sumratio}{\firstratio+\secondratio}%     \pgfmathsetmacro{\finalheight}{\effwidth/\sumratio}%


title: What is the correct way to calculate \multicolumn size when using tabularx?

text: What is the correct way to determine the correct size for use with `p{}` needed by `\multicolumn` to get the size correct? The problem is this: I want to use `tabularx` and also use `\multicolumn`. To do that, I have to give \multicolumn an exact size to use. And this is the problem. In complicated table, where I can have one table inside another, and a row that extends to few columns, the calculations are getting hard. It become harder to figure the correct size, and if I change the table later, I have to change the code again. The first example below shows that X can't be used with \multicolumn to make it extend to more than one column:               \documentclass[10pt,notitlepage]{article}%     \usepackage{tabularx}     \usepackage{array}     \newcolumntype{Y}{>{\centering\arraybackslash}X}     \usepackage{lipsum}     \setlength{\parindent}{0pt}     \begin{document}          \begin{tabularx}{\textwidth}{@{}|l|Y|@{}}\hline      column 1 &      {\begin{tabularx}{\linewidth}{@{}Y|Y|Y@{}}\hline           \lipsum[75] & \lipsum[75] &  \lipsum[75] \\\hline           \multicolumn{3}{X}{\lipsum[75]}       \end{tabularx}      }      \\\hline     \end{tabularx}     \end{document}      ![Mathematica graphics](http://i.stack.imgur.com/8ufW9.png) So have to use `p{}`. Nothing else would let it extend to the other columns. But `p` wants a size. after some trial and error, here is one that gets close to the size needed               \documentclass[10pt,notitlepage]{article}%     \usepackage{tabularx}     \usepackage{array}     \newcolumntype{Y}{>{\centering\arraybackslash}X}     \usepackage{lipsum}     \setlength{\parindent}{0pt}     \begin{document}          \begin{tabularx}{\textwidth}{@{}|l|Y|@{}}\hline      column 1 &      {\begin{tabularx}{\linewidth}{@{}Y|Y|Y@{}}\hline            \lipsum[75] &  \lipsum[75] &   \lipsum[75] \\\hline           \multicolumn{3}             %this calculation below is needed, and not sure if it is correct now             {p{.9\dimexpr \textwidth-4\arrayrulewidth-8\tabcolsep\relax}}{\lipsum[75]}       \end{tabularx}      }      \\\hline     \end{tabularx}     \end{document}      ![Mathematica graphics](http://i.stack.imgur.com/Mafjs.png) Ok, it is better now. But if I change something later, I have to go change `.9` to something else I am sure. The question is: Is this really how one is supposed to do this in Latex? It seems that Latex should have a way to do this automatically. Is there a better approach I should be looking at instead of what I am doing above? The above is a small example. I want to use tabularx and have other tabularx tables inside as well. So this can get complicated very quickly.


title: Changing the pdf pagesize for AMS package

text: I used AMS package with GSM option to write my professor's math book in LaTex. He want to customize the pdf pagesize to 16x24, it is the standard size for that style of book in my country, but I do not know how to customize it. Here is a MWE :               \documentclass[a4paper]{gsm-l}      %\special{papersize=160mm, 240mm}     \usepackage[utf8]{vietnam}      \usepackage{amssymb}      \usepackage{fouriernc}     \usepackage{esvect}      \usepackage{graphicx} \usepackage{lipsum}      \makeindex     \begin{document}      \lipsum      \end{document}


title: in beamer, change fontsize of selected slides with nested lists

text: I want to change the font size of particular frames, and when I use               \fontsize{<font size>}{<value for \baselineskip>}\selectfont      as suggested by this post, I found it does not change the font size inside nest lists. Is there a way to change those font size accordingly?


title: Align text and image on the same line?

text: According to the two-column example document below, how can you put text and image on the same line? I'm interested in how to insert text at `Some text here` and `more text here` with the image right aligned. Example:               |     #TEXT######################### |     #TEXT######################### |     | ################################## | ################################## |     | ################################## | ################################## |     | ################################## | ################################## |     | ################################## | ################################## |     | #################                  | ################################## |     |                                    |                                    |     |                      ************* | ################################## |     |   Some text here     ************* | ################################## |     |                      ************* | ################################## |     |                      **IMAGE.JPG** | ################################## |     |   more text here     ************* |                                    |     |                      ************* | ################################## |     |                      ************* | ################################## |     |                      ************* | ################################## |     |                                    |                                    |     |     #TEXT######################### | ################################## |     | ################################## | ################################## |     | ################################## | ################################## |     | ################################## | ################################## |     | ################################## | ################################## |     | #################                  | ################################## |


title: Customize beamerposter alertblocks

text: I am writing a poster using the `beamerposter`package, and I'm using a template that a friend of mine gave me. In his template, the following code alters the default block template:               \setbeamertemplate{block begin}{       \vskip1ex       \begin{beamercolorbox}[rounded=true,shadow=true,leftskip=1cm,colsep*=.75ex]{block title}%         \usebeamerfont*{block title}\insertblocktitle       \end{beamercolorbox}%       {\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%       \usebeamerfont{block body}%       \begin{beamercolorbox}[rounded=true,shadow=true,colsep*=.75ex,sep=.75ex,vmode]{block body}%         \ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%       }       \setbeamertemplate{block end}{       \end{beamercolorbox}     }      This gives a nice result. However, I want to have also highlighted blocks, and when I use `alertblock` or `exampleblock` they come out with not-rounded corners and no shadowing. How would I apply the above design to all blocks?


title: Crossing out arrows

text: Is there a command/package that allows one to cross out arrows? I'm picturing something like an "X" over the `$\to$` symbol. I am aware of the `ulem` package, which I think allows you to cross out text with a horizontal line, but that doesn't seem to work as well over arrows.


title: TikZ: Add decoration on a smooth coordinates plot

text: I would like to draw a smooth curve that I get from a coordinate plot after adding some additional decorations. So far I have.               \begin{tikzpicture}     \path [blue] plot [smooth] coordinates { (0.2,0.2) (0.4,0.2) (0.6,0.22) (0.8,0.52) (1,0.22) (1.2,0.2) (1.4,0.2)} [postaction={draw,decorate,decoration={random steps, segment length = 0.4mm, amplitude = 0.5pt}}] (0.2,0.2) -- (1.4,0.2);     \end{tikzpicture}      This code however plots both the smooth line with the decoration and a line from `(0.2,0.2)` to `(1.4,0.2)` ![Result](http://i.stack.imgur.com/1G0pd.png)


title: undefined control sequence '\For' - algorithmicx package

text: I have to write some algorithm, thus I've decided to use algorithmicx package:               \usepackage{algorithm}     \usepackage{algorithmicx}          \begin{algorithm}         \begin{algorithmic}[1]             \For{aa}                 \State $Sim(i,j) \gets \frac{v_{i} \cdot v_{j}}{\left|v_{i}\right|\left|v_{j}\right|}$             \EndFor         \end{algorithmic}         \label{alg:rAP}         \caption{algorithm}     \end{algorithm}      Everything is fine but LaTeX says`Undefinde control sequence \For` I'm very confused because I've just follow the instruction of `algorithmicx` Also there is no problem to use `\State` (when I've commented out `\For`) I've also tried `\FOR`, `\for` but nothings work. Seems `algorithmicx` package are not deprecated and it makes me more confused.


title: How can I reference an (unnumbered) list item?

text: I have the following code:               \documentclass[]{article}          \begin{document}     \begin{itemize}         \item first item \label{first}              \item second item     \end{itemize}          In \ref{first} we find the first item.          \end{document}      I'd like to reference to an item in the list, but as their isn't a number, I can't use `\label`. Is it possible to add something like `[1]` after the item I'd like to refer to and be able to use `\ref` in order to get this `[1]`? The result should be something like: _In [1] we find the first item._


title: runaway argument?

text: Here is the minimal example. It gives me error Runaway argument? > {\includegraphics [width=3in]{readavail13.jpg} \label {Worst Quorum S\ETC. ! > File ended while scanning use of \sf@@@subfloat. \par               \documentclass[final,leqno,onefignum,onetabnum]{siamltex1213}     \usepackage{amsmath}     \usepackage{subfig}     \title{USING SIAM'S \LaTeX\ MACROS\thanks{This work was     supported by the Society for Industrial and Applied     Mathematics}}     \begin{document}     \maketitle     \section{example}     \begin{figure}[H]     \subfloat[Read Availability (13 copies)]{\includegraphics[width=3in]{readavail13.jpg}     \label{Worst Quorum Size}     \hfil     \subfloat[Read Availability (40 copies)]{\includegraphics[width=3in]{readavail40.jpg}     \label{Optimal Quorum Size}     \caption{Read Availability}     \label{ra}     \end{figure}     \end{document}       The **siamlatex1213.cls** file can be found at http://www.siam.org/journals/auth-info.php.


title: Missing pagenumber in bookmarks

text: The pagenumber from "Inhaltsverzeichnis" is missing in the bookmarks. I manually added the Inhaltsverzeichnis (TOC) with               \addcontentsline{toc}{chapter}{Inhaltsverzeichnis}      but it doesn't print the pagenumber. The LOF or LOT, which I added with the same command, appear as I wish. ![Missing page number for pdfbookmark](http://i.stack.imgur.com/krrox.png) When I add               \pdfbookmark{Inhaltsverzeichnis}{Inhaltsverzeichnis}      instead of \addcontentsline, I get what I want in the bookmarks but the TOC disappears from the TOC. ![Missing "Inhaltsverzeichnis" in TOC](http://i.stack.imgur.com/zA6mr.png) How to fix that? **UPDATE** Here's the MWE               \documentclass[12pt,a4paper,oneside]{scrbook}     \usepackage[ngerman]{babel}     % deutsche Worttrennung     \usepackage[T1]{fontenc}        % Ausgabe von Sonderzeichen und Akzenten in PDF verbessert     \usepackage[utf8]{inputenc}     % Eingabe von Sonderzeichen möglich     \usepackage{lipsum}          \setcounter{secnumdepth}{3}     % subsubsections nummerieren     \setcounter{tocdepth}{3}        % subsubsections in TOC          \usepackage[ %         pdfproducer={Texmaker},     %          pdfcreator={pdfLaTeX},      %          hidelinks,                  % versteckt die Boxen um die Links in der PDF         bookmarksnumbered,          % nummereiert Lesezeichen         ]{hyperref}                 % PDF Metainformationen hinzufügen           \begin{document}          \pagenumbering{gobble}     \chapter*{Sperrvermerk}     \addcontentsline{toc}{chapter}{Sperrvermerk}     \lipsum[1]     \clearpage          \chapter*{Vorwort}     \addcontentsline{toc}{chapter}{Vorwort}     \lipsum[2]     \clearpage          \pagenumbering{Roman}     \pagestyle{headings}          \addcontentsline{toc}{chapter}{Inhaltsverzeichnis}     \tableofcontents          \chapter{One}     \lipsum[3]     \section{One.1}     \lipsum[4]     \section{One.2}     \lipsum[5]          \end{document}


title: Will todonotes work inside an align environment?

text: Is it possible to use todonotes inside an align environment, e.g.:               \documentclass{report}     \usepackage{amssymb,amsmath}     \usepackage{todonotes}     \begin{document}     \begin{align}     a^2&=b^2+c^2 \todo{check this calculation}     \end{align}     \end{document}      gives me the error:               ! LaTeX Error: Not in outer par mode.          See the LaTeX manual or LaTeX Companion for explanation.     Type  H <return>  for immediate help.      ...                                                        l.8 \end{align}          ? X     No pages of output.     Transcript written on foo.log.      What are some alternatives? I have tried the marginnote package, but it doesn't have the `inline` feature.


title: How can I get a big cross to denote a generalized cartesian product?

text: I'm trying to get a big cross which I can subscript in order to denote a generalized cartesian product (much like how `\bigcup` works for generalized unions). How can I accomplish this?


title: Aligning pseudocode in LaTeX

text: My algorithms class is following strict guidelines for pseudocode. Let's say I have something like the following:               y = 0     for i = n downto 0         y = a_i + x * y      I want this to appear left-aligned on the page and have line numbering. The `algorithmic` package seems close to what I want, but it doesn't follow my class's pseudocode conventions. Is there a really simple way to hack this in to LaTeX? I am just learning LaTeX, so I apologize if this is a simple question.