title: titlesec troubles

text: I am working on a document that will consist of many sections and subsections. I want to have a table of contents per section. I am using `titlesec`, `titletoc` and `titleps`. I have the following MWE:               \documentclass[10pt]{article}          \usepackage{hyperref}          \usepackage[]{titlesec}     \usepackage{titletoc}     \usepackage{titleps}          \hypersetup{colorlinks=true,                  linkcolor=blue,                  filecolor=blue,                  urlcolor=blue}          \usepackage[margin=15mm,     paperheight=15cm,paperwidth=13cm     ]{geometry}     %for demonstation purposes, not contributing to MWE.          \setcounter{tocdepth}{1}          %this has no apparent effect     \newcommand{\sectionbreak}{\clearpage}          %this causes near duplicated entries in the table of contents     % if a \clearpage is added     \titleformat{\section}[block]     {%\clearpage     \normalfont\Large\bfseries}{\thesection}{1em}{}[]          \begin{document}     \tableofcontents          \section{First Section}\label{First}          The section TOC:          \hfill\hrule\hfill          \startcontents[sections]     \printcontents[sections]{}{-1}{\setcounter{tocdepth}{2}}          \hfill\hrule          \subsection{Sub1}          \section{Second}\label{Second Section}          The section TOC:          \hfill\hrule\hfill          \startcontents[sections]     \printcontents[sections]{}{-1}{\setcounter{tocdepth}{2}}          \hfill\hrule          \subsection{Sub1}          \section{Second}\label{Third Section}          The section TOC:          \hfill\hrule\hfill          \startcontents[sections]     \printcontents[sections]{}{-1}{\setcounter{tocdepth}{2}}          \hfill\hrule          \subsection{Sub1}          \end{document}      With this I have three issues:   1. If I add clearpage to the `\titleformat{section}` I get duplicated entries in the table of contents; if I add `\newcommand{\sectionbreak}{\clearpage}` it apparently has no effect.   2. The section table of contents contains information from prior or subsequent sections; I don't want that   3. I am not sure whether its related, there seems to be a `clearpage` after the `table of contents`; in this case I won't mind, but I might not want that in future. (It could be the `\sectionbreak`, but then why does it not work later on?) Below is the rendered (`lualatex`) version(I don't know to shrink them to three in a row): ![Page1](http://i.stack.imgur.com/R4q6w.png)![Page2](http://i.stack.imgur.com/1VoEJ.png)![Page3](http://i.stack.imgur.com/K1wIj.png)


title: How can i get the abbreviations as list in Appendix page?

text: A possible list of terms, abbreviations and variable names with brief explanations has to be placed after the table of contents. If any term is explained in the list of terms, it is supposed to be used in the chapter text where it is used the first time. Is that possible in latex? If so which package can help me to do that. This MsWord screen shot is a good example.. ![enter image description here](http://i.stack.imgur.com/SF0di.png) thanks in advance..


title: Triangular commutative diagram

text: I am using the `\xymatrix` command this is the code I've written               \[\xymatrix{     & A \ar[d]^{i}\\      B \ar@{-->}[ru]^-{\exists \overset{\sim} \varphi}\ar[r]^{\varphi}&C     }\]      My problem is with the `[ru]...` The dashed arrow goes upward, whereas I want it to go downward; and I keep getting an error !


title: Text in two lines of Equation

text: I make a equation. But I want the words "Factor Mecânico de Filler" in two lines. "Factor Mecânico" in one line and "de Filler" in other line, for exemple. Is it possible ?                  \documentclass[12pt,twoside,a4paper,openright]{report}             \usepackage[portuguese]{babel}             \usepackage[utf8]{inputenc}             \usepackage[inner=3cm,outer=2cm,tmargin=2.0cm,bmargin=2.0cm, includefoot, includehead]{geometry}             \usepackage{mathtools}              \begin{document}                      \begin{equation}                 \label{equacao_}                 \text{Factor Mecânico de \textit{Filler}} = \frac{[\text{\% \textit{Filler} efectivo} \times \text{Índice de Tracção] (Modificado)}}{[\text{\% \textit{Filler} efectivo} \times \text{Índice de Tracção] (Original)}}                 \end{equation}                      \end{document}


title: Replacing matching text with a macro containing information from a CSV file

text: I have some data stored in a CSV file, in this manner:               000000001 @ name @ information @ more information @ some more information      I also have a `information.tex` file containing the numbers from the first column throughout (this file is `\input` into my main document):               \chapter{Some information about 000012311}         This is some text about 000012311 and 000012312\footnote{See also 000012313}.     \chapter{Some other information}         This text is about 000000001.      I currently use a `BASH` script which replaces all numbers appearing `information.tex` matched to the first column of the CSV file with a macro, `\mymacro{}{}{}{}`, where each `{}` contains data from a column (second, third, fourth, and fifth). For e.g., where the input file above contains `This text is about 000000001.`, using the CSV file line above, it becomes `This text is about \mymacro{name}{information}{more information}{some more information}.`, so when compiled, the text is displayed according to the definition of `\mymacro`. Essentially, I am using BASH to edit `information.tex`, after which I compile it. Can I remove the need for BASH and do this directly with LuaTeX or some form of ConTeXt?


title: How can I modify vertical space between figure and caption?

text: \documentclass{article}     \usepackage[draft]{graphicx}     \begin{document}     \begin{figure}     \centering     \setlength\fboxsep{124pt}     \setlength\fboxrule{1pt}     \fbox{\includegraphics{dummy}}     \caption{Dummy caption}     \end{figure}     \end{document}      How can I increase vertical space between figure and caption?


title: Customizing caption in side-by-side figures

text: How do I customize my caption that follows this article's setting of the captions on page 26. The following is my attempt to do that, but still doesn't work. Obviously, what I want to achieve is to put the figures' names in small letter/alphabet((a) and (b)) for each of the pictures and there is another global caption below them which is in number/figure. The provided link on the page 26 expresses this better.               \begin{figure}[!ht]      \begin{minipage}{0.49\linewidth}       \centerline{\includegraphics[scale=0.2]{figure/figA.png}}       \caption{Figure on left side}\label{fig:figA}      \end{minipage}     \hfill      \begin{minipage}{0.49\linewidth}       \centerline{\includegraphics[scale=0.2]{figure/figB.png}}       \caption{Figure on right side}\label{fig:figB}      \end{minipage}     \end{figure}      Or, am I using the wrong package?


title: Is it possible to write all mathematical formulas in a separate file and add them in main file on-demand?

text: Consider this scenario: I have a report to write and I want to write _all_ mathematical formulas in a separate file and then add them in the main report file on demand (i.e. include/import/add/call a certain formula in specific part of my report). Please note that I'm not talking about referencing or citation (`\ref` or `\cir`) to that formula. What I want, is to have the formula itself in the generated pdf. Somehow like a function call in programming languages! Is this possible?


title: Writing vector * matrix * vector

text: I am using `$\vec{s}^\intercal \vec{A} \vec{s}$` to represent s^T * s * S where s is a column vector and A is a square matrix. The problem with this representation is that there is little too much space between s^T and As. Is there a way I can represent this with uniform spacing? PS: I am using `\renewcommand{\vec}[1]{\mathbf{#1}}`.


title: How can I replace a box of text with beamer?

text: I currently have this piece of text for a quiz:               \begin{frame}{Quiz}         \begin{block}{Frage}             With generics the compiler has more information about the              types of the objects, so explicit casts don't have to be used              and the compiler can produce type safe code.                  What implications have the generics for the runtime              performance of the  program which uses them?         \end{block}              \only<1>{         \begin{itemize}             \item With the generics the compiler can optimize the code for                    used types. This and the omission of the casts are the                    reasons why the code compiled with the generics is                    \textbf{quicker} than the one compiled without.             \item The usage of generics has \textbf{no implications} for                    the runtime performance of the compiled programs.             \item The improved flexibility and type safety means that the                    compiler has to generate concrete implementation from                    the generic template for each used type. This means                    that applications start \textbf{a bit slower}.         \end{itemize}}         \only<2>{             The Java Virtual Machine and the copiled byte code are Generics              agnostic. The comiled byte code does not differ from byte code              compiled from sources which don't use the generics.             So using the generics has \textbf{no impact} on the runtime              performance of compiled Java code.         }     \end{frame}      I would like to present the question with the different possibilities to answer and on the next slides the different possibilities to answer should disappear, the rest should not move and the correct answer with an explanation should appear. The current solution is not optimal, as the question moves. I've also tried visible instead of only, but with this solution the explanation doesn't appear at all. (I know I could manually fix the "moving question problem" by adding space, but I don't want to do this for all slides.)


title: How to change the font of URL in the bibliography

text: When using the `natbib` package the URLs are printed and formatted in the bibliography in a different font from the rest of the document which looks nasty i.e. monospace Typewriter. I am having difficulty making it the same font as the rest of the bibliography.


title: almost APA formatting?

text: I need to make a fairly large report. It requires a cherry-picked APA style, meaning that it uses some of it, and other things are not APA-compliant. I think I won't have problems dealing with the font, margins and spacing. My question is how to modify the `\section`, `\subsection`, `\subsubsection` to match APA if I use a class like `article` or `report`. One of the most important requirements is that this APA compliant outline shows in the table of contents. I don't think customizing `apa` or `apa6e` is possible/practical. Any ideas?


title: Arguments expansion in IfSubStr

text: ## EDIT: Simplified question How can I make the following code print "Yes"?               \IfSubStr{\textbf{AAA}}{AAA}{Yes}{No}      * * * ## Full question I'm playing with `xstring`'s `IfSubStr`, but I don't really understand how expansion works. Here's a largely simplified MWE demonstrating my problem:               \documentclass{minimal}          \usepackage{xstring}          \newcommand{\correctanswer}{}     \newcommand{\mytext}[1]{         Text :         \noexpandarg         \IfSubStr{#1}{\correctanswer}{             \textbf{\boldmath #1}         }{             #1         }     }     \newcommand{\mymathtext}[1]{\mytext{\ensuremath{#1}}}          \begin{document}         \mytext{Foo} \mytext{Bar\correctanswer} \mymathtext{\frac{1}{2}} \mymathtext{\frac{1}{4}\correctanswer}     \end{document}      The code works as follow: first define a `\correctanswer` which expands to an empty string, and second emphasize (by typesetting in bold) text that contains this macro. I'm using `xstring`'s `\noexpandarg` to prevent `\correctanswer` from being expanded too early, but that doesn't work when the argument text is already passed to another command, such as `\ensuremath` : **Although`Bar` is typeset in bold, `\frac{1}{4}` is not.** How can I get `\frac{1}{4}` to be typeset in bold? PS: I don't really understand how expansion works. I've read a number of posts on this site, but I still can't figure out a correct solution to this particular problem. I therefore haven't included the numerous unfruitful attempts that I made, hoping that someone could instead provide me with a clear explanation :)


title: Identifying a symbol

text: I'm looking for the symbols or font which produced these symbols (in math mode): S and K ![enter image description here](http://i.stack.imgur.com/bTNzR.png) I have no idea which program produced the document in which I found these symbols, so I'm pretty clueless about it. I tried Detexify but it brought no results.


title: Smaller \lbrace than expected

text: > **Possible Duplicate:**   >  How do I format this equation in LaTeX?               \begin{equation}     p_{GL}=     \lbrace     \begin{array}{@{} l c @{}}     0.59p_R+0.3p_G+0.11p_B & \text{p es un pixel del fuego}    \\     0 & \text{p no es pixel del fuego}     \end{array}     \label{eq4}     \end{equation}      That's the code of an equation but the `\lbrace` doesn't cover the two lines of equations.


title: \sum_i acts as \sum\limits_i but just sometimes

text: The code part looks like this               \begin{equation}        \frac         {             \left(\sum_i r_{ik}x_{ij}\right) -              \mu'_{kj}\left(\sum_i r_{ik}\right) +             (\alpha-1)-\mu'_{kj}(\alpha+\beta-2)         }         {             \mu'_{kj}(1-\mu'_{kj})          } = 0     \end{equation}     \begin{equation}         \left(\sum_i r_{ik}x_{ij}\right) -          \mu'_{kj}\left(\sum_i r_{ik}\right) +         (\alpha-1)-\mu'_{kj}(\alpha+\beta-2)          = 0     \end{equation}     \begin{equation}         \mu'_{kj} \left[\left(\sum_i r_{ik}\right)+\alpha+\beta-2\right]          = \left(\sum_i r_{ik} x_{ij}\right)+\alpha-1     \end{equation}     \begin{equation}         \mu'_{kj} = \frac{             \left(\sum_i r_{ik} x_{ij}\right)+\alpha-1         }         {             \left(\sum_i r_{ik}\right)+\alpha+\beta-2         }     \end{equation}      For the first and last equation the `\sum_i` gets rendered as it should but for the two mid-equations the `\sum_i` gets rendered as `\sum\limits_i` which doesn't look good at all. What has happened with my code?! The rest of the code can be found here: https://github.com/Jim- Holmstroem/dd2447/blob/map_first/homework/assignment2/doc.tex#L266


title: Three emdashes bound together

text: In many bibliography styles repeating authors are indicated with three emdashes, forming a single line. This works well with some fonts, while for others it leaves gaps:               \documentclass[a4paper]{article}     \usepackage[utf8]{inputenc}     \newcommand*{\threeemdashes}{\textemdash\kern-1pt\textemdash\kern-1pt\textemdash}          \begin{document}     \raggedright     \fontfamily{lmr}\selectfont%     Latin Modern \textemdash{}\textemdash{}\textemdash{} Latin Modern \linebreak     Latin Modern \threeemdashes{} Latin Modern \linebreak     Latin Modern \rule[0.6ex]{2.3em}{.4pt} Latin Modern\linebreak     Latin Modern mmm Latin Modern               \fontfamily{LinuxLibertineO-OsF}\selectfont     Linux Libertine \textemdash{}\textemdash{}\textemdash{} Linux Libertine \linebreak     Linux Libertine \threeemdashes{} Linux Libertine \linebreak     Linux Libertine \rule[.55ex]{2.2em}{.5pt} Linux Libertine\linebreak     Linux Libertine mmm Linux Libertine     \end{document}      As you can see, I tried to fiddle with the kerning by myself, but this does not scale well, compare, e.g., `{\tiny\threeemdashes}` and `{\Huge\threeemdashes}`. I already learned that I can not fix this with additional kerning pairs myself, via TeX at least. I even tried to paint a long rule by hand, but that does not scale either, and LaTeX rules are rectangles, while the rounded ends of the dashes look much better. Moreover, getting the right values for thickness and raise seems hard. To my surprise I also learned that emdashes are not as wide as m in most fonts, and the length `1em` does not describe the width of an m!? I would figure that this is not a niche problem, and many solutions should be around. So is there a One True Solution that scales with font size, font type etc.? And yes, I absolutely want to use pdflatex.


title: Remove dots in toc for a particular entry like appendix

text: I am writing my thesis and use the `book` class under `PhDthesisPSnPDF`. I would like to remove the dots in table of contents only for a particular entry like "Appendix". All the entries for chapter and section in the table of contents have dots and page numbers, I need to get rid of page number and the dots for the appendix in the TOC. Is there way to do?


title: pdflatex / xelatex -output-directory and subdirectories when using \include

text: When I include a file from a subdirectory with `\include{subdir/sub}` and compile the file with `pdflatex -output-directory .tex_test/ main.tex`, `pdflatex` complains, that it can't write to `.tex_test/subdir/sub.aux`. (Same happens with `xelatex`) Is there a way to automatically create the necessary file structure in the `output-directory`? Of course it would also be ok, if `sub.aux` would be written directly to `.tex_test/`, but I guess that is not possible... Full MWE: `./main.tex` contains:               \documentclass{article}     \begin{document}     Main Document          \include{subdir/sub}     \end{document}      and `./subdir/sub.tex` contains just anything. More importantly the directory `.tex_test/` exists.


title: Outlining and aligning a Matrix

text: Bear with me as this is a multi-part question. **First I'm trying figure out how to outline a matrix and not change the style of the nodes in the matrix.** Maybe a better question is how to configure a node/matrix w/o changing anything within its scope. **Secondly I'd like the top of the 2nd/right matrix to be on the same y-coordinate as`c.south`** I tried to accomplish this with `positioning` via `right = of c.south`, but it does this strange overlap thing and changes the anchor from the node origin to the node's west anchor. (The blue dots are the anchor point currently being used) ![image](http://i.stack.imgur.com/A4mVA.png) Below is the way I want it to look in the end, which I forced by using `right = of c.south east, anchor = north west` in the options of `mtrx2` This pushes the anchors to the wrong spot (which I don't want) **So is there a better way of positioning the matrix like this?** ![north west](http://i.stack.imgur.com/BA45x.png)               \documentclass{article}          \usepackage{tikz}     \usepackage[margin=0.5in]{geometry}     \pagestyle{empty}          \begin{document}          %\input{../tikz-setup.tex}     \usetikzlibrary{shapes, arrows, calc, positioning}          % Define block styles     \tikzstyle{state}   = [ rounded rectangle,                              draw,                              text centered,                              minimum height=3em ,                             minimum width = 6em,                             inner sep = 5pt                           ]     \tikzstyle{test}    = [ diamond,                              draw,                              shape aspect=2,                              inner sep = 0pt,                             text width = 7em,                             text centered                           ]     \tikzstyle{action}  = [ rectangle, draw,                             text width=8em,                             inner sep = 3pt,                              minimum height=5em                           ]     \tikzstyle{data}    = [ trapezium,                              draw,                              trapezium left angle=60,                              trapezium right angle=120pt,                             minimum height = 6em,                             % text width = 5em                            ]     \tikzstyle{line}    = [ draw, -triangle 45 ]          \tikzstyle{list}  = [ rectangle, draw,                             minimum width = 6em                                                 ]          \tikzstyle{ptr-box}  = [ rectangle,                              text width = 8em                                                 ]          \begin{center}     \begin{tikzpicture}[align = flush center, font = \small]         % Place nodes         \matrix [column sep = 0.5em, row sep = 1.3em] (mtrx1)         {           \node [state] (a) {a}; \fill[blue] (0,0) circle (2pt);\\              \node [data] (b) {b}; \\              \node [test] (c) {c}; \\              \node [action] (d) {d}; \\              \node [test] (e) {e}; \\              \node [action] (f) {f}; \\              \node [action] (g) {g}; \\         };               \matrix [column sep = 0.5em, row sep = 1.3em, right = of c.south, draw, dashed] (mtrx2)         {          &               \node [test] (aa) {aa}; \fill[blue] (0,0) circle (2pt);\\              &         \node [test] (bb) {bb}; \fill[blue] (0,0) circle (2pt);\\              &         \node [action] (cc) {cc}; \fill[blue] (0,0) circle (2pt);\\              &         \node [data] (dd) {dd}; \fill[blue] (0,0) circle (2pt);\\              \node [state] (ee) {ee}; &         \node [state] (ff) {ff};\fill[blue] (0,0) circle (2pt);\\         };               % Draw edges         \path [draw] (a) -- (g);             \path [draw] (aa) -- (ff);                    \end{tikzpicture}     \end{center}     \end{document}


title: Should I include punctuation marks in \emph, or should I place those marks after the command?

text: I wonder if I should place punctuation marks directly after the `\emph{}` command, or should I include those marks within the curly brackets? Thus:               The languages only differ in their \emph{grammar}, their pronunciation and their most common words.      vs.               The languages only differ in their \emph{grammar,} their pronunciation and their most common words.


title: Vertical alignment in 'tabular'

text: I have a problem with vertically aligning content in a `tabular` environment:               \documentclass{article}     \begin{document}          \begin{tabular}{ p{2em} p{2em} }         test & \begin{tabular}{l} s s s \\ s s s \end{tabular} \\     \end{tabular}          \end{document}      ![screenshot table example](http://i.stack.imgur.com/7kfdq.png) Which as far as I understand the `array` documentation should give me two table cells which are top-aligned and have a with of `2em`. The thing is that if I don't have a table in the second cell but simply text then it works as intended:               \documentclass{article}     \begin{document}          \begin{tabular}{ p{2em} p{2em} }         \hline         test & s s s s s s s s s s s s s s s \\         \hline     \end{tabular}          \end{document}      ![screenshot text example](http://i.stack.imgur.com/z0bfC.png) What is the reason for the difference in appearance?


title: Ornamental hyphenation character with Xe(La)TeX

text: Using Xe(La)TeX, how could the hyphenation character be set to any particular glyph in a given font? I'd also like to have the possibility to set a color for the glyph when used for that task and to set the glyph's size, too. I am thinking of using some ornamental glyph as hyphenation character, but haven't figured out how to put to good use the facilities of the package `fontspec` to this end. I've tried with the key `HyphenChar`, but I wasn't able to set a value in terms of `XeTeXglyph` when I found a glyph not corresponding to any UniCode number; besides, I had no chance to set either color or size.


title: Plotting Normal distribution in pgfplots

text: I'm trying to reproduce the following diagram in `TikZ` and `pgfplots`. ![enter image description here](http://i.stack.imgur.com/aoYEU.png) My MWE with regenerated graph is below:               \documentclass{standalone}     \usepackage{pgfplots}          \begin{document}          \pgfmathdeclarefunction{gauss}{2}{%       \pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}%     }          \begin{tikzpicture}     \begin{axis}[       no markers,        domain=0:6,        samples=100,       axis lines*=left,        xlabel=$x$,       every axis y label/.style={at=(current axis.above origin),anchor=south},       every axis x label/.style={at=(current axis.right of origin),anchor=west},       height=5cm,        width=12cm,       xtick=\empty,        ytick=\empty,       enlargelimits=false,        clip=false,        axis on top,       grid = major       ]           \addplot [very thick,cyan!50!black] {gauss(3, 1)};     \draw [yshift=1.4cm, latex-latex](axis cs:2, 0) -- node [fill=white] {$0.683$} (axis cs:4, 0);     \draw [yshift=0.3cm, latex-latex](axis cs:1, 0) -- node [fill=white] {$0.954$} (axis cs:5, 0);               \end{axis}          \node[below] at (1, 0)  {$\mu - 2\sigma$};      \node[below] at (2, 0)  {$\mu - \sigma$};      \node[below] at (3, 0)  {$\mu$};                \end{tikzpicture}          \end{document}      ![enter image description here](http://i.stack.imgur.com/ZUnvh.png) **Issues**   1. Nodes are not properly placed.   2. How to remove y-axis?   3. How to draw vertical dotted line? Any help will be highly appreciated. Thanks


title: Simulate a scanned paper

text: I'm try to move my current paperwork routine towards a paperless workflow (for the “administrative” type of papers, of course… not for serious reading tasks). There is one major annoyance thwarting me: people sometimes require me to print, sign and scan documents. They will not allow me to insert my scanned signature in an electronic file (even converted to PDF). It's for unimportant papers (e.g., not for contracts!), it's a waste of time, but I cannot make them budge. Thus, **I want to design a filter that takes PDF files as input, and gives them a “scanned document” look**. What I have thought of so far:   1. Rasterization at not-so-great resolution. I have a ghostscript-based filter that does it, and I've used it a few times already. But, the documents keeps their “pristine” aspect: white background is still white, etc.   2. So, I considered getting a “scanned paper” texture from scanning a blank page, and apply it to my document. But: if I put it in front of the content with low opacity, the text might become too blurry; and if I put it behind the content, it works only if content has a fully transparent background (which is not always true for my documents).   3. Now, I'm thinking TeX/LaTeX would be great tools to do that, but I cannot translate this nice idea into specifics… So, what would you suggest?


title: How to produce a 3d surface plot by rotating the 2d plot of a function

text: What I want to do is to produce a 3d plot of a surface of revolution. So far I have achieved the following code...               \documentclass[border= 5mm]{standalone}     \usepackage{pgfplots}     \pgfplotsset{colormap={bluered}{rgb255(0cm)=(0,0,180);rgb255(1cm)=(0,255,255);rgb255(2cm)=(100,255,0);rgb255(3cm)=(255,255,0);rgb255(4cm)=(255,0,0); rgb255(5cm)=(128,0,0)}}      \begin{document}     \begin{tikzpicture}      \begin{axis} [colormap/bluered]     \addplot3 [surf,samples=100,domain=0:180,y domain=0:2*pi]({x},{sin(x)*cos(deg(y))},{sin(x)*sin(deg(y))});      \end{axis}      \end{tikzpicture}     \end{document}      This ends up in the function on sin(x) along the x axis, and rotated around the x axis again forming a lobe...The image is here: ![enter image description here](http://i.stack.imgur.com/sLRUN.jpg) What I need is... the function (let's say sin(x)), to be along the x axis but rotated around the z axis...(The image should be like the waves on the water when a rock falls in...for the sin(x)). Also there is a problem with the colours...It seems that those yellows on top shouldn't be there... Any solutions??? Thanks in advance!!! A.


title: setkomafont with uppercase that works robustly

text: I know that `\setkomafont` is supposed to deal with switching _fonts_ but sometimes instead of switching font, I'd like to switch to uppercase. I've not found a way to do this reliably. This breaks:               \documentclass{scrartcl}     \setkomafont{title}{\normalfont\uppercase}     \author{A. Author}     \title{The title}     \begin{document}     \maketitle     \end{document}      But this works:               \documentclass{scrartcl}     \setkomafont{section}{\normalfont\uppercase}     \author{A. Author}     \title{The title}     \begin{document}     \maketitle     \section{Something}     \end{document}      But this breaks:               \documentclass{scrartcl}     \setkomafont{disposition}{\normalfont\uppercase}     \author{A. Author}     \title{The title}     \begin{document}     \maketitle     \section{something}     \end{document}      Now, here's the one that's _really_ weird:               \begin{filecontents}{\jobname.bib}     @Book{sen70,       author =   {Amartya Sen},       title =    {Collective choice and social welfare},       publisher =    {Holden-Day},       year =     1970}     \end{filecontents}     \documentclass{scrartcl}     \setkomafont{section}{\normalfont\uppercase}     \author{A. Author}     \title{The title}     \bibliographystyle{plain}     \begin{document}     \maketitle          \section{Something}     \cite{sen70}     \bibliography{\jobname}     \end{document}      Now, this _kind of_ works in that the section heading is uppercased. But it _doesn't_ work in that the "References" is set lowercase. But it is set in `normalfont`... I know that `\uppercase` doesn't behave like a font switching command, but is there a robust way to do what I want? I guess I could create a virtual font with the capitals in place of the lc letters, but there _must_ be a better way...


title: Simple school style report headers

text: I want to use LaTeX to do a school paper. I need the professor name the class name and class time all to be in the upper right corner of every page. The `fancyhdr` package, at least in it's default configuration, lines the right header with the right margins (also it puts a line at the top of the page which won't fly with my professor who is picky.) How do I make a header that would fit the standard school format? `mla` package does it, but that by default forces me into a whole host of other formatting decisions.


title: How could I remove a header in a beamer presentation?

text: I'm editing a theme beamer, but I have a trouble I would like to remove the header without remove neither footer or the lateral navigation bar. I've tried with the follow option:               \defbeamertemplate*{headline}{split theme}     {           %nothing            }       but when I try to compile I receive the follow error:               ! LaTeX Error: Command \beamer@@tmpop@headline@split theme already defined.      I use theme `PaloAlto`. I hope that somebody can help me. EDIT by Marco Daniel: Here the solution presented as a minimal working example:               \documentclass{beamer}     \usetheme{PaloAlto}     \setbeamertemplate{headline}{}          \begin{document}     \section{foo}     \begin{frame}     \frametitle{bar}     Text     \end{frame}     \end{document}


title: Centre roman numbers in enumerate environment

text: I have an enumerated list that uses roman numbers.               \documentclass{article}     \usepackage{enumitem}          \begin{document}     \begin{enumerate}[label=\roman*]     \item first entry     \item second entry     \end{enumerate}     \end{document}      Unfortunately the 'i' and the 'ii' are now left-aligned. Is it possible to centre the enumerating column?


title: \usepackage{karnaugh} causes emergency stop

text: I'm using Latexian under OS X, and whenever I try to import the package `karnaugh`, I get an emergency stop, caused by the package not being found. I went into TexLive's package utility, and found that `karnaugh` is, in fact, installed. After attempting to reinstall it, I get the same issue. What's a possible fix for this?


title: mathpazo + siunitx: π turns into ß

text: When I use `mathpazo` and `siunitx` (version 2.3h) together, if I use `\pi` inside the numerical argument to `\SI`, it will show up in the output as "ß".               \documentclass{article}     \usepackage{mathpazo, siunitx}     \begin{document}         $\pi + \SI{\pi}{\ohm}$     \end{document}      Produces: ![wrong output](http://i.stack.imgur.com/WX8dS.png) But when I don't use `mathpazo`: ![correct output](http://i.stack.imgur.com/6fvUq.png) Why does this happen and how can I fix it?


title: How to do multiple string replacements?

text: I want to escape URL paths to obtain the percent-escaping that is also applied e.g. by browsers. For this purpose I tried to do the following (out-commented lines are meant to show what I'm aiming here):               \documentclass[a5paper]{article}     \usepackage{xstring}          \begin{document}          \newcommand{\urlescape}[1]{{%       \def\x{\StrSubstitute{#1}{\%}{\%25}}%       \def\x{\StrSubstitute{\x}{/}{\%2F}}%       % \def\x{\StrSubstitute{\x}{\&}{\%26}}%       % \def\x{\StrSubstitute{\x}{ }{\%20}}%       % \def\x{\StrSubstitute{\x}{\$}{\%24}}%       % \def\x{\StrSubstitute{\x}{+}{\%2b}}%       % \def\x{\StrSubstitute{\x}{,}{\%2c}}%       % \def\x{\StrSubstitute{\x}{:}{\%3a}}%       % \def\x{\StrSubstitute{\x}{;}{\%3b}}%       % \edef\x{\StrSubstitute{\x}{=}{\%3d}}%       % \def\x{\StrSubstitute{\x}{?}{\%3f}}%       % \def\x{\StrSubstitute{\x}{@}{\%40}}%       % \def\x{\StrSubstitute{\x}{"}{\%22}}%       % \def\x{\StrSubstitute{\x}{<}{\%3c}}%       % \def\x{\StrSubstitute{\x}{>}{\%3e}}%       % \def\x{\StrSubstitute{\x}{\#}{\%23}}%       % \def\x{\StrSubstitute{\x}{\{}{\%7b}}%       % \def\x{\StrSubstitute{\x}{\}}{\%7d}}%       % \def\x{\StrSubstitute{\x}{|}{\%7c}}%       % \def\x{\StrSubstitute{\x}{\^}{\%5e}}%       % \def\x{\StrSubstitute{\x}{\~}{\%7e}}%       % \def\x{\StrSubstitute{\x}{[}{\%5b}}%       % \def\x{\StrSubstitute{\x}{]}{\%5d}}%       % \def\x{\StrSubstitute{\x}{\`}{\%60}}%       \x}}          \urlescape{abcd/efgh\%foo\#bar baz}          \end{document}      ## Error messages However, that wouldn't work; I get               ! Use of \@xs@StrSubstitute@@ doesn't match its definition.     \kernel@ifnextchar ...rved@d =#1\def \reserved@a {                                                       #2}\def \reserved@b {#3}\f...     l.35 \urlescape{abcd/efgh\%foo\#bar baz}      So I thought well there's that strange `\edef` thingie from the TeX book so let's give it a try:               \newcommand{\urlescape}[1]{{%       \def\x{\StrSubstitute{#1}{\%}{\%25}}%       \edef\x{\StrSubstitute{\x}{/}{\%2F}}%     ...      But now I get the following which confuses me:               ! Argument of \reserved@a has an extra }.     <inserted text>                     \par     l.35 \urlescape{abcd/efgh\%foo\#bar baz}      Solution and question I searched and I found several hints where intricate combinations of magic potions à la `\noexpand`, `\unexpanded` got thrown into the mix; sadly, I was unable to extract from those solutions an incantation that would work for me (I've probably made it sufficiently clear by now that using TeX is more of an art than a science to me). Please do not hesitate to point out a package to do just this — URL escaping — but I think that the question of how to perform multiple replacements on strings in LaTeX is of a more general interest and I'm sure I'll need stuff like that quite often. ## Update **Explanation:** The question has been raised as the above list is so extensive; the simple answer is that I copy-and-pasted these characters from http://perishablepress.com/stop-using-unsafe-characters-in-urls/. In a more specific use-case, it will be possible and probably desirable to cut down the enumeration, depending on semantics and environment. as for semantics, it will normally make a difference whether you retrieve `http://example.com/foo/bar#baz` or `http://example.com/foo%2Fbar%23baz`; whether or not to escape `/` and/or `#` in such URLs is, as such, unpredictable, so I started out with a fairly maximal list.


title: Running Sample Tikz Code

text: I am running Ubuntu version 11.04 with `PGF` package version 2.00-1. I have trouble running this sample code posted to How to generate all possible Venn diagrams (with the case below) efficiently?               \documentclass{standalone}     %\url{http://tex.stackexchange.com/q/67395/86}     \usepackage{tikz}          \makeatletter          \def\venn@strip#1#2\venn@STOP{%       \def\venn@next{#1}%       \gdef\venn@rest{#2}%     }          \newcommand{\venn}[1]{%     \begin{tikzpicture}     \coordinate (A) at (0,0);     \coordinate (B) at (2,0);     \coordinate (C) at (1,{sqrt(3)});     \coordinate (S-SE) at (5,-3);     \coordinate (S-NW) at (-3,{sqrt(3)+3});       \edef\venn@rest{#100000000}%       \foreach \i in {0,...,7} {       \begin{scope}[even odd rule]         \expandafter\venn@strip\venn@rest\venn@STOP         \ifnum\venn@next=1\relax         \pgfmathparse{Mod(\i,2) == 1 ? "(S-SE) rectangle (S-NW)" : ""}         \path[clip] \pgfmathresult (A) circle[radius=2];         \pgfmathparse{Mod(floor(\i/2),2) == 1 ? "(S-SE) rectangle (S-NW)" : ""}         \path[clip] \pgfmathresult (B) circle[radius=2];         \pgfmathparse{Mod(floor(\i/4),2) == 1 ? "(S-SE) rectangle (S-NW)" : ""}         \path[clip] \pgfmathresult (C) circle[radius=2];         \fill[rounded corners,red] (S-SE) rectangle (S-NW);         \fi       \end{scope}       }         \draw[ultra thick] (A) circle[radius=2];         \draw[ultra thick] (B) circle[radius=2];         \draw[ultra thick] (C) circle[radius=2];         \draw[ultra thick,rounded corners] (S-SE) rectangle (S-NW);     \end{tikzpicture}     }          \makeatother          \newcommand{\allvendiagrams}{     % To generate the lot:     \foreach \j in {0,...,255} {       \def\venncode{}       \foreach \k in {0,...,7} {         \pgfmathparse{Mod(floor(\j/2^\k),2) == 1 ? "\venncode1" : "\venncode0"}         \global\let\venncode=\pgfmathresult       }       \venn{\venncode}          }     }          \begin{document}     \venn{10000000}     \venn{01000000}     \venn{11000000}     \end{document}      After I changed documentclass to `article`, I got this error               ! Package PGF Math Error: Unknown function `Mod'      I thought may be my version of `PGF` is old and therefore missing the `Mod` function. Did `sudo apt-get update` to get all missing updates, but the error did not go away. Do I need to upgrade the level of Ubuntu to a higher to get around this message? After replacing all instances of `Mod` with `mod` in above code, I got this error                  ! Illegal unit of measure (pt inserted).        <to be read again>                         ?        l.57 \venn{10000000}      I need help in getting around this error and getting this sample run successfully. The \venn command accepts a 8 digit binary string, goes over each digit and if a digit is 1, fills certain areas. For example, calling \venn{00000010} will fill everything in circle A which does not overlap with circle B or C. Code relevant to iteration of binary string:               \def\venn@strip#1#2\venn@STOP{%       \def\venn@next{#1}%       \gdef\venn@rest{#2}%     }            \edef\venn@rest{#100000000}%          \foreach \i in {0,...,7} {            \begin{scope}[even odd rule]         \expandafter\venn@strip\venn@rest\venn@STOP         \ifnum\venn@next=1\relax     ..............      I went through basic info about \def statement at http://en.wikibooks.org/wiki/TeX/def and confused about the \venn@STOP in \venn@strip after end of second argument and start of macro contents. All examples, I have seen have macro name followed by any optional arguments, immediately followed by contents of macro. In a call of \venn{00000010}, before start of the 'for' loop, \venn@rest will be assigned 0000001000000000. In the 1st iteration \venn@next will be assigned 0000001000000000(same as what was passed into first argument) and \venn@rest will be assigned ""(nothing), same as what was passed into second argument to \venn@strip which was \venn@STOP(which has not been defined at this point). The \ifnum statement expects in \venn@next either a 0 or 1 for the position in the binary string corresponding to current iteration. I don't see where in the code such stripping of digits is happening. The \relax directive asks TeX to do nothing. Not sure why we need \relax as part of \ifnum statement. On a call of \venn{00000010}, statements related to filling are                 \begin{scope}[even odd rule]     \path[clip] (S-SE) rectangle (S-NW) (A) circle[radius=2];     \path[clip] (B) circle[radius=2];     \path[clip] (C) circle[radius=2];     \fill[rounded corners,red] (S-SE) rectangle (S-NW);       \end{scope}      In iteration 2 of the for loop, \i = 1 and this is the only iteration which fills anything in the call. Based on what is mentioned in the PGF manual, a clipping path restricts painting to a certain area. Also, multiple clippings accumulate and clipping is always done against the intersection of all clipping areas that have been specified inside the current scope. The first clip statement, gives the circle at A as the clipping area. The second clip statement, gives the intersection of circle at A and B as the clipping area. The third third clip statement gives the intersection region of circles A, B and C as the clipping area. At the end when the rectangle is being filled, I expect the clipped area to be filled. Instead, what is filled is the area in circle A which is not overlapping with circle B or C. The even odd rule probably makes the fill to work the way it does. This rule is explained in the manual in terms of shooting rays and count how often we hit the path. I could not understand how to use it.


title: xepersian and qtree incompatibility?

text: I am a linguist and want to display trees. I tried the the following code.               \documentclass{article}          \usepackage{xepersian}          \usepackage{qtree}          \begin{document}     \begin{latin}     gshjgsdjgsad          \begin{figure}          \Tree     [.case nom gen dat acc ]          \end{figure}          \end{latin}          \end{document}      I called it with `xelatex`. This works without the `xepersian` package loaded but fails with the package loaded. With the package loaded, I just get the lines, but the words (case nom gen dat acc) are missing. I would be glad if you had any suggestions for me.


title: Unicode-math and \Re

text: I'm experimenting with Unicode-Math. I am using Neo-Euler with Concrete so I am generating my document with `xelatex`. I want `\Re` to give me the AMS- style double-lined `\mathbb{R}` but I am having trouble redefining `\Re` in my .cls. That is, using _test.cls_ at the bottom of this question I run this sample document and it works great; I see the double-lined R in all three places.               \documentclass{test}     % If \def here then it does not work.      \begin{document}     \def\Re{\mathbb{R}}     Hello.  $x=4\mathbb{R}$. Give me a $\Re$ and a $\R$.     \end{document}      However, if I move the `\def` to above the `\begin{document}` then I only see the double-lined R in two places and in the middle I get Knuth's `\Re`, the somewhat-fractur single-lined shape. In particular, putting my redefinition inside the .cls below has no effect. I expect there is some `\AtBeginDocument` at work, but I was unable to make it out. Is there some way to not have the `\def` inside the `\begin{document}`?               % test.cls          % --- Class structure: identification part     % ---     \ProvidesClass{ltest}[2012/09/10 version 0.01 Test unicode-math]     \NeedsTeXFormat{LaTeX2e}          % --- Class structure: initial code part     % ---               % --- Class structure: declaration of options part     % ---     % This class extends the article class     % Read all the documentclass options; pass them to article     %\DeclareOption*{\InputIfFileExists{\CurrentOption.tut}{}{%     %    \PassOptionsToClass{\CurrentOption}{report}}     \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}          % --- Class structure: execution of options part     % ---     \ProcessOptions \relax          % --- Class structure: declaration of options part     % ---     \LoadClass{article}          % --- Class structure: main code part     % ---          % Set the fonts     \usepackage{fontspec}     \setmainfont[Ligatures=TeX,  % CM-Super Concrete                  Path = /usr/local/texlive/2012/texmf-dist/fonts/type1/public/cm-super/,                  ItalicFont = sfoti10.pfb,                  SmallCapsFont = sfocc10]{sform10.pfb}          \usepackage[math-style=upright]{unicode-math} % see http://tex.stackexchange.com/questions/50995/font-mixup-with-neo-euler-and-fontspec     \setmathfont[Path=/usr/local/texlive/texmf-local/fonts/opentype/euler/]{euler.otf}     % \AtBeginDocument{\DeclareMathAlphabet\mathbf{U}{eur}{b}{n}} % fontspec manual p. 11; doesn't seem to do anything.     \setmathfont[range=\mathbb,                  Path=/usr/local/texlive/2012/texmf-dist/fonts/type1/public/amsfonts/symbols/]{msbm10.pfb}            \newcommand{\R}{\mathbb{R}}


title: page headings in scrbook and xepersian

text: I found the page about page numbers in `xepersian`, but the problem seems to be more general. I cannot get the page headings with `scrpage2` in the KomaScript classes to work. I tried the following:               \documentclass{scrbook}               \usepackage{hyperref}               \usepackage{xepersian}\renewcommand{\thepage}{\texorpdfstring{\lr{\arabic{page}}}{\arabic{page}}}          \usepackage{scrpage2}               \pagestyle{scrheadings}          \begin{document}     \begin{latin}          \chapter{First Chapter}          \section{Test 1}     Text          \newpage          \section{Test 2}          Text 2          \newpage          \section{Test 3}          \end{latin}          \end{document}      But this gives me Persian characters in the header.


title: Plotting experimental data using data files with 5 thousand lines?

text: I want to illustrate various experimental data in my thesis e.g.:   * X-ray powder diffraction data (thousand lines)   * FTIR data (5 thousand lines)   * TG-/DTA data (5 thousand lines)  and I am wondering how to get a decent and convenient workflow with satisfying results. I was playing with pgfplots and already be able to create a diagram for my XRD data (1k points) by expanding TeX memory size. But I failed to create a diagram for my FTIR experiments (5k points). Although I really want to present my diagrams in a consistent and qualitative manner it seems to me using pgfplots is somehow not really convenient for this kind of task?!   * In the case of pgfplots. How can I achieve to plot FTIR spectra with more than 5k points? Is it convenient to use pgfplots for this kind of task and if not...   * What would you recommend best for good workflow in combination with a considerable result for a lot of diagrams in my thesis?  My workflow so far: For preparation, I used qtiplot to normalize and transform plot data to show various plots in comparison in one diagram. After that I exported this manipulated data table to a .txt file.               \documentclass[a4paper,10pt]{article}     \usepackage[latin9]{inputenc}     \usepackage[T1]{fontenc}     \usepackage{pgfplots}     \pgfplotsset{compat=newest}     %opening     \title{XRD pattern with pgfplots}     \author{Max Muster}          \begin{document}     \maketitle     \section{section with pgfplots-test}     \begin{tikzpicture}       \axis[     x dir       = reverse,     xlabel      = pgftemplate,     xmin        = 350,     xmax        = 4000,     yticklabels =     ]       \pgfplotstableread{overview.txt}         \datatable     \addplot[color=black,mark=none] table[y = 1st plot, header = false] from \datatable ;     \addplot[color=black,mark=none] table[y = 2nd plot] from \datatable ;     \addplot[color=black,mark=none] table[y = 3rd plot] from \datatable ;     \addplot[color=black,mark=none] table[y = 4th plot] from \datatable ;     \addplot[color=black,mark=none] table[y = 5th plot] from \datatable ;       \endaxis     \end{tikzpicture}          \end{document}


title: biblatex-apa and babel losing the ampersand with option spanish

text: I'm trying to use the package biblatex-apa with babel. It is working except that the APA style requires that parenthetical citations and bibliography references separate the last author by "&" and not by "and". The following shows the options I'm using:               \usepackage[spanish]{babel}     \usepackage{csquotes}     \usepackage[style=apa]{biblatex}     \DeclareLanguageMapping{spanish}{spanish-apa}      However, though `apa.bbx` is meant to handle it, instead of "&" it is compiling with "y" (Spanish for and). How can I manage to compile according to the APA style requirements?


title: tikz does not plot correctly

text: @Jake: this is the whole document                   \documentclass[11pt, a4paper]{book}         \usepackage{amssymb}         \usepackage{amsmath}         \usepackage{amsthm}         \usepackage{tikz}         \usepackage{pgfplots}         \usepgflibrary{arrows}         \usepackage{pgf}         \usepackage{Tikz-exp}                   \parindent=0pt              \begin{document}              \begin{tikzpicture}         \tikzset{x={(.965cm,-.258cm)}, y={(.7cm,.7cm)}, z={(0cm,1cm)},         sezioni/.style={draw=#1!60, thin, fill=#1!30, fill opacity=0.3},         scale=1.75         }         \coordinate (O) at (0,0,0) node [left] {$O$};         \draw[gray,->] (-2,0,0) -- (2,0,0) node [right, black] {$x$};         \draw[gray, ->] (0,-2,0) -- (0,2,0) node [right, black] {$y$};         \draw[gray, ->] (O) -- (0,0,3) node [left, black] {$z$};              %=====% sezioni %=====%         \foreach \x in {-1,-.85,...,1}             \draw[sezioni=teal] (\x,{sqrt(1-(\x)^2)},0)--(\x,0,{sqrt(4*(1-(\x)^2))})--(\x,{-sqrt(1-(\x)^2)},0)--(\x,{sqrt(1-(\x)^2)},0);         %=====================%              \draw[blue] (O) circle (1);         \draw[red, domain=-1:1, samples=500] plot (\x,0,{sqrt(4*(1-(\x)^2))});         \end{tikzpicture}                        \end{document}      The red map in x=1 should produce the value zero, but it is positive.


title: add texmf tree to TeX Live

text: I'm new to TeX Live. I know in MiKTeX it's very easy to add multiple paths using "MiKTeX Settings". But how can I do this in TeX Live? The directory I want to add is               /usr/share/R/share/texmf      It's created by the R application, so I don't want to move it.


title: How do I force multicols environment to use first column when called from within a minipage

text: I understand how to get `multicol` package to use the entirety of the first column before moving to the next:               \begin{multicols*}{3}      ....     \end{multicols*}      which is mentioned in section 2.2 of the manual. But it also mentions in that section that the starred environment _"only works on top-level."_ The manual explains that _"inside a box one has to balance to determine a column height in absence of a fixed value."_ What I would like to know is whether there's a way to get around this when the height of the containing box is known. In other words, if I would like to write something like               \begin{minipage}[t][4in]{10in}     \begin{multicols*}{3}     ....     \end{multicols*}     \end{minipage}      and get the `multicol` package to think that it's on a page of the specified height. Does anyone know any work arounds? I know I could use `\newgeometry` for a given page. But, my headers and footers get moved around and I'm not happy with that. Moreover, I generally don't want to dedicate entire pages to this multicolumned format. Here's an example of what the page design should look like. While it might be hard to tell from the image. This is an 8.5x11 page in landscape. ![enter image description here](http://i.stack.imgur.com/I3ZTl.png) Here's the MWE which created this image. This is a very odd page design, but it meets the needs for the finished document.               \documentclass{article}     %--------------------     \usepackage[top=0.35in,bottom=0.35in,width=4in,landscape,includefoot,includehead]{geometry}     %--------------------     \usepackage{fancyhdr}     \renewcommand{\headrulewidth}{0.4pt}     \renewcommand{\footrulewidth}{0.4pt}     \lhead{Left}\rhead{Right}     \pagestyle{fancy}     %--------------------     \usepackage{multicol}     \setlength{\columnseprule}{0.4pt}     \setlength{\columnsep}{0.25in}     %--------------------     \usepackage{lipsum}     \begin{document}          \lipsum[1]     \vspace{2ex}          \noindent     \hspace*{\dimexpr\textwidth/2}%     \hspace*{-5in}%     \begin{minipage}{0pt}       \begin{minipage}[t][2.85in]{10in}         \begin{multicols*}{4}             \lipsum[1-2]             \vspace{2in}                          \vspace{2.85in}~             \hspace*{\fill}.         \end{multicols*}       \end{minipage}     \end{minipage}          \vspace{2ex}     \lipsum[2]          \end{document}      The document is deliberately designed to have extremely large margins---so the headers and footers should similarly not span the entire page to preserve the appearance of massive margins. Obviously I can achieve the effect I want, but I don't want to have to go through each of these _multi-column_ insets and manually place sufficient struts to properly fill up the height of the box. Incidentally, the final `\hspace*{\fill}.` in the `multicols` environment is only inserted there so that, when I cropped the image, the cropping didn't knock off too much of the empty space. # Two ideas: I have two ideas about how to accomplish this. But I don't have any idea of how to implement either. **Preliminaries** Though for the final version I would like to be able to choose how many columns I need, for the sake of explaining my ideas, I'll assume that I'm working with 4 columns of text. Let's say that the total width of the environment is `W` and that the `\columnsep` is set to `s`. Then one column of text within the environment should have a width of `C=(W-3s)/4`. Let's say that height of the environment is `H`. Since I'm formatting four columns of text, where each column has height `H`, the total effective height of each column, if stacked on top of each other combined, is close to `4H`. **First Idea** The first formats a multi-column environment under a single run with `pdflatex`. The idea is as follows: (1) First format the text as though it were just one column of width `C` I could do that something like:               \begin{lrbox}{\aebox}       \begin{minipage}{<width=C>}       ....TEXT....       \end{minipage}     \end{lrbox}      (2) Measure the height of this column of text, call that `h`               \setlength{<height=h>}{\dimexpr\dp\aebox+\ht\aebox\relax}          (3) If `h>4H`, then I've got problems. I'm not interested in considering this case. (4) If `h<4H`, then I look at the difference `4H-h` and create as many **struts** of height `H` that will fit in `4H-h` and one **remainder strut** of height `4H-h modulo H` Suppose the columns are lettered, from left to right, as `A`, `B`, `C`, and `D`. Then I will have lengths               \aestrutDheight           \aestrutBheight           \aestrutCheight           \aestrutRheight <remainder height>          <PSEUDO-CODE>     let L=4H-h          while L > H     {       <set a length for each iteration>       \setlength{\aestrut[DBC]height}{<height=H>}       L=L-H     }     \setlength{\aestrutRheight}{L}      (5) Reprocess the text but with the the **remainder strut** and other **struts** appended. The _pseudo_ -code here is for the case where I have enough text to span 3 columns, but not 4.               \begin{minipage}[t][<height=H>]{<width=C>}     \begin{multicols*}{4}     ....TEXT....          \rule{0pt}{\aestrutRheight}          \rule{0pt}{\aestrutDheight}     \end{multicols*}     \end{minipage}      Generally, I think I can do this except for the very last step. Once I've used the text, I've lost it and don't know how to reprocess it. **Second Idea** This idea is very similar to the first. But requires two passes of `pdflatex`. (1) Try formatting the text as 4 columns of balanced text               \begin{lrbox}{\aebox}     \begin{minipage}{<width=W>}     \begin{multicols}{4}     ....TEXT....     \end{multicols}     \end{minipage}     \end{lrbox}      (2) Measure the height of this box. (3) Calculate the different of betweeen this height and the target height. (4) Calculate the lengths of the necessary struts, but write this out to a `log` file. (5) On the second rerun of `pdflatex`, read in the log file and then format the text as               \begin{minipage}[<height=H>]{<width=W>}     \begin{multicols*}{4}     ...TEXT...     <insert struts determine by `log` file>     \end{multicols*}     \end{minipage}      But I don't know how to write this information to a `log` file or how to read in from the `log` file to create the necessary struts. > UPDATE: The start of a workable solution, but not quite there. I've created the following work around. But there are several things about it that I can't get right:               \begin{filecontents}{content.tex}       Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,       vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum       gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate       a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi       tristique senectus et netus et malesuada fames ac turpis egestas. Mauris       ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna       fringilla ultrices. Phasellus eu tellus sit amet tortor gravida       placerat. Integer sapien est, iaculis in, pretium quis, viverra ac,       nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi       dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor       semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu,       accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci       dignissim rutrum.            Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel,       wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis       vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan bibendum,       erat ligula aliquet magna, vitae ornare odio metus a mi. Morbi ac orci et       nisl hendrerit mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a     \end{filecontents}     \documentclass{article}     %--------------------     \usepackage[top=0.35in,bottom=0.35in,width=4in,landscape,includefoot,includehead]{geometry}     %--------------------     \usepackage{xcolor}     \usepackage{fancyhdr}     \renewcommand{\headrulewidth}{0.4pt}     \renewcommand{\footrulewidth}{0.4pt}     \lhead{Left}\rhead{Right}     \pagestyle{fancy}     %--------------------     \usepackage{multicol}     \setlength{\columnseprule}{0.4pt}     \setlength{\columnsep}{0.25in}     %--------------------     \usepackage{lipsum}          \usepackage{xparse}          \newlength\aetmpdima     \newlength\aetmpdimb     %% Loop to reduce the height to below max value     \def\whileloop#1#2%       {\aetmpdima#1%        \aetmpdimb#2%        \ifdim\aetmpdima>\aetmpdimb\relax           \aetmpdima\dimexpr\aetmpdima-\aetmpdimb\relax           \whileloop\aetmpdima\aetmpdimb        \fi        #1\aetmpdima       }          \newlength{\myenvWIDTH}     \newlength{\myenvHEIGHT}     \newlength{\myenvREMAINDER}     \newlength{\myenvSTRUT}     \newcommand{\myenvCOLCNT}{4}     \setlength{\myenvWIDTH}{10in}     \setlength{\myenvHEIGHT}{2.25in}     \setlength{\myenvSTRUT}{0pt}     \newsavebox{\singlecolumnbox}     \NewDocumentCommand{\aecols}{ m }       {         %% create a box the width of one column         \begin{lrbox}{\singlecolumnbox}%           \begin{minipage}{\dimexpr(\myenvWIDTH-\number\numexpr\myenvCOLCNT-1\relax\columnsep)/\myenvCOLCNT}             \input{#1}%           \end{minipage}%         \end{lrbox}%         %% reduce lengths to get lengths of the struts         \setlength{\myenvREMAINDER}{\dimexpr\myenvCOLCNT\myenvHEIGHT-(\ht\singlecolumnbox+\dp\singlecolumnbox)\relax}%         \ifdim\myenvREMAINDER>\myenvHEIGHT\relax           \setlength{\myenvSTRUT}{\myenvHEIGHT}\fi                   \whileloop{\myenvREMAINDER}{\myenvHEIGHT}%         %% format the multicolumn environment         \noindent         \begin{minipage}[t][\myenvHEIGHT]{\myenvWIDTH}%         \noindent         \begin{multicols}{\myenvCOLCNT}%             \raisebox{0pt}[0pt][0pt]{\textcolor{gray!60}{\rule[\dimexpr-\myenvHEIGHT+2ex]{4pt}{\myenvHEIGHT}}}             \input{#1}             \textcolor{blue}{\rule{4pt}{\dimexpr\myenvREMAINDER}}             \textcolor{red}{\rule{4pt}{\dimexpr\myenvSTRUT}}         \end{multicols}%         \par\xdef\tpd{\the\prevdepth}         \end{minipage}%         \par\prevdepth\tpd     }          \begin{document}          \lipsum[1]     \vspace{2ex}          \noindent\hspace*{\dimexpr\textwidth/2-\myenvWIDTH/2}%     \rule{\myenvWIDTH}{5pt}          \noindent\hspace*{\dimexpr\textwidth/2-\myenvWIDTH/2}%     \aecols{content}          \vspace{2ex}     \lipsum[2]          \end{document}      ![enter image description here](http://i.stack.imgur.com/ABEvD.png) The first problem is I can't seem to get `\vspace` to work correctly. So, I have to use `\rule`. In this above example, I've given width different from `0pt` only to help them be visible for development purposes. Similarly, the gray strut at the beginning is only there for development purposes. The second problem, I sometimes get multiple overful `vbox` errors: apparently caused by my struts, but only for certain values of the parameters. (Can't seem to reproduce them right now, though.) When I do get the errors, there are far more than struts I've created. Sorry I can't reproduce them right now. :( Third problem, I can't get the spacing after the environment to work out correctly. I tried the `\prevdepth` trick, but it's not working here. Fourth, not so much a problem, I'm getting around the issue of having to reformatting the same text by reading the text in twice from an outside file. I can live with this, but it would be nice if I didn't have to go this route. Any suggestions about how to fix any of this? _PS_ If I can _rediscover_ the parameter values which cause the `vbox` errors, I'll post them in the comments following this question.


title: How to typeset the symbols for charged particles?

text: Maybe this question will seem trivial, but I was wondering how you people typeset symbols for charged particles? I was thinking here in particular about the _electron_ , the _proton_ and the _neutron_. This is how I do them:               $e^-$     $p^+$     $n^0$      This looks pretty good imho, but maybe you have another favourite (or more scientific) way of doing it?


title: Can I enlarge lines in TikZ?

text: I'm currently creating lecture notes for "Geometry and Topology". As we now arrived at part about euclidean geometry, I quite often have the situation that I need to visualize lines (not line segments, but lines). For example, I have the following image (the code is at the end) ![enter image description here](http://i.stack.imgur.com/SLCiP.png) But `PQ` should be a line, so I need to "enlarge" the line segment `PQ`. Usually, I would calculate the equation of PQ like this               m = (P.y - Q.y)/(P.x - Q.x) -- mind the special case of P.x = Q.x     P.y = m * P.x + t     <=> t = P.y - m*P.x      Then I would add two helping points `A` and `B`:               (enlarge by 0.5)     A.x := P.x - 0.5      B.x := Q.x + 0.5     A.y = m*A.x + t     B.y = m*B.x + t      And finally I would draw the line `A - P - Q - B` which is my "enlarged line 'PQ'". But this seems to be quite complicated to me for a task that could be done automatically. So is there a way in TikZ to enlarge lines?               \documentclass[varwidth=true, border=2pt]{standalone}     \usepackage{tikz}          \begin{document}     \begin{tikzpicture}         \tikzstyle{point}=[circle,thick,draw=black,fill=black,inner sep=0pt,minimum width=4pt,minimum height=4pt]         \node (P)[point,label={[label distance=0cm]-90:$P$}] at (0,0) {};         \node (Q)[point,label={[label distance=0cm]-90:$Q$}] at (5,1) {};         \node (A)[point,label={[label distance=0cm]180:$\varphi_1(R)$}] at (2,2) {};         \node (B)[point,label={[label distance=0cm]190:$\varphi_2(R)$}] at (1,3) {};              \draw[very thick, enlarge] (P) edge node  {} (Q);         \draw[very thick, red] (P) edge node {} (A);         \draw[very thick, red] (P) edge node {} (B);         \draw[very thick, green] (Q) edge node {} (A);         \draw[very thick, green] (Q) edge node {} (B);     \end{tikzpicture}     \end{document}


title: Put image in subfig's subfloat caption

text: I need to put an image "tinyimage" inside the caption of a subfloat of the subfig package. Minimal _not_ working example:               \documentclass{scrbook}     \usepackage{graphicx}       \DeclareGraphicsExtensions{.pdf}     \usepackage{subfig}          \begin{document}       \begin{figure}         \subfloat[\includegraphics{tinyimage}]{\includegraphics{bigimage}}       \end{figure}     \end{document}      So far I tried the following:   * put a \protect{} around the \includegraphics{} in the caption.   * store the \includegraphics{} in a \savebox and put \usebox in the caption.  The error I get is:               Argument of \sf@@@subfloat has an extra }. ...phics{tinyimage}]{\includegraphics{big image}}


title: How can I customise memoir's index to have more than two columns?

text: Is it possible to customise `memoir`'s index so that it has more than two columns? My index entries are single Chinese characters, so even `\twocolindex` results in way too much whitespace.


title: Relative padding of a minipage's paragraph

text: ## Background Created a custom command for rendering quotations (epigraphs). ## Problem The text in the following image has no space at the border: ![enter image description here](http://i.stack.imgur.com/xYItJ.png) The word "and" is flush with the right margin. ## Code               % Double-line for start and end of epigraph.     \newcommand{\epiline}{\hrule \vskip -.2em \hrule}     % Massively humongous opening quotation mark.     \newcommand{\hugequote}{%       \fontsize{42}{48}\selectfont\color{quotationmarkcolour}\textbf{``}%       \vskip -.5em%     }          % Make the box around quotations fit snugly to the epilines.     \setlength\fboxrule{0pt}     \setlength\fboxsep{0pt}          % Beautify quotations.     \newcommand{\epigraph}[2]{%       \vskip -1.5em%       \colorbox{quotationcolour}{%         \begin{minipage}{\linewidth}%         \hangindent 1.1em%         \epiline \vskip 1em {\hugequote} \vskip -.5em%         \parindent 2.2em%         \setlength\marginparsep{-1.1em}%         #1\begin{flushright}\color{quotationmarkcolour}\textsc{#2}\hspace*{1em} ~\end{flushright}%         \epiline%         \end{minipage}%       }%       \bigskip     }      ## Question How would you fix the above code to adjust the inner margins of the minipage so that the word "and" (and the quotation marks) is no longer flush with the edge of its containing box, but inset by, say, **1.1em**? ### Ideas   * Used `\begin{quotation}#1\end{quotation}`; it added too much left and right padding.   * `\addtolength\rightmargin{-1.1em}%`.   * Various `\begin{minipage}{\linewidth}%` settings.


title: question regarding comment section{\usepackage{rotating}}

text: My program is showing error at 1.29 line `section{\usepackage{rotating}}`. What should i do? my code is               \documentclass[12pt]{report}     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     \setlength{\textwidth}{6.25in} % original 6.25     \setlength{\textheight}{8in}     \renewcommand{\baselinestretch}{1.3}          \oddsidemargin 20pt    %  Left margin on odd-numbered pages.     \evensidemargin 20pt   %  Note that \oddsidemargin = \evensidemargin     \topmargin 0pt     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     \usepackage{fancyheadings}     \pagestyle{fancy}     \lhead{}     \chead{}     \rhead{Comparative Analysis Of Particle Filtering Techniques}     \lfoot{Ramrao Adik Institute of Technology}     \cfoot{}     \rfoot{\thepage}     \renewcommand{\headrulewidth}{0.4pt}     \renewcommand{\footrulewidth}{0.4pt}     \usepackage {graphics}     %\usepackage {algorithm}     %\usepackage {algorithmic}     \usepackage {epsfig}     \usepackage {graphicx}     \usepackage{amsmath}     \usepackage{slashbox}     \section{\usepackage{rotating}}     \usepackage{lscape}     \usepackage{pdflscape}     \usepackage{subfig}     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     \begin{document}     \begin{titlepage}     \input{Cover}     \end{titlepage}     \pagenumbering{gobble}     \input{approvalsheet1}\thispagestyle{plain}     \input{coa_examiner}     \input{approvalsheet}     \newpage     \input{acknowledgement}     \pagenumbering{roman}     \newpage     \tableofcontents\thispagestyle{empty}     \listoffigures     \listoftables     \newpage     \input{abstract}     %\pagestyle{headings}     \pagenumbering{arabic}     \setcounter{page}{1}     \input{Chapter1}     \input{Chapter2}     \input{Chapter3}     \input{Chapter4}     \input{Chapter5}     \input{bibliography}     \end{document}          %\input{performance}     %\input{obsmanual}     %\input{simulation}


title: How to make \include work with a quoted string path containing spaces?

text: In Windows, `\input` can work with a quoted string path containing spaces, but `\include` cannot. How to fix it?               \documentclass{book}     \begin{document}          %\input works!     \input{"Contents/Installing and Configuring IIS 7/Configuring Security"}          %but \include does not work!     %\include{"Contents/Installing and Configuring IIS 7/Configuring Security"}     \end{document}


title: Removing legend box (border) in pgfplots

text: I'm attempting to remove or 'turn off' the legend border in pgfplots, but I can't seem to figure out how to do it. I assume it will look something like this:               \begin{axis}[ legend style={?}]      where ? is a property related to the legend border (or box) that I can't seem to find. The pgfplots help is really great, but I haven't seen this addressed anywhere. Does anyone know how to accomplish this simple task?


title: How to make a \cline or \cmidrule narrower?

text: I'm trying to copy this table into TeX: ![Table](http://i.stack.imgur.com/ezgVe.png) I have problems with the horizontal lines under "Gaussian" etc. When I specify three `\cmidrule`'s, they are not separated but are combined into one big `\midrule` or `\cline`. It would be great if someone could show me how to narrow down such a `\cmidrule`. Thanks in advance! Here's the (spaghetti) code I use:               \documentclass[bibtotoc,liststotoc,BCOR5mm,DIV12]{scrbook}      \usepackage[utf8]{inputenc}     \usepackage{graphicx}     \usepackage{colortbl,array} % für farbige cells     \usepackage{multirow,bigdelim}     \usepackage{booktabs}          \begin{document}          \begin{table}[htb]     \resizebox{\textwidth}{!}{     \begin{tabular}{lr rrrrrr rrrrrr rrrr}     \toprule     $f$ & $n$ & \multicolumn{6}{l}{Gaussian} &  \multicolumn{6}{l}{Binomial Logit} & \multicolumn{4}{l}{Survival} \\ \cmidrule{3-8} \cmidrule{9-14} \cmidrule{15-18}      & & \multicolumn{2}{l}{FP}  & \multicolumn{2}{l}{GCV} & \multicolumn{2}{l}{REML} & \multicolumn{2}{l}{FP} & \multicolumn{2}{l}{GCV} & \multicolumn{2}{l}{REML} & \multicolumn{2}{l}{FP} & AIC & REML \\       &  & \makebox[1cm][l]{FP2}      & \makebox[1cm][l]{FP4} & \makebox[1cm][l]{LRSS} & \makebox[1cm][l]{PS} & \makebox[1cm][l]{LRSS} & \makebox[1cm][l]{PS} & \makebox[1cm][l]{FP2} & \makebox[1cm][l]{FP4} & \makebox[1cm][l]{LRSS} & \makebox[1cm][l]{PS} & \makebox[1cm][l]{LRSS}      & \makebox[1cm][l]{PS} & \makebox[1cm][l]{FP2} & \makebox[1cm][l]{FP4} & \makebox[1cm][l]{PS} & \makebox[1cm][l]{PS} \\ \midrule      & 100 & \cellcolor[gray]{0.8} 0.012 & \cellcolor[gray]{0.8} 0.012 & 0.021 & 0.025 & 0.018 & 0.018 & 0.043 & \cellcolor[gray]{0.8} 0.042 & 0.146 & 0.194 & 0.074 & 0.076 & \cellcolor[gray]{0.8} 0.015 & 0.016 & 0.427 & 0.019 \\      $f_1$ & 500 & 0.004 & \cellcolor[gray]{0.8} 0.002 & 0.006 & 0.006 & 0.004 & 0.004 & 0.014 & \cellcolor[gray]{0.8} 0.011 & 0.030 & 0.034 & 0.028 & 0.028 & 0.020 & 0.007 & 0.024 & \cellcolor[gray]{0.8} 0.005          \end{tabular}     }     \end{table}          \end{document}


title: How to insert a keyword with accents (extendedchars) in listings

text: This is what I would like to do:               morekeywords={SENÃO, ENTÃO, FAÇA, ATÉ, ENQUANTO, PARA, SE, DECLARA, DECLARE, E, OU, FIM_ENQUANTO, FIM_PARA}      I'm defining a new language, and I would like to use natural language words as keywords. The problem is with keywords: `SENÃO, ENTÃO, FAÇA, ATÉ`. I have solved the first problem, in showing special chars with: How to insert code with accents with listings? The `alsoletter` here, doesn't work for me, I got an error when using it: `alsoletter={Ç,É,Ã}`. **test.tex**               \documentclass{article}          \usepackage[brazilian]{babel}     \usepackage[T1]{fontenc}      \usepackage[utf8]{inputenc}     \usepackage{listingsutf8}          \usepackage{listings}          \lstset{%             inputencoding=utf8,             extendedchars=true,             literate=%             {é}{{\'{e}}}1             {è}{{\`{e}}}1             {ê}{{\^{e}}}1             {ë}{{\¨{e}}}1             {É}{{\'{E}}}1             {Ê}{{\^{E}}}1             {û}{{\^{u}}}1             {ù}{{\`{u}}}1             {â}{{\^{a}}}1             {à}{{\`{a}}}1             {á}{{\'{a}}}1             {ã}{{\~{a}}}1             {Á}{{\'{A}}}1             {Â}{{\^{A}}}1             {Ã}{{\~{A}}}1             {ç}{{\c{c}}}1             {Ç}{{\c{C}}}1             {õ}{{\~{o}}}1             {ó}{{\'{o}}}1             {ô}{{\^{o}}}1             {Õ}{{\~{O}}}1             {Ó}{{\'{O}}}1             {Ô}{{\^{O}}}1             {î}{{\^{i}}}1             {Î}{{\^{I}}}1             {í}{{\'{i}}}1             {Í}{{\~{Í}}}1     }          \lstdefinelanguage{pseudo}     {     extendedchars=true,     alsoletter={_},     morekeywords={ENQUANTO,PARA,SE,SEN\~{A}O,ENTÃO,ATÉ,FA\c{C}A,DECLARA,DECLARE,E,OU,FIM_ENQUANTO,FIM_PARA,FAÇA},     ndkeywords={NUMERO,TEXTO,LEIA,ESCREVA},     sensitive=true,     morecomment=[l]{//},     morecomment=[s]{/*}{*/},     morestring=[b]"     }          \begin{document}     \lstinputlisting[language=pseudo]{foo.pseudo}     \end{document}      **foo.pseudo**               ENQUANTO nota != -1 FAÇA     // Comment example      LEIA nota      SE nota >= 7 ENTÃO        ESCREVA "Aprovado"      SENÃO        ESCREVA "Reprovado"        TEST "Algo mais"     /*     mais      comentário     */          FIM_ENQUANTO       I have seen:   * Using special characters as keywords in latex listings package   * How to insert code with accents with listings?


title: Figure Captions contain lots of underscores

text: I am using the following code to produce a document as in attachment. The problem is that latex does not begin with the new line in caption. Maybe because of _. Is there any way to fix the problem? Thanks a lot!!                \documentclass[obeyspaces,spaces,a4paper,fleqn]{report}      \usepackage{caption}           \captionsetup{aboveskip=6pt, format = hang, justification = raggedright, singlelinecheck = false, labelfont=bf}            \begin{document}      \begin{figure}[H]           \setlength{\unitlength}{1cm}           \begin{picture}(16.5,12.3773)      \put(0,0){\includegraphics[scale=0.25798]{io_dme_PDFs/00000000005_ADC.pdf}}      \end{picture}           \caption{\small io\_dme/IO\_DME/HardwareInterface/HWI/ADC\_io\_dme/IO\_DME/HardwareInterface/MappingToHardware/DIG\_OUT/DS2211\_02\_07\_DIG[0\textbar 1]\_io\_dme/IO\_DME/HardwareInterface/MappingToHardware/DIG\_OUT/DS2211\_02\_07\_DIG[0\textbar 1]}      \label{iodme/IODME/HardwareInterface/HWI/ADC}           \end{figure}      \end{document}      ![caption with lot of _](http://i.stack.imgur.com/uT9hu.png)


title: How to change the color of subtrees in tikz-qtree?

text: Is there an elegant way to color subtrees in tikz-qtree, without going through each of the respective nodes and edges by hand? The following code example shows the ugly way:               \documentclass{standalone}                \usepackage{tikz-qtree}       \begin{document}          \tikz{       \Tree      [.A          [.B D ]         [.\node[text=red]{C};              \edge[draw=red];\node[text=red]{E};              \edge[draw=red];\node[text=red]{F}; ]        ]     }          \end{document}      Instead I would like to fix the color of a subtree just in one place, for example at its root node (hence at 'C' in the code example). Any suggestions?


title: Empty page inserted with pspicture environment

text: From the question How can I design a book cover, I tried to compile the code from Dean Serenevy.               \documentclass{article}     \usepackage[]{graphicx}     \usepackage{pstricks}          \begin{document}     \thispagestyle{empty}     \psset{unit=1in}     \begin{pspicture}(7,9.5)% use your page size       \rput[b](3.5,8){\parbox{5in}{\begin{flushright}         \Huge\bfseries\sffamily Awk one-liners\\ Explained         \end{flushright}}}       \uput[-90](3.5,8){\color{red}\rule{5in}{1ex}}       % ...     \end{pspicture}          \end{document}      This is the pdf file generated. The problem is that I have a blank page, and I can't remove the line number with `\thispagestyle{empty}`. What might be wrong? ![enter image description here](http://i.stack.imgur.com/BtwVJ.png)


title: Theorem formatting

text: \theoremstyle{remark} \newtheorem{example}{Example}      Then:               \begin{example}     Some text     \end{example}      Output is:               Example 1. Some text      What is the way to automatically obtain without indent:               Example 1.     Some text      ? I tried to write:               \begin{example}     \\Some text     \end{example}      But there are two drawbacks, first it must be done every-time, second drawback is that it doesn't compile and Latex error is:               ./doc.tex:60:There's no line here to end.\\S


title: Define color in margin notes

text: When I define colored margin notes, the place of the note disturbs. what should I do to make it correct? Please note that I want only some texts be colored, not all the text in the margin.               %     % ==========        Document Class     %     \documentclass[standalone]{article}     %     % ==========        Packages and their Options     %      \usepackage{marginnote}     \usepackage{geometry}     \usepackage{ifthen}     \usepackage{lastpage}     \usepackage{fancyhdr}     \usepackage{textcomp}     \usepackage{url}     \usepackage{color,hyperref}     \usepackage{marvosym}     \usepackage{datetime}          \usepackage{background}     \usetikzlibrary{calc}     \backgroundsetup{     color=black,     scale=1,     opacity=2,     angle=0,     contents={\tikz\draw[line width=1pt,rounded corners,black]       ( $ (current page.south east) + (-0.35,1.35) $ ) rectangle ( $ (current page.north west) + (0.35,0.35) $ );}     }          \definecolor{darkblue}{rgb}{0.0,0.0,0.3}     \definecolor{darkcandyapplered}{rgb}{0.64, 0.0, 0.0}          \hypersetup{colorlinks,breaklinks,                 linkcolor=darkblue,urlcolor=darkblue,                 anchorcolor=darkblue,citecolor=darkblue}     \hypersetup{pdfpagemode=UseNone}     %     % ==========        Document Begins     %     \begin{document}     %     % ==========        Current Positions     %      \noindent some text here.some text here.some text here.some text here.some text here.some text here.     \reversemarginpar\marginpar{\raggedleft {\large \bf \color{darkcandyapplered} Titles here.} \\*[-.8pc]}     \\some text here.some text here.some text here.some text here.some text here.some text here.     \end{document}      Before omitting `\color{darkcandyapplered}`, the incorrect form: ![enter image description here](http://i.stack.imgur.com/IDlMd.png) After omitting that code, the correct form: ![enter image description here](http://i.stack.imgur.com/CQOdV.png)


title: Blank page disappeared between chapters after chapter 2

text: I use LaTeX with the document class 'book'. I'd like a blank page between chapters but it works only after chapter 1. I've tried to force a blank page with `\newpage`, `\clearpage` and `\cleardoublepage` and nothing happens. How can I add a blank page? Why are they not included automatically after chapters? Here is my `document.tex`:               \documentclass[a4paper,11pt]{book}          \usepackage{./estilos/estiloBase}      \usepackage{./estilos/colores}       \usepackage{./estilos/comandos}          \graphicspath{{./imagenes/}}          \begin{document}          \pagestyle{empty}     \input{portada.tex}     \cleardoublepage          \input{primerahoja.tex}     \cleardoublepage     \pagestyle{plain}          \frontmatter           \input{previo.tex}     \cleardoublepage          \tableofcontents     \listoffigures     \listoftables          \mainmatter           \chapter{Introducción}     \label{cap:introduccion}     \input{cap1.tex}          \chapter{Descripción general del proyecto}     \label{cap:descripcion}     \input{cap2.tex}          \chapter{Contexto}     \label{cap:contexto}     \input{cap3.tex}     ...          \appendix     \cleardoublepage     \addappheadtotoc     \appendixpage     \chapter{Manual de usuario}     \label{cap:manusuario}          \backmatter          \chapter*{Software utilizado}     \addcontentsline{toc}{chapter}{Software utilizado}     \input{programas.tex}          \cleardoublepage          \addcontentsline{toc}{chapter}{Bibliografía y referencias}     \bibliographystyle{unsrt}     \bibliography{bibliografia}          \input{fdl-1.3.tex}     \end{document}


title: Run a shell script from a PDF generated by LaTeX

text: I have a shell script (which should open some program/file) which I want to invoke by clicking on a link in the generated `.pdf` file (in my case a beamer presentation). I tried including:               \href{run:./Demos/run_demo.sh}{DEMO}      in the source code. Then, when clicking on the link (when viewing with acrobat reader) it opens the script in a text editor rather then actually running it. I'm using MacTeX on a Mac OS X system. What am I doing wrong?


title: Block matrices, separator with space

text: I want to write block matrices like the one shown below ![block matrix image](http://i.stack.imgur.com/UraDo.png) I tried underlining, fraction, and using __ as an entry by making three rows but they did not look nice.I want the horizontal lines inside the matrix to be gapped in between as shown. How can I do this?


title: newcommand: different behavior depending on number of args?

text: I want to make my citations simpler. I'm in theoretical physics where citations are numbered, so `\cite{citation}` will pull up simply "[1]" (for example). Common usage is to write "Ref. [1]." I made a new command which handles this:               \newcommand{\rcite}[1]{Ref.~\cite{#1}}      What I'd like to do is extend this to know if I've passed it 2 or more arguments and, in that case, change Ref. to Refs. But I have not even the slightest idea how to do this, and my look through the documentation came up empty. Any ideas?


title: Biblatex field values and comparisons

text: I would like to change the behavior of printing author names based on the hash field in biblatex. This mwe should demonstrate what I am having difficulty understanding. ## MWE:               \documentclass{article}     \usepackage[backend=biber, style=phys, punctfont=true]{biblatex}     \usepackage{filecontents}     \begin{filecontents}{\jobname.bib}     @article{doe_design_2013,       author = {Doe, John B.},       journaltitle = {Acme Society Journal},       date = {2013-03-08},       title = {Design of alpha widgets},       volume = {1},       issue = {1},       pages = {10}     }     @article{doe_alpha_2014,       author = {Smith, Jane J. and Doe, John B.},       journaltitle = {Acme Society Journal},       date = {2014-03-08},       title = {Alpha widgets in space},       volume = {2},       issue = {1},       pages = {5}     }     \end{filecontents}     \addbibresource{\jobname.bib}     \newcommand*{\mystr}{7ba24cb78eaec483f680a08422f4d516}     \newcommand*{\myhash}{7ba24cb78eaec483f680a08422f4d516}     \renewcommand*{\mkbibnamefirst}[1]{       \iffieldequals{hash}{\myhash}{\mkbibbold{#1}}{#1}     }     \renewcommand*{\mkbibnamelast}[1]{       \iffieldequalstr{hash}{7ba24cb78eaec483f680a08422f4d516}       {\savefield{hash}{\myhash}\mkbibbold{#1}}       {#1}     }     \begin{document}          Commands equal: \ifdefequal{\myhash}{\mystr}{True}{False}          Replacement text equal: \ifdefstrequal{\myhash}{\mystr}{True}{False}          \nocite{*}     \printbibliography[title={Test}]          Commands equal: \ifdefequal{\myhash}{\mystr}{True}{False}          Replacement text equal: \ifdefstrequal{\myhash}{\mystr}{True}{False}          \pagenumbering{gobble}          \end{document}      ## Output: ![mwe output](http://i.stack.imgur.com/SgfbY.png) * * * I understand that the initial value for \myhash is not the same as the biblatex hash field, even if their string values are the same as the initial _J.B._ is not bold and the next occurrence is. What I would like to understand is:   1. How do I compare the string value of a biblatex field to the string value of a command?   2. What is the value of the biblatex hash field   3. How do I determine what the value of a command or biblatex field actually is? I feel like I am missing a core concept, and a better means of debugging issues in LaTeX. (I am aware of this question, but my question is more about LaTeX/biblatex programing)


title: A file I compiled under TeXLive 2009 cannot be compiled under TeXLive 2010

text: > **Possible Duplicate:**   >  Whatever happened to \newfontinstance? I compiled the following code with TexLive 2009 before. However, I get the following error message now.               /usr/local/texlive/2010/texmf-dist/tex/latex/fontspec/fontspec.cfg     undefined contorl sequence     <recently red> \newfontinstance          l.14 \newfontinstance {\sifont}[Script=Sinhla]{LKLUG}     ?      I have the `sinhala.sty` in my `~/library/texmf/tex/latex` folder. The following is the LaTeX code.               \documentclass[12pt]{article}     \usepackage{graphicx}     \usepackage{amssymb}     \usepackage{hyperref}     \usepackage{sinhala}          % Will Robertson's fontspec.sty can be used to simplify font choices.     % To experiment, open /Applications/Font Book to examine the fonts provided on Mac OS X,     % and change "Hoefler Text" to any of these choices.          \usepackage{fontspec,xltxtra,xunicode}     \defaultfontfeatures{Mapping=tex-text}     \setromanfont[Mapping=tex-text]{Hoefler Text}     \setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Gill Sans}     \setmonofont[Scale=MatchLowercase]{Andale Mono}          \title{සිංහල අකුරු}     \author{සැලෙන මනස විසිනි}     \date{}                                                \begin{document}     \maketitle     \begin{flushleft}     මේ වාර්තාව පිලියෙල කලේ XeLaTeX භාවිතා කරමිනි. මෙහි අකුරු පැබැඳුම සඳහා TeXShop භාවිතා කල අතර,  අකුරු ලබා ගත්තේ Mac OS X 10.6 හී Character Viewer මගිනි. මේ සිංහල Unicode අකුරු LKLUG මිනිස් සමූහය විසින් නිර්මානය කරන ලද්දකි.     \vspace{10pt}          මෙවැනි වාර්තාවක් පිලියෙල කිරීම සඳහා XeLaTeX භාවිතා කිරීමේදී අනුරැද්ධ රත්නවීර විසින් රචිත ``සිංහල මල්ල" (sinhala package) යොදා ගත යුතුය.     \vspace{10pt}          වාසනාවකට මෙන් මේ සඳහා Keyboard එකද භාවිතා කල හැකිය.  ඒ සඳහා කොලඹ විශ්ව විද්‍යාලයේ \href{http://www.ucsc.cmb.ac.lk/ltrl/services/feconverter/t1.html}{සිංග්ලිශ්} භවිතා කර ඔබේ වාර්තාවේ අලවන්න.     \end{flushleft}     \end{document}


title: How can I turn off table and figure captions?

text: I am using my figures and tables both in report documents, where I want them to have caption text, an in presentations made with Beamer, where I want them to not have a caption text. I am using the Caption package (2011/08/11) both for my report and presentations. Is there a simple way to turn off the caption text when I use the figures and tables in my presentations?


title: Using ps2pdf colour and fonts change when TikZ picture added on beamer slide

text: When compiled with `LaTeX + dvi2ps + ps2pdf` the pdf output of the below MWE shows a strange behaviour: On the first slide (without `TikZ` picture) fonts and colours are slightly different from the ones on the second slide (with the `TikZ` picture). For example, look at the black area in the footer. It is deep black on the first slide but becomes somewhat greyish on the second one. Also the font seems to change (it's "thicker" on the second slide) ... The phenomenon is best seen when the Acrobat Reader is set to display single pages and the zoom factor is small. What the XXXX is happening there???? NB: There are no problems when the code is compiled with `PDFLaTeX`. The problem is that I have `eps` pictures in my presentation so that `PDFLaTeX` is no option (I could but do not actually want to convert the pictures from `eps` to `jpg` or `pdf`.)               \documentclass[10pt,xcolor=dvipsnames]{beamer}          \usepackage{beamerthemeshadow}     \usepackage{color}     \usepackage{tikz}     \usetikzlibrary{shadows,shapes.arrows}          \newcommand*{\tikzarrow}[2]{%       \tikz[         baseline=(A.base)                    ]\node[         single arrow,                          single arrow head extend=2pt,          draw,                                  inner sep=2pt,                         top color=white,                       bottom color=#1,                       drop shadow                          ] (A) {#2};%     }          \begin{document}       \frame{\frametitle{Title}       \uncover<1->{Lorem ipsum dolor sit amet.}            \uncover<2->{\tikzarrow{yellow}{Then} Donec vehicula augue eu neque.}       }     \end{document}      PS: Possible connection with TikZ with "remember picture" compiled with pdflatex yields different results compared to dvips -> ps2pdf.


title: cursive letters inside equation

text: I want to use cursive font inside an equation. I have defined a macro               \newenvironment{frcseries}{\fontfamily{frc}\selectfont}{}     \newcommand{\textfrc}[1]{{\frcseries#1}}      With this I get cursive fonts outside equation only. Could anyone please tell me how can I get cursive font inside equation? Thanks!


title: How can I define additional literate replacements without deleting existing ones?

text: I'm trying to improve some language definitions that ship with `listings`. Those improvements consists in, among other things, a number of _literate replacements_ (see subsection 5.4 of the `listings` manual) used for changing the values of switches and counters that I use to keep track of the context (comment, string, etc.). The `literate` key (which is used to perform those literate replacements) has the following syntax:               literate=[*]⟨replacement item⟩...⟨replacement item⟩      where `⟨replacement item⟩` consists in three parts:               {⟨stuff to replace⟩}{⟨replacement text⟩}{⟨length⟩}.      However, `listings` doesn't seem to offer the possiblity of defining additional literate replacements to those that already exist. As a result, if a user wants to use my language definition but decides to define his/her own literate replacements (using `literate` a second time), all the literate replacements defined as part of my language will be deleted, and my improved syntax highlighting of the language will be broken. Other keys, such as `keywords`, have a system of _class_ , to avoid that type of interference, presumably. Unfortunately, there is no such class system for `literate`. There is also no `moreliterate` key. How could I allow the user to specify further literate replacements without deleting those already defined? The code below shows an example of the problem as it stands: ![enter image description here](http://i.stack.imgur.com/7sVgD.png)               \documentclass{article}          \usepackage{listings}          % ----     % (This language definition would be in some mylang package)     \lstdefinelanguage{mylang}     {%         basicstyle=\ttfamily,         literate={u}{a}1,     }     % -----          % Now, in his/her preamble, the user loads mylang     % but defines new literate replacements, which delete mine     \lstset     {%         language=mylang,         literate={(}{[}1 {)}{]}1,     }          \begin{document}          \noindent I would like to get {\ttfamily[papa]} as output, but I get     \begin{lstlisting}     (pupu)     \end{lstlisting}          \end{document}


title: Proper way to indicate code change in lstlisting

text: [Since the question was not clear] I have a piece of program code I would like to describe in my thesis. My problem is that the part I would like to explain is surrounded by simple code pieces not worth to describe. Now I would like to ask, if there is a possibility to have jumps in the line numbers. Further, I would like to ask if someone has experience with indicating that I left out parts of the code because they are not relevant.               \noindent     \begin{minipage}{\linewidth}     \begin{lstlisting}[caption=Function, label={lst:example}, firstnumber=1]     int complicated_function(int b){         //I do a lot here..              if(a < b){            return a;         }else{            return b;         }         if(b == 0){              printf("Error");  //Not really relevant, just error handling. How can I leave it out?          }     return EXIT_SUCCESS;     }     \end{lstlisting}     \end{minipage}`      Thanks!


title: Clean .bbl files with latexmk -C

text: I use TeXLive 2012 and compile with run               latexmk -pvc -pdf -quiet test.tex      later I clean the directory with               latexmk -C      But `test.bbl` remains. How can I help latexmk to find bbl files? ### test.bbl (first lines)               % $ biblatex auxiliary file $     % $ biblatex bbl format version 2.1 $     % Do not modify the above lines!     %     % This is an auxiliary file used by the 'biblatex' package.     % This file may safely be deleted. It will be recreated by     % biber as required.     %


title: url in Bibliography without period at the end

text: I'm compiling a document with the essentially the following bib entry:               @misc{name,         title = {Title of Web Page},         howpublished   = {\url{http://somethinghere.com}}       }      It compiles fine, but a period gets placed at the end of the url. Is there a way to avoid this? Thanks.


title: Character substitution: combine \llap{(} and \llap{-} to \llap{(-}

text: This is a follow up to question siunitx: specifying custom command as input- symbol . The idea is that `(`,`)` and `-` are wrapped into `\llap` or `\rlap` so that they do not take any space when a table is set via `siunitx`. The problem is that it does not work when I have `(-` in one column: because it is substituted with `\llap{(}\llap{-}`, causing the left bracket and the minus to be overlapping. Obviously this would need to become `\llap{(-}`. But I don't know how to achieve this in the current framework developed by David Carlisle as shown in the MWE below.               \documentclass[11pt]{scrartcl}          \usepackage[T1]{fontenc}     \usepackage[utf8]{inputenx}          \usepackage{lmodern}     \usepackage[euler-digits]{eulervm}          \newcommand{\sym}[1]{\rlap{#1}}          \usepackage{siunitx}         \sisetup{             detect-mode,             group-digits            = false,             input-symbols           = ( ) [ ] - +,             table-align-text-post   = false,             input-signs             = ,             }             % Character substitution that prints brackets and the minus symbol in text mode. Thanks to David Carlisle     \def\yyy{%       \bgroup\uccode`\~\expandafter`\string-%       \uppercase{\egroup\edef~{\noexpand\text{\llap{\textendash}\relax}}}%       \mathcode\expandafter`\string-"8000 }          \def\xxxl#1{%     \bgroup\uccode`\~\expandafter`\string#1%     \uppercase{\egroup\edef~{\noexpand\text{\noexpand\llap{\string#1}}}}%     \mathcode\expandafter`\string#1"8000 }          \def\xxxr#1{%     \bgroup\uccode`\~\expandafter`\string#1%     \uppercase{\egroup\edef~{\noexpand\text{\noexpand\rlap{\string#1}}}}%     \mathcode\expandafter`\string#1"8000 }          \def\textsymbols{\xxxl[\xxxr]\xxxl(\xxxr)\yyy}                \begin{document}          \begin{table}\centering     \textsymbols     \begin{tabular}{l*{3}{S[table-format=1.2,table-column-width=20mm]}}     Variable 1 & 1.85\sym{***} & 0.92\sym{***} & 1.11\sym{***} \\                & (-0.34)       & (0.24)        & (0.14)        \\     Variable 2 & 0.07\sym{***} & 0.07\sym{***} & 0.07\sym{***} \\                & (-0.01)       & (0.02)        & (0.01)        \\     \end{tabular}     \end{table}          \end{document}      ![enter image description here](http://i.stack.imgur.com/NIX1d.png)


title: How to write average of a function?

text: Just do not know how to write the average of a function. The symbol look like a integral sign with a short bar in the middle. It means integral of a function over a ball divide by the measure of the ball, and let the radius of the ball goes to 0+.


title: Integral with cross line

text: ![enter image description here](http://i.stack.imgur.com/FzYk8.jpg) Kindly send the latex code for this integral symbol


title: Change vertical space of chapters temporarly in Table of Contents

text: I have grouped sections nicely below of chapters in ToC, so that there is no space between chapter and following sections, but there is some space between last section and following chapter. All this is done using memoir:               \setlength{\cftbeforesectionskip}{4pt}     \setlength{\cftbeforechapterskip}{16pt}      The problem is that chapter-like entries in the frontmatter (e.g. Foreword, Abstract) will have relatively large vertical space in between. What I would like to have is `grouped´ frontmatter chapter-like entries with 4pt vertical space, and 16pt space between last entry of the group (say, ToC or LoF) and the first chapter. Something like this:               Foreword     Abstract     List of Figures          Chapter 1 Introduction       1.1 Section title       1.2 Section title          Chapter 2 Theory       2.1 Section title       2.2 Section title          Bibliography