title: Merging different cells in a table with \multicolumn

text: I am having troubles with `\multicolumn`. In the second row the cells containing a `9` should have equal sizes. How can I achieve this?               \documentclass{article}          \begin{document}       \begin{center}         \begin{tabular}{|c|cccccc|}           \hline           \textbf{faz} & \multicolumn{6}{c|}{18}\\           \hline           \textbf{bar} & \multicolumn{3}{c|}{9} & \multicolumn{3}{c|}{9}\\           \hline           \textbf{baz} & \multicolumn{2}{c|}{6} & \multicolumn{2}{c|}{6} &  \multicolumn{2}{c|}{6}\\           \hline         \end{tabular}       \end{center}          \end{document}       ![enter image description here](http://i.stack.imgur.com/1strH.png)


title: Always have the ring of the tensor product below the \otimes

text: I would rather have always have my tensor product look like `$A\underset{R}{\otimes}B$` but still write `$A\otimes_R B$`. Is there a way to make this happen by some command in the preamble? (it's ok if it only works in display mode)


title: LyX – is there a way to substitute variables in math formulas?

text: Suppose I want to replace               x^{n_{1}}y^{n_{2}}z^{n_{3}}      with               x^{m_{1}}y^{m_{2}}z^{m_{3}}      Is there a fast way to do this? I am certainly missing this feature from LaTeX editors like gvim and kile. If I use the `Ctrl`+`F` dialog to find and replace "n" with "m", it does it on the whole document, and the change is so massive it won't let me revert (`Ctrl`+`z`)! So, I've learned to save before using that dialog.


title: How can I enable italic correction for LuaTeX?

text: LuaTeX ignores mathematical italic correction by default, as noted by Khaled Hosny. This leads to some awful errors when using some alphabet which is very slanted, like XITS' mathematical script glyphs. For example, both `$^*$` and `$[ρ]$` result in intersecting glyphs. (As a side note, ConTeXt renders both correctly, while XeLaTeX renders the first correctly but not the second). Khaled did propose a workaround, but since it involves rebuilding the format, I'm not interested. Also, I can't wait for the bugfix to happen (I have a thesis to deliver). So, is there a workaround that only involves some code in the preamble? A solution for XeLaTeX would also be valuable for me, since it's very easy to switch to it (although I'd prefer to use LuaLaTeX).


title: Xtable and Sweave

text: My question is regarding `xtable` and `sweave`. I have a certain table created in RStudio and want to create a pdf file using it. I use the package Sweave and write the necessary code and I get the table. Unfortunately, the rownames of the table are aligned to the right instead to the left. How can I avoid or rectify this? Any suggestions would be well appreciated.                \rowcolors{2}{white!65}{cyan!35}      \begin{center}      <<xtable1,results=tex,echo=FALSE>>=      xtab<-xtable(ABC)      print(xtab,center = "centering", floating=FALSE)      @      \end{center}


title: color multirow in a table

text: I am trying to color a multirow in my table, but withou success until now:               \documentclass{scrartcl}     \usepackage[utf8]{inputenc}     \usepackage{multirow}     \usepackage{hhline}     \usepackage{colortbl}     \usepackage{multicol}     \begin{document}     \begin{table}     \begin{tabular}{|l|c|c|c|c|}     \hline     \multicolumn{5}{|c|}{Type} \\     \hline       & A  &    B & C & D \\         \hline         X & 53,2\%  &   51,6\%  &  \multirow{2}{*}{\cellcolor[gray]{.9}49\%} & \multirow{2}{*}{\cellcolor[gray]{0.9}49\% }\\         Y  & 53,8\%  &  52,2\%  &  & \\     \hline     \end{tabular}     \end{table}     \end{document}      ![enter image description here](http://i.stack.imgur.com/ekvPS.png) What should I do, so that the last two multirow-cells are completely grey- colored?


title: Problems in inserting images in LyX

text: Recently I have installed LyX in my Ubuntu 12.04LTS for the purpose of text editing. But I am facing some problems while inserting images. Whenever I go to the "insert graphics" option, browse the picture I want to insert and click the file (.png, .jpg), the application closes automatically. I tried to reconfigure it also but still it shows the same problem. How can I fix this problem?


title: multicolumns in latex

text: I try to have a one column setup and some parts with two column. But I don't want to make a `table` because it should not care about linebreaks is there a solution for that in `LaTeX`? ![enter image description here](http://i.stack.imgur.com/UcR6U.png)


title: How to change "Appendix A" to "Appendix"

text: I'm using Lyx, Book(Koma-Script) document class. Everything seems to work OK except I've been fiddling around for ages trying to change the name of my single appendix in the TOC from "Appendix A. Blah blah" to "Appendix. Blah blah". I also want the appendix title in the body of the document to read "Appendix. Blah blah" rather than "A. Blah blah". I've inserted the following TEX code at the beginning of the appendix               \begin{appendices}          \renewcommand{\appendixname}{Appendix}          \chapter{Planetary motion data}      with `\end{appendices}` at the end of the appendix. In Document Settings/Latex Preamble I've put `\usepackage[title,titletoc]{appendix}`. My knowledge of coding etc is zero. I've just used trial and error to copy/paste fragments of code I've found online to get where I am now. Can anyone help? Thank you.


title: Automatic translation of accented characters in Winedt 7

text: I remember that a long time ago, when I was using Winedt (V5.0 I guess) it automatically replace some characters. For example, `ç` was replaced by `\c{c}` when I open the file. Now, I need to do the same again. But I have Winedt 7.0 and I don't know how to translate all the accented characters automatically. Any help?


title: PGFPlot handling all my data, do I need to pre-process the data?

text: I will be writing a report in which I analyse the performance of a piece of software. I would like to show my data using `PGFPlot`. My plan of attack is to schedule a script to run on the machine I am using, which will run the program a number of time with a variety of parameters (the main one being the number of processors I use) and dump all the data in to a `.dat` file. Can `PGFPlot` this? Can I ask it to average all the tests with the same parameters? I will be plotting a line graph with the average time, but I would also like to plot the standard deviation of the results. Is `PGFPlot` the tool for this? Or should I be using `LibreOffice` to generate the relevant data, and only use `PGFPlot` at the end? Thank you


title: How to use Latex in MS Word

text: I downloaded latex in word from here: http://sourceforge.net/projects/latexinword/ But it just gives me an archive file that I have no idea what to do with. And I can't see any installation instructions anywhere either. Any help getting this to work would be appreciated.


title: How can I get get makeindex to ignore capital letters?

text: I've created a macro which highlights a word and sends it to the index               \newcommand{\indexthis}[1]{\textcolor{Maroon}{\textbf{#1}}\index{\MakeLowercase{#1}@{#1}}\xspace).      However the `\MakeLowercase` command does not appear to work as words which appear at the beginning of the sentence are sent to the `.idx` file with the capital letter in place. This then affects the sort order of the index as the capitalised words come first. Here's a minimal worked example               \documentclass{minimal}          \usepackage{makeidx}     \usepackage[usenames,dvipsnames,svgnames,table]{xcolor}          \newcommand{\indexthis}[1]{\textcolor{Maroon}{\textbf{#1}}\index{\MakeLowercase{#1}@{#1}}\xspace}          \makeindex     %================================================================================================     \begin{document}          \indexthis{Aardvarks} keep out of the sun \\     \indexthis{Badgers} prefer the shade \\     But \indexthis{antelopes} adore sunshine \\     And \indexthis{lions} are sun addicts \\          \printindex          \end{document}      And here is a screenshot ![Screenshot](http://i.stack.imgur.com/LPxIy.jpg) The problem is that we have two A-Z lists, one for words which begin with uppercase letters, and one for words which begin with lowercase letters. Can anyone make changes to the macro to force the argument `#1` into lowercase before sending it to the `.idx` file? Alternatively is there a way to get `makeindex` to ignore capital letters during sorting? Ta. (NB there's a thread Applying `\lowercase` to index entries which deals partly with this issue. However, the solution is a macro containing two arguments. I'm trying to both highlight and add to the index using only one argument, and I haven't been able to adapt this code)


title: Indentation and line wraps in TeXShop

text: As pointed out in this question, in TeXShop there is no way to make source paragraphs (i.e. long lines with no hard wraps) follow source indents _automatically_ , that is, while typing. The solution proposed in the accepted answer is unsatisfactory, in my opinion, as it requires manual insertion of line breaks at every single line... I believe you should not be forced to adopt such a behavior in year 2011, unless you are a big fan of old typewriters. My ultimate goal is to obtain > readable, "programming language-style" source code, with indented blocks for > environments, and I would like to get that using TeXShop (I know that's easy using other editors, such as Emacs). My question is: > is there at least a way to obtain such a formatting _after_ typing, e.g. > using a macro which inserts line breaks in the right spots? The first thing I tried is the following:   1. Write the code naturally, with no indents nor hard wraps;   2. Select any block (or even the whole code) and then apply Source > Wrap Lines > Hard Wrap from TeXShop's menu;   3. Select any block you want to indent, and indent it using the appropriate command in the Source menu. However this does not work nicely, because after you indent the block some lines may become too long for the editor window's width.


title: CJK-friendly Ubuntu editor or IDE for XeLaTeX

text: I've seen this discussion about the best IDEs for LaTeX on Ubuntu: XEmacs/AucTeX is recommended by my colleagues off of this site. However, I'm interested in the specific case of **mixed CJK/Roman editing with XeLaTeX on Ubuntu**. Is there a recommended editor or IDE? I presently use TeXShop on Mac OS X instead of LyX (which was most widely recommended to me when I started) because I have had trouble getting CJK to work with LyX. Before I start trying out different editors on Ubuntu, I'd be most grateful to hear recommendations or warnings based on other people's experience. * * * **Edit** : Caramdir refers me to this discussion. That makes me wonder whether, in practice, every LaTeX editor also supports XeLaTeX perfectly.


title: How to insert 4 digit year that shows up in \today?

text: Using the LaTeX command `\today`, I can insert the current date. Is there any way to insert the current year with a simple command? All I want is the simple 4 digit year that shows up in `\today`.


title: How to reference a multi-volume book with bibtex?

text: I would like to reference a multi-volume book, like so:               Boncompagni, Baldassarre. Scritti di Leonardo Pisano matematico del secolo decimoterzo. — Roma, Tipografia delle scienze matematiche e fisiche, 1857 − 1862. — 2 v. (in Lat.)        Vol. I : Leonardi Pisani, Liber Abbaci = Il Liber Abbaci di Leonardo Pisano. 1857. — 459 p.       Vol. II : Leonardi Pisani Practica geometriae ed opuscoli = La Practica Geometriae di Leonardo Pisano; Opuscoli di Leonardo Pisano. 1862. — 283 p.      The above can be interpreted as:   1. Title & info of the multi-volume book   2. Title & info of the first volume   3. Title & info of the second volume If this is not possible in bibtex - are there some alternatives?


title: What does this error mean?: begin document ended by end proof

text: I'm typing up an article in Latex and after opening the proof environment with `\begin{proof}` and concluding it with `\end{proof}` I get the error message > ! LaTeX Error: `\begin{document}` ended by `\end{proof}`. > > See the LaTeX manual or LaTeX Companion for explanation.   >  Type H for immediate help. Does anybody know how to fix this? If I delete both the `\begin{proof}` and `\end{proof}` commands then it goes through as usual but I don't get the nice proof environment in the document.


title: center caption with subimage

text: I have the following image:![enter image description here](http://i.stack.imgur.com/4CLno.jpg) Produced from the following LaTeX code:               \begin{figure}[h!]             \centering             \begin{subfigure}[b]{0.6\textwidth}           \includegraphics[width=0.7\textwidth, trim=5cm 5cm 5cm 5cm]{images/det.pdf}         \caption{Deterministic algorithms}       \label{fig:fingonly1}             \end{subfigure}%             ~ %add desired spacing between images, e. g. ~, \quad, \qquad etc.               %(or a blank line to force the subfigure onto a new line)             \begin{subfigure}[b]{0.6\textwidth}           \includegraphics[width=0.7\textwidth, trim=5cm 5cm 5cm 5cm]{images/pro.pdf}       \caption{Probabilistic algorithms}       \label{fig:fingonly2}             \end{subfigure}             \caption{Average positioning error for the non-dynamic indoor positioning system}\label{fig:rssi}     \end{figure}      I want to center the text with the image. any recommendations on how to fix this?


title: tabular and lstlistings - When importing code in column 2, paragraph in column 1 moves down

text: A problem surfaces when formatting my ten-page long document and I'm going to try to post all the code that relates to the issue, but know that I'm fairly new to LaTeX so I may not realise some parts may affect things and such.               \lstdefinestyle{customc}{       language=C,       showstringspaces=false,       basicstyle=\footnotesize\ttfamily,       keywordstyle=\bfseries\color{green!40!black},       commentstyle=\itshape\color{purple!40!black},       identifierstyle=\color{blue},       stringstyle=\color{orange},     }          \lstset{escapechar=@, style=customc}          \begin{tabular}{p{7cm} l}     \multicolumn{2}{c}{}\\     \hline     This is the TestAndSet atomic operation example implemented in C code.      It takes a lock and sets it to true.      The test is the return value of the function. This is usually used     in a while loop. The lock is initialised to false. If it is true,      it will return true and the loop will not break. &     \begin{lstlisting}[aboveskip=-10pt]        bool TestAndSet(bool *lock) {          bool local = *lock;          *lock = true;          return local;        }     \end{lstlisting} \\     \hline     This is the Swap atomic operation example implemented in C code.      It takes a lock and a key     of type bool. The lock will be initialised to false.     It will then swap the values of these variables, and if the value of     lock was false, the key will now become false, and you can exit the loop      where the key variable is the loop condition, which was initialised to      true. &     \begin{lstlisting}        void Swap(bool *lock, bool *key) {          bool local = *lock;          *lock = *key;          *key = local;        }     \end{lstlisting} \\     \multicolumn{2}{c}{}     \end{tabular}      I think this is all the code that relates to the problem I have, which is what I will describe now. Whenever I have those tabulars there, the paragraphs in the first column gets an extra line or something and it looks like they are bottom-aligned instead of top-aligned. It does not happen if I have regular text in column two. And I tried changing the type of the second column to other things with set widths but it keeps doing it. If you want me to post more code then tell me, but the whole document is kind of big, with an output of around 10 pages. Do you have any idea of what could be wrong with this?


title: Customize comment color in minted style

text: I'm using the `minted` package to highlight some Python code, and currently I'm using `\usemintedstyle{trac}`. I want to change the color of the comment (from the current light brown-ish) to green. My understanding is that you either define a new style and include it in the styles folder of `pygments` or you can change `trac.py` directly. In `trac.py`, I see:               Comment: 'italic #999988',     Comment.Preproc: 'bold noitalic #999999',     Comment.Special: 'bold #999999',      However, modiyfing the hex codes above does not seem to affect the color of comments in the output. In fact, the output for comment is not italic at all (which I like) but it is specified as italic here. So how exactly the styles defined in `pygments` affect the output of `minted` package? Is there something else I've missed?


title: Setting the color of a draw command inside foreach

text: I am trying to draw colored lines with a foreach loop. The command I use to draw the line creates a colored line if I use it standalone. Once I put it inside the foreach loop, I only get a black line. How do I draw colored lines inside a foreach loop?               \documentclass{report}     \usepackage{tikz}     \begin{document}     \begin{tikzpicture}[lengthMark/.style={<->}]         \foreach \i/\color in {0/{violet!50},1/yellow} {             \draw[\color] (3.5, -.25-\i) -- ++(.5, 0);             \draw[red] (0,0) --(2,2);         }     \draw[red] (0,0) --(2,-2);     \end{tikzpicture}     \end{document}      write latex, note while posting it only the line drawn outside the foreach (`\draw[red] (0,0) --(2,-2);`) appears colored.


title: How to align header/footer

text: I want to get left border of the header, please see below, to the tip of the section title and the right border to the end of the text. I use `fancyhdr` package and the code is:               \documentclass[10pt]{article}     \usepackage{calc}     \usepackage{graphicx}     \usepackage{caption}          \makeatletter     \newlength{\bibhang}     \setlength{\bibhang}{1em}     \newlength{\bibsep}      {\@listi \global\bibsep\itemsep \global\advance\bibsep by\parsep}     \newenvironment{bibsection}%             {\vspace{-\baselineskip}\begin{list}{}{%            \setlength{\leftmargin}{\bibhang}%            \setlength{\itemindent}{-\leftmargin}%            \setlength{\itemsep}{\bibsep}%            \setlength{\parsep}{\z@}%             \setlength{\partopsep}{0pt}%             \setlength{\topsep}{0pt}}}             {\end{list}\vspace{-.6\baselineskip}}     \makeatother          \reversemarginpar          \usepackage[paper=a4paper,                 %includefoot, % Uncomment to put page number above margin                 marginparwidth=25mm,    % Length of section titles                 marginparsep=1.5mm,       % Space between titles and text                 margin=25mm,              % 25mm margins                 includemp]{geometry}          \usepackage{paralist}     \setlength{\parindent}{0in}                    \usepackage{fancyhdr,lastpage}     \pagestyle{fancy}     \fancyfootoffset{.2\textwidth}%\marginparsep+\marginparwidth     \fancyheadoffset{20pt}     \lhead{The Curiculum Vitae of Vahid Ebrahimzade}     \rhead{\thepage}     \chead{}     \fancyfoot{}          \usepackage{color,hyperref}     \definecolor{darkblue}{rgb}{0.0,0.0,0.3}     \hypersetup{colorlinks,breaklinks,                 linkcolor=blue,urlcolor=blue,                 anchorcolor=blue,citecolor=kblue}          \renewcommand{\section}[2]%             {\pagebreak[2]\vspace{1.3\baselineskip}%              \phantomsection\addcontentsline{toc}{section}{#1}%              \hspace{0in}%              \marginpar{              \raggedright \scshape #1}#2}               \newenvironment{innerlist}[1][\enskip\textbullet]%             {\begin{compactitem}[#1]}{\end{compactitem}}          \newcommand{\blankline}{\quad\pagebreak[2]}          \begin{document}          \section{Forschungs-\newline t\"atigkeit}     %\vspace{.5cm}     \begin{bibsection}     \item Modellreduktion Methoden     \item Surrogate Modellierung; Polynomfunktion Methoden, Radiale Basisfunktion Methoden     \end{bibsection}          \vspace{2cm}                  \end{document}            Which leads to: ![enter image description here](http://i.stack.imgur.com/EaVOK.jpg) Can anyone help me?


title: Error: class or style file required by it is not available

text: I'm new to Latex. I'm running Ubuntu 10.10 64-bit with Lyx 1.6.7. I had created a modified APA template for school. It works on my Windows XP and Mac OSX systems. But in the Ubuntu system I get an error (below). Even when I try to open any of the pre-built templates I get the error. Any ideas on how to fix this? I tried a reinstall through the Ubuntu Software Center, but it didn't fix anything. > ERROR: The layout file requested by this document, apa.layout, is not > usable. This is probably because a LaTeX class or style file required by it > is not available. See the Customization documentation for more information. > LyX will not be able to produce output. Thanks in advance for your help!


title: circuitikz label malfunction

text: This may be a total newbie problem, but I cannot find a single reference of this behaviour anywhere I look and thus this question: This is my code:               \documentclass{article}     \usepackage[american,siunitx]{circuitikz}     \begin{document}     \begin{circuitikz}         \draw (0,0) to[battery, l=12<\volt>] (0,2) -- (0,3.5)                     to[R] (4,3.5) -- (4,2)               (0,0) -- (4,0) to[battery, l=24<\volt>] (4,2)               (0,2) to[R, *-*] (2,2)                     to[R, -*] (4,2)               (2,0) to[R, *-] (2,2);     \end{circuitikz}     \end{document}      The result I get is both labels overlapped at the lower left corner of the picture; the only way I can look at the image is with `xdvi`; any other document viewer like `evince` shows just the text, not the image. If another label is included in the code above, it goes like the others and ends overlapped at the lower left corner of the picture. It doesn't matter where or what is labelled: voltages, currents, capacitors, sources, ... it ends at the same place with the others at the lower left corner of the picture. Yesterday I updated TeXLive from CTAN. No dice. I can send the resulting .dvi file if someone is kind enough to tell me how can I include a file to the question or if there is a place where I can upload it for you to see it like `Dropbox`.


title: how to left align the whole document starting from first heading?

text: \documentclass[11pt]{article}     \begin{document}     \begin{center}     \underline{TCS-505}\\     \underline{DAA TUT-1}     \end{center}     \begin{flushright}     \textbf{Name:Megha Saraswat}\\     \textbf{Sec: Purple}\\     \textbf{Roll No: 65}     \end{flushright}     \underline{I.Logarithm Properties:-}     \[1.\log_{a}x^{k}=k\log_{a}x\]     \[2.\log_{a}(mn)=\log_{a}m+\log_{a}n\]     \[3.\log_{a}(m/n)=\log_{a}m-\log_{a}n\]     \[4.\log_{a}x=\frac{1}{\log_{x}a}=\frac{\log_{b}x}{\log_{b}a}\]     \[5.x^{\log_{a}y}=y^{\log_{a}x}\]     \underline{II.Exponential Properties:-}     \[1.\left( a^{m}\right) ^{n}=a^{mn}\]     \[2.a^{m}a^{n}=a^{m+n}\]     \[3.\frac{a^{m}}{a^{n}}=a^{m-n}\]     \[4.\lim_{n\rightarrow\infty} \frac{n^{b}}{a^{n}}=0\]     \underline{III.Series:-}     \[1.\;1+2+3---------+n=\frac{n\left( n+1\right) }{2}\]     \[2.\;1^{2}+2^{2}+3^{2}+---------+n^{2}=\frac{n\left( n+1\right) \left( 2n+1\right) }{6}\]     \[3.\;1^{3}+2^{3}+3^{3}+---------+n^{3}=\frac{n^{2}\left( n+1\right)^{2}}{4}\]     \[4.\;1+x+x^{2}+x^{3}+---------+x^{k-1}=\frac{x^{k}-1}{x-1}\]     \end{document}


title: Ending a question in 'Exam' class

text: I am making a document in the 'exam' class and here's what I want to happen.               \question This is part of the question          This is no longer part of the question and is not indented as such.       I know this is a total noob question. Thanks in advance!


title: Hyperref \pageref links point to first page

text: In answering this question I came across an unusual feature of hyperref. The issue is that sometimes the hyperlinks generated by hyperref and `\pageref` point back to the first page of the document rather than to the page that they are supposed to go to. Here is a MWE:               \documentclass{article}     \usepackage[colorlinks]{hyperref}     \begin{document}     Page 1\newpage     Page 2\label{page2}\newpage     Page 3: Here is a link to \pageref{page2}     \end{document}      Clicking on the link on page 3 takes you back to page 1 rather than to page 2, even though the pdf file says that the link is on page 2. For the record, I note that the page numbers are in arabic (roman is known to cause problems) and I am using TeXLive 2014 and pdflatex. Now this particular issue is known and is apparently NOT a bug because label does not create an `anchor` so there is nothing to link to. Indeed, if I change my minimal working example to:               \documentclass{article}     \usepackage[colorlinks]{hyperref}     \begin{document}     Page 1\newpage     \newcounter{acounter}\refstepcounter{acounter}     Page 2\label{page2}\newpage     Page 3: Here is a link to \pageref{page2}     \end{document}      The link on page 3 now correctly sends me back to page 2. Interestingly, if instead I write               \documentclass{article}     \usepackage[colorlinks]{hyperref}     \begin{document}     \newcounter{acounter}\refstepcounter{acounter}     Page 1\newpage     Page 2\label{page2}\newpage     Page 3: Here is a link to \pageref{page2}     \end{document}      then my hyperlink is again wrong as it sends me back to page 1. Arguably, as there is no anchor on the current page hyperref is justified in being confused. On the other hand, since latex does correctly produce the correct page number I think that hpyerref should produce correct hyperlinks in all of these cases. So my question: what **should** hyperref do in these cases? Judging from the link above, these are probably not bugs...personally, I wonder why `\label` doesn't create a hyperlink anchor.


title: How to write poem in two languages, one on left and the other on right page

text: How can I have on poem in two different languages written such that in one language it is on the left page and in the other language it is on the right side. Since I have several poems I would like to have in that small book, I thought of the memoir class. Is there something available to do this?


title: Where do I find \item definition to redefine it?

text: I want to modify the parameters used by `\item` in a `{list}` environment. Where can the original definition be found in my LaTeX distribution to copy and modify?


title: \triangleleft and \bowtie

text: I want to redefine the command `\triangleleft` so that it always has the color green:               \let\oldtriangleleft\triangleleft     \renewcommand\triangleleft{\textcolor{green}{\oldtriangleleft}}      When I use the command `$\bowtie$`, it complains "Missing { inserted." It is because `\bowtie` is defined based on `\triangleleft`? In that case, is there a fix?


title: Problems with pdfLaTeX because of transparencies and transfer curves

text: I'm about to finish my report for this semester. My document inlucdes a lot of pictures and schematics from different (external) sources. Now the printery (prepress) is complaining about transparencies and transfer curves in my final pdf. I know that transparencies and transfer curves are included in the images I use (mainly PDFs) and pdfLaTeX doesn't seem to reduce transparencies. Is there a way to tell the compiler to create a document that is suitable for professional printing? I included a list of the packages I used. Thanks for help!               \documentclass[11pt,a4paper,abstracton,toc=flat,listof=flat,numbers=noenddot]{scrreprt}          \usepackage[ansinew]{inputenc}      \usepackage{graphicx}        \usepackage[ngerman]{babel}     \usepackage{parskip}         \usepackage{color}           \usepackage{lmodern}     \usepackage{booktabs}        \usepackage{geometry}        \usepackage{longtable}       \usepackage{microtype}       \usepackage{amsmath}         \usepackage{ziffer}          \usepackage{xfrac}           \usepackage[printonlyused]{acronym}     \usepackage{enumitem}        \usepackage{float}           \usepackage{setspace}        \usepackage{marginnote}      \usepackage{eurosym}         \usepackage{pdfpages}        \usepackage{lipsum}          \usepackage{subfig}          \usepackage[colorlinks,pdfpagelabels,pdfstartview = FitH,bookmarksopen = true,bookmarksnumbered = true,linkcolor = black,plainpages = false,hypertexnames = false,citecolor = black]{hyperref}     \usepackage{scrpage2}


title: Alternating formatting within the same lstlisting environment

text: I am writing a document that contains parts of an compiler interpreter session (GHCi in this case, but this is not relevant). I have a carefully setup style for Haskell code that I would like to use there. But the prompt and especially the output is not Haskell code and should be printed differently. Here is an example:               \begin{lstlisting}     Prelude> let fibs = 0:1:zipWith (+) fibs (tail fibs) in fibs !! 10     55     \end{lstlisting}      What is the most elegant way to apply different style to what follows the `Prelude >` and the rest?


title: \jobname in Gummi

text: The command `\jobname` usually print the file name without the path and extension, so inside a file called `foo.tex` will print just `foo`. With `pdflatex foo.test` or compiling from LaTeXila certainly I obtained this result. But from Gummi what I obtain is `.foo.tex` Does anyone know why Gummi compiles differently and how I could get the usual `\jobname` behavior in Gummi? **Edit:** Based on helpful answers of @JosephWright and @Herbert I wonder if it is possible to do the \jobname correction in Gummi only if the source have the .swp extensión or .tex persist in \jobname. That is, I would like a solution like:               \makeatletter     \let\JobName\jobname     \ifthenelse{\equal{\detokenize{foo}}{\jobname}}     {}     {     \def\@JobName.#1.#2\@nil{#1}     \def\jobname{\expandafter\@JobName\JobName\@nil}     }     \makeatother      This conditional works to check if the jobname is foo or not, but I want a general solution, independent of the file name (not limited to the string foo).


title: \listoftodos is empty for the document with \todo

text: The document contains several tex pages which are included with `\input`. The main.tex has `\usepackage{todonotes}` and a command to generate list of todos `\listoftodos`. The other page contains `\todo{some note}`. I see the todo note itself but the list of todos is empty. Ideas? Tried to have `\todo` and `\listoftodos` on the same page - the same result. `latex --version` is "pdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009/Debian)". Tried with two versions of todonotes.tex - "2012/07/25" and "2012/07/25". Thanks.


title: How to avoid overfull \hbox warning when using tabularx with \textwidth?

text: # Question How do I avoid the warning > Overfull \hbox (10.95003pt too wide) in paragraph at lines [...] produced by the following document?               \documentclass[parskip=half]{scrartcl}          \usepackage{tabularx}     \usepackage{booktabs}     \usepackage{blindtext}          \begin{document}          \blindtext          %\begin{center}     \begin{tabularx}{\textwidth}{XX}       \toprule       Test  & Test       \\\bottomrule     \end{tabularx}     %\end{center}          \blindtext          \end{document}      The output looks okay: ![output](http://i.stack.imgur.com/zoIIe.png) # Explanation From the KOMA script manual `scrguide.pdf`: > **`half`** Absätze werden durch einen vertikalen Abstand von einer halben > Zeile gekennzeichnet. Absatzenden durch einen Leerraum von mind. ein Geviert > (1em) der normalen Schrift am Ende gekennzeichnet. Using `\textwidth` contradicts this, hence the warning. > **`half-`** Absätze werden durch einen vertikalen Abstand von einer halben > Zeile gekennzeichnet. Absatzenden werden nicht gekennzeichnet. This avoids the warning. # Using `center` environment Wrapping the `tabularx` in `\begin{center}...\end{center}` seems to work. Why? And is this a good idea? How do I avoid the additional vertical spacing? Answer: As egreg explained, in the center environment, \parfillskip is set to zero. # Other ideas The usual suggestion of adding `\noindent` has no effect. There is no indentation when using `parskip=half`. (The problem is at the end of the line, see the answers.) Writing `{.97\textwidth}` is of course not a solution. Using `{@{}XX@{}}` does not get rid of the warning.


title: How is it possible to have different kind of letters in latex

text: I wonder how can I have these kind of D's in latex ? ![enter image description here](http://i.stack.imgur.com/E1qeq.jpg)


title: \href and \includegraphics not making hyperlinks in XeLaTeX

text: I need to make hyperlink on a image. For that, I setup as follows.               \href{http://stackexchange.com/users/1170155/thekojueffect?tab=accounts}{\includegraphics[height=11pt]{stackexchange.png}}      The graphics is shown but the hyperlink is not created. But when I add text like               \href{http://stackexchange.com/users/1170155/thekojueffect?tab=accounts}{\includegraphics[height=11pt]{stackexchange.png}~StackExchange}      The hyperlink is created on the text "StackExchange" but I don't want to have text. How can I create hyperlink on a graphics? Any hacks/ideas? I'm using Ubuntu and `xelatex -version` gives               XeTeX 3.1415926-2.4-0.9998 (TeX Live 2012/Debian)     kpathsea version 6.1.0     Copyright 2012 SIL International and Jonathan Kew.     There is NO warranty.  Redistribution of this software is     covered by the terms of both the XeTeX copyright and     the Lesser GNU General Public License.     For more information about these matters, see the file     named COPYING and the XeTeX source.     Primary author of XeTeX: Jonathan Kew.     Compiled with ICU version 49.1 [with modifications for XeTeX]     Compiled with zlib version 1.2.7; using 1.2.7     Compiled with FreeType2 version 2.4.10; using 2.4.11     Compiled with fontconfig version 2.10.1; using 2.10.2     Compiled with libpng version 1.2.49; using 1.2.49     Compiled with poppler version 0.20.5


title: How to convert a png into pdf using LaTeX?

text: I have a larger png image: width is 5400 pixels and height is 3850 pixels. I need to transform it into a pdf file in SPA3 size, which means 320mm x 450mm. Is there a way to do it with LaTeX? What I think I need, is to be able to specify the paper size explicitly and to tell LaTeX that there should not be anything around the image.


title: How to replace a given string in a bibliography with biblatex?

text: Mendeley allows you to emphasise Latin names in article or report titles using HTML notation like so:               A treatise on the ecology of Rattus rattus      Using `biblatex`, the tags are passed on "verbatim" and of course LaTeX doesn't understand them. I would like to replace all `<I>` with `\emph{` and all `</I>` with `}`. I have tried using `\DeclareSourceMap` as follows:               \DeclareSourcemap{          \maps[datatype=bibtex]{           \map{                \step[fieldsource=title, match={}, replace={\emph{}]                 \step[fieldsource=title,match={},replace={}}]               }         }           }      But of course LaTeX chokes as the extra `{` and `}` confuse it. How should I escape the braces for this to work?


title: Formatting Eplain Table of Contents Entry

text: I need to define a macro for formatting an entry in a list of tables:               \def\toctableentry#1#2#3{...}      where the first argument is the table caption, the second is the table number, and the third is the page number. I am using the `eplain` table of contents macros to handle constructing the list, but the format of each entry needs to be as follows               1.4 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis         porttitor, ligula quis accumsan scelerisque, lacus nisi congue         dolor, at pulvinar urna augue sodales leo. Vivamus pretium         egestas sem in lacinia. . . . . . . . . . . . . . . . . . . . . 12      I know how to get the leader filling to work, but I need the left- justification to work. What I have so far goes like               \def\toctableentry#1#2#3{#2 #1\leaderfill #3\par}      with `\leaderfill` defined appropriately. This produces               1.4 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis     porttitor, ligula quis accumsan scelerisque, lacus nisi congue dolor,     at pulvinar urna augue sodales leo. Vivamus pretium egestas sem in     lacinia. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12      I suspect the solution has to do with displays, but I haven't figured out how to get that working. **Edit** Here is a quick, hacked together example file. The code of interest is the `\toctableentry` macro.               \input eplain          \def\leaderfill{\leaders\hbox to 1em{\hss.\hss}\hfill}          \def\toctableentry#1#2#3{\noindent{#2 #1\leaderfill #3}\par}          \newcount\tablenum     \tablenum0\relax     \def\table#1#2{       \advance\tablenum 1\relax       \xdef\tableref{\the\tablenum}       \writenumberedtocentry{table}{#2}{\tableref}       \hfil\vbox{         \hsize=0.75\hsize         \centerline{\box#1}         \noindent Table~\the\tablenum: #2       }\hfil     }          \readtocfile     \vskip1in          \newbox\tablebox     \setbox\tablebox=%         \vbox{         \offinterlineskip         \hrule         \halign{           &\vrule#&\strut\quad\hfil#\quad\cr           height2pt&\omit&&\omit&\cr           &Year\hfil&&World Population&\cr           height2pt&\omit&&\omit&\cr           \noalign{\hrule}           height2pt&\omit&&\omit&\cr           &8000 B.C.&&5,000,000&\cr           &50 A.D.&&200,000,000&\cr           &1650 A.D.&&500,000,000&\cr           &1850 A.D.&&1,000,000,000&\cr           &1945 A.D.&&2,300,000,000&\cr           &1980 A.D.&&4,400,000,000&\cr           height2pt&\omit&&\omit&\cr         }         \hrule       }          \table{\tablebox}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duisporttitor, ligula quis accumsan scelerisque, lacus nisi congue dolor,at pulvinar urna augue sodales leo.}          \bye


title: Custom Dashed Plot Lines in PGFPLots

text: I know that you can make a dashed line in pgfplots using the `\addplot[dashed]` option. However, the line that produces isn't dashed the way I'd like. I found `\pgfsetdash` in the documentation for PGF, but I can't figure out how to use it on just one `\addplot`. If I include it anywhere within the tikzpicture environment, it changes all of the lines, including the axes. I thought that adding a second `\pgfsetdash` would change the style, but it doesn't seem to have an effect. Any advice for creating custom dash styles in PGF plots?


title: Link to and attached/embedded file?

text: I'm using XeTeX and I'd like to have a link to an attached/embedded file. There's a solution here \-- but it doesn't work for me: I'm using TeXlive2012. As I understand it the best bet is to use `attachfile2` package. Here's an MWE:               \documentclass{article}          \usepackage[xetex]{attachfile2}          \begin{document}          \subsection{Test!}          Link: see \textattachfile{lagrange.png}{this citation}.          \end{document}      I can right-click on a link and save the file -- but it would be much nicer if I could just click the file and let the OS open it with the default application. **Edit** : If one attachs file with `attachfile2` \-- it behaves differenctly on different readers. If one embeds a file:               \documentclass{article}     \usepackage{navigator}     \embeddedfile{lagrange}{lagrange.png}     \begin{document}     I attached a file -- called \texttt{lagrange.png}     \end{document}      some users won't find it. So the most stable way is to put files to embed in a special dir, say in `flz`, and distribute the zip folder:               .     ├── 1.pdf     └── flz         └── lagrange.png      code:               \documentclass{article}     \usepackage{hyperref}     \begin{document}     See \href{run:flz/lagrange.png}{here}.     \end{document}      Then it's clickable and stable. **Edit 2** : I'm using `attachfile2` as posted in the first MWE.


title: Two vertical lines with expressions spanning a few rows between them (math)

text: I'm pretty new to Latex, learning it while doing. I mainly use doc and latex wiki, but there are occasions when I can't find something. I am doing some math. I need to have some math formulas followed by vertical lines and formulas spanning some rows between those vertical lines. Something like a notation of variable substitution in integrals. My explanation isn't perfect, so I made a picture of what I basically need. ![What I need](http://i.stack.imgur.com/RtX2v.png) Would be thankful for your advices on how I can achieve similar output. UPD. Made this post hastily. Found the answer myself. The easiest thing with ordinary latex I had to do was this code:               y= \begin{equation} \left \rVert         \begin{split} a = 2 \\         b = c \\         d = g          \end{split}         \right \rVert \end{equation} = gosdfds


title: Scaling "node distance" in tikz

text: Well, here's another TikZ question; this time, I have no idea how to find an answer. I would like to give all my nodes with relative coordinates:               \node (A) {A};     \node (B) [right = of A] {B};      using the `positioning` library. The distance is `node distance`. Unfortunately, it appears that passing the option `scale = <factor>` to `{tikzpicture}` does not have the desired effect on this distance; in fact, it does nothing. How can I give unit-free distances with relative coordinates?


title: Multiple commands in declareGraphicsRule - how to do it?

text: Although I'm not sure the graphicsRule below will do what I want, the main point is that it is not even generating the second eps file (epstool_tmp.eps) at all. What is going wrong? Here's an example with tiger.eps:               \documentclass[compress]{beamer}          \usepackage{graphicx}     \usepackage{epstopdf}          \epstopdfDeclareGraphicsRule{.eps}{pdf}{.pdf}{%       epstool --copy --bbox #1 --output epstool_tmp.eps;       epstopdf epstool_tmp.eps \OutputFile     }               \begin{document}          \frame{\frametitle{Here is an image ... or not!}     \begin{center}     \includegraphics[height=0.85\textheight,width=0.53\textwidth]     {tiger.eps}     \end{center}     }     \end{document}


title: auto-correct bounding box for eps files that simply wrap a bitmap

text: I have noticed that when including some EPS files, for whatever reason, the bounding box has been specified in quite a strange way (GIMP seems to be guilty of this, for instance). I should probably just go through each file and correct these manually - but I have to ask, is there an automated way to do this without too much trouble? I saw the package `bmpsize`, but it doesn't seem to work with EPS files. This is problematic for me when when I use pdflatex with the `epstopdf` package instead of latex -> dvips -> ps2pdf. Rather than post a MWE, I pose the simple question, is there a way to override the bounding box to be (0, 0, width, height) for all included EPS images that include solely bitmaps? EDIT: I have also noticed that the following solutions, though not wholly, automated, also do not work: Equivalent of bounding box when compile with pdflatex (ps2eps still returns an incorrect bounding box).


title: Proceedings of Royal Society Compilation error

text: I am trying to compile the following (i.e., Author_tex.tex): https://www.sharelatex.com/templates/52fdfa7134a287a85245b4bf and I receive the error: `! LaTeX Error: File RSPA_LOGO-color' not found.` I have downloaded all the files in one folder, but the figures don't show up at all while compiling. Can someone please help me? Thanks!


title: How to get intersection point(s) of two glyphs?

text: > **Longer post** I'd like to introduce you my long-term task which I wish to see solved one day. **Let's have two glyphs (any fonts, glyphs, location, transformation), one fixed, one moveable and some (randomly selected) direction. How to find a position of the second glyph where those two glyphs touch?** I'm using manual positioning and it cannot be used for tasks of word cloud magnitude or other optimization tasks (filling a glyph by smaller glyphs like the shapepar package can handle within basic shapes etc.). I haven't done extensive research on word cloud (also known as tag cloud) methods and algorithms, but my first impression was that the algorithms use bounding box of the words or of the glyphs. But I might be mistaken (I'm), please see this example from Wikipedia. We can clearly see there are words inside letters, so they are using some complex algorithms. This is a fine starting point: http://www.jasondavies.com/wordcloud/about/. More about algorithms. A note to computer scientists. This task belongs under collision detection (processing images). It has a wide area of use not only in visualization. I enclose a word cloud example and filling (any) space/glyph examples: ![wikipedia: word cloud](http://i.stack.imgur.com/IdW3R.png) ![filling space situation](http://i.stack.imgur.com/pcU7w.png) Let me illustrate this situation. Let's choose letters `a` and `b` from the Latin Modern family, left-right direction, no transformation. We are getting (in this example I'm using `\kern`): ![mwe, part 1](http://i.stack.imgur.com/6aeZ5.png) Update: From mathematical point of view, there might be and often are more solutions when we move the second glyph further to the left. For instance, when we typeset `ab` in the first example we are getting the second solution: ![mwe, part 1, next solution](http://i.stack.imgur.com/IeNr8.png) Let's try another example with some transformation of letter `b` and direction of 20 degrees (I'm using TikZ for glyph movement): ![mwe, part 2](http://i.stack.imgur.com/br2W6.png) After finding an intersection point we could move the second glyph backwards to get a certain amount of white space reserve between two glyphs in that direction. This is one more example, which could be used for two-step optimization. First step would be finding an intersection point and after setting up an anchor we could scale (or we could rotate) the second glyph and we would find next intersection point. It's rather complex example: ![mwe, part 3](http://i.stack.imgur.com/JDU9Q.png) * * * > **What are our options?** I'm using manual transformation (location, rotation, scale) of the second glyph. That's not practical way. My first (poor) idea was to get a series of raster graphics where I would compute number of non-white pixels. If a number of pixels of letter `a` and `b` typeset separately would be the same as number of pixels of both letters typeset together, that would be the proof they are not touching yet. It would be computationally ineffective. Update: When we try to move letters in How the Word Cloud Generator Works, it looks they use rasterization and this technique. They use spiral path to find the best spot for placing the next word. It's possible it isn't that poor idea. It would be an interesting problem at TeX.SX if we are able to raster a vector graphics on-the-fly and process it at the pixel level. I'm thinking of Lua(TeX) and its tools (or TikZ and a new externalization library, perhaps?). I enclose an example from Jason Davies's website. His main website and those examples are inspiring, http://www.jasondavies.com/. Red means the glyphs are not touching, yet, the orange means they are overlapping. ![rasterization technique](http://i.stack.imgur.com/SMXzG.png) I was hoping that I could turn off kerning and move the second glyph by its left bearing. But that's not enough as we try to consider also glyph transformation. I started to believe I'm getting closer when I noticed that the glyph consists of Bézier curves which are stored in the font file (PFB, TTF, OTF) in a form of control points. We can get Bézier curves from the font files then. I enclose a small example from the Metapost manual, see page 50 for further details, where the control points can be seen. The native output format of Metapost is PostScript, we can get SVG and PNG by Metapost or by other conversion tools easily. We could use pstoedit to export the PostScript format to some more vector formats. We run the following lines:               mpost mal-mpost.mp       ps2pdf mal-mpost.56       pdfcrop --hires mal-mpost.56.pdf        The content of `mal-mpost.mp` is this:               fontmapfile "=lm-ec.map";     beginfig(56);     picture q;     path p;     interim ahlength := 12bp;     interim ahangle := 25;     q := glyph "Dcaron" of "ec-lmr10" scaled .2;     for item within q:     p := pathpart item;     drawarrow p withcolor (.6,.9,.6)     withpen pencircle scaled 1.5;     for j=0 upto length p:     pickup pencircle scaled .7;     draw (point j of p -- precontrol j of p)     dashed evenly withcolor blue;     draw (point j of p -- postcontrol j of p)     dashed evenly withcolor blue;     pickup pencircle scaled 3;     draw precontrol j of p withcolor red;     draw postcontrol j of p withcolor red;     pickup pencircle scaled 2;     draw point j of p withcolor black;     endfor     endfor     endfig;     bye;      ![mwe, metapost](http://i.stack.imgur.com/usroW.png) Another way would be to use FontForge and export glyphs to a single SVG file or to a series of the SVG files (one file per glyph). Our input would look like this (cut version):               <path fill="#000000" stroke="none" d="     M 16.07 598.52     C 12.15 596.38 10.29 593.46 10.29 589.48     C 10.29 584.21 13.72 581.58 25.70 577.59     C 43.87 571.58 60.97 564.17 63.35 561.28     C 64.70 559.64 65.31 557.52 64.85 556.06     C 63.64 552.26 66.69 541.58 70.74 535.48     C 72.76 532.45 76.78 528.51 79.69 526.75     C 86.19 522.82 101.12 511.82 102.10 510.26      The SVG format is using `M` for move, `L` for a straight line and `C` for Bézier curve. As we can see from the above example to have the control points is not enough for us, we need to reconstruct the Bézier curve(s). There is a small potential improvement. We could use `svg2tikz` script to convert it to the TikZ code. The TikZ code would look like this (cut version):               \begin{tikzpicture}[y=0.80pt, x=0.8pt,yscale=-1, inner sep=0pt, outer sep=0pt]     \begin{scope}[shift={(0,0)},scale=1.000]       \path[fill=black] (16.0700,598.5200) .. controls (12.1500,596.3800) and         (10.2900,593.4600) .. (10.2900,589.4800) .. controls (10.2900,584.2100) and         (13.7200,581.5800) .. (25.7000,577.5900) .. controls (43.8700,571.5800) and         (60.9700,564.1700) .. (63.3500,561.2800) .. controls (64.7000,559.6400) and         (65.3100,557.5200) .. (64.8500,556.0600) .. controls (63.6400,552.2600) and         (66.6900,541.5800) .. (70.7400,535.4800) .. controls (72.7600,532.4500) and         (76.7800,528.5100) .. (79.6900,526.7500) .. controls (86.1900,522.8200) and         (101.1200,511.8200) .. (102.1000,510.2600) .. controls (102.4800,509.6300) and       I was thinking that it might be a way. Once we have a series of curves we can find intersection points. I enclose a snippet of what I think might work. That's an intersection of two paths, I've chosen left-right direction. The variable `\t` in TikZ holds information about number of points (0, 1, 2, ...). When `\t=0` that means the paths are not touching, any other value means they are. We can get position of the intersection points, please see the TikZ manual and section about the intersections library, please see pages 139+ or 987+ in the TikZ3 manual. I'm sure that finding intersection points would be than easy in other programs (Metapost, PSTricks, Asymptote, ...). My idea is to prepare two sets of paths, one set for each glyph, and compare all paths from one set with paths in the second set. In theory, that should assure that we won't miss any intersection point. This will require some experimenting. ![mwe, tikz, intersection of two paths](http://i.stack.imgur.com/N5DlQ.png) LuaTeX is preprocessing font files and store information about glyphs in the Lua file, e.g. please see `lmroman10-regular.lua` (cut version). We can find bounding box and other information, but not the control points of the Bézier curves. That would increase size of Lua file significantly. We may use FontForge and its native SFD format or we could convert TTF/OTF font files to XML by other tools, e.g. by TTX (tested), or to SVG, e.g. by ttftosvg (http://everythingfonts.com/ttf-to-svg) (untested). We would get the control points but it leaves the glyphs transformation unprocessed.               return {      ["cache_version"]=2.749,      ["descriptions"]={       [32]={        ["boundingbox"]=1,        ["index"]=103,        ["name"]="space",        ["width"]=333,       },       [33]={        ["boundingbox"]={ 86, 0, 192, 716 },        ["index"]=53,        ["name"]="exclam",        ["width"]=278,       },       [34]={        ["boundingbox"]={ 102, 423, 272, 705 },        ["index"]=93,        ["name"]="quotedbl",        ["slookups"]={         ["ctx_tlig_1_1"]=8221,        },        ["width"]=374,       },      I enclose the TeX code of the snippets mentioned in the post. We can run `xelatex` and `lualatex` engines which can handle loading of the OTF file directly.               % run: xelatex or lualatex mal-intersection.tex     \documentclass[a4paper,landscape]{article}     \pagestyle{empty}     \usepackage{tikz}     \tikzset{inner sep=0pt, outer sep=0pt, yes/.style={green}, no/.style={red}}     \usetikzlibrary{intersections}     \usepackage{fontspec}     \setmainfont[Scale=15]{lmroman10-regular.otf}          \begin{document}          a{\color{red}b} % common typesetting     a\kern-6.5mm{\color{green}b} % manual solution      \begin{tikzpicture}     \begin{pgfinterruptboundingbox}     \draw[no,<-,line width=2mm] (5,4)--(8,4);     \end{pgfinterruptboundingbox}     \end{tikzpicture}%          \newpage     a{\color{red}b}\hspace{20mm} % common typesetting     a\kern-51mm{\color{green}b} % manual solution      \begin{tikzpicture}     \begin{pgfinterruptboundingbox}     \draw[no,<-,line width=2mm] (-12,4.5)--(-6,4.5);     \end{pgfinterruptboundingbox}     \end{tikzpicture}%          \newpage     \begin{tikzpicture}     \node{a};     \node[rotate=45,no] at (20:3cm){b};     \draw[no,<-,line width=2mm] (20:5cm)--(20:7cm);     \end{tikzpicture}%     \begin{tikzpicture}     \node{a};     \node[rotate=45,yes] at (20:2.5cm){b};     \end{tikzpicture}          \newpage     \begin{tikzpicture}     \node{a};     \node[scale=0.1,yshift=-40mm,no,rotate=-45]{b};     \draw[no,->,line width=2mm] (0,2mm)--(0,10mm);     \end{tikzpicture}%     \begin{tikzpicture}     \node{a};     \node[scale=0.1,yshift=-13.5mm,no,rotate=-45]{b};     \draw[no,<-,line width=2mm] (0,2mm)--(0,10mm);     \end{tikzpicture}%     \begin{tikzpicture}     \node{a};     \node[scale=0.1,yshift=-13.5mm,rotate=-45,yes,scale=3,xshift=8mm,yshift=-13mm]{b};      % + setting an anchor     \end{tikzpicture}%          \begin{tikzpicture}[line width=1mm]     \draw[name path=first] (-5,10) .. controls (0,5) and (0,-5) .. (-1,-1);     \draw[name path=second,no] (1,10) .. controls (0,5) and (0,-5) .. (1,-1);     \draw[no,<-,line width=2mm] (-20mm,70mm)--(0,70mm);     \end{tikzpicture} %     \begin{tikzpicture}[line width=1mm]     \draw[name path=first] (-5,10) .. controls (0,5) and (0,-5) .. (-1,-1);     \draw[name path=second,xshift=-8.1mm,yes] (1,10) .. controls (0,5) and (0,-5) .. (1,-1);     \draw[name intersections={of=first and second, name=i, total=\t}]        node {\typeout{total points: \t}}; % total points: 2 (-8.1mm)     \end{tikzpicture}%          \end{document}      * * * > **My humble proposals** **1\. True/False** After `\checkme{glyphs}{glyphs}` we might get:   * `True`, if glyphs have some intersection points. Subquestion: How many we have got?   * `False`, if they don't. Subanswer: We have got 0 intersection points. **2\. Distance** After `\checkdistance{glyphs}{glyphs}{angle}` we might get:   * Some dimension, e.g. `2.3cm`, which measure minimum distance between those glyphs in that direction.    * We should get all the solutions, e.g. when glyphs are inside glyphs, the touching point will be get from the opposite side of the glyphs etc.   * We should get warning or `\dimenmax` if there is no solution and no intersection can be found. The subquestion could be what's the nearest change in angle to get some intersection point. **3\. Graphical representation**   * If the glyphs are already overlapping we should get marks at those points (the intersection points of the Bézier curves).   * We might get that overlapping region in different color.   * We should get a list of intersection points as a list of coordinates in a log file and/or at the terminal.   * The subquestion could be what's the minimum distance (and its angle) to get no intersection points (we would be separating overlapping glyphs). **4\. Filling space**   * How to fill some empty space with a glyph (using location, rotation, and/or scale) to get the biggest glyph.   * We should be able to fix some of the parameters, e.g. location, and let the optimization works with other two parameters (rotation, scale). **5\. Rasterization**   * Until now, I have written down some ideas using vector form, but it might be possible to raster our glyphs first and then to do some calculations as algorithms in word/tag clouds do. Outside the TeX we use GhostScript (or some backend tools like ImageMagick or GraphicsMagick) to handle this task.   * We might be able to use TikZ and its externalization library to get raster graphics (or shall we use PDF -> Metapost conversion with help of the pstoedit tool, perhaps?), but how to process those pictures on-the-fly? With the help of ImageMagick and `\write18`, perhaps? * * * > **Update: A demonstration** I've found an interesting JavaScript demonstration of this task, please try http://paperjs.org/examples/path-intersections/ for yourself. ![paperjs.org](http://i.stack.imgur.com/wRkwa.png)


title: List of graphs in latex and numbering like Graph 1: , Graph 2:, ect

text: I am using the trivfloat package to define new environment for graphs. So far so good. I would like to make a list of graphs in the following layout: Graph 1: This is my graph Graph 2: This is my second graph With tables and figures I reconfigure the list with the following code:               \renewcommand{\cfttabaftersnum}{:}     \newlength\tablelen     \settowidth\tablelen{Table}     \addtolength\cfttabnumwidth{\tablelen}     \renewcommand\cfttabpresnum{Table }      How can I do this with the graph custom float env?


title: picture is delocated or an empty page before and after the picture

text: I have been having some troubles with the insertion of picture in my document(pdf) when using latex. At first, when I inserted the picture, the picture was delocating. this was the code.               \begin{figure}            \begin{center}              \makebox[\linewidth]{            \includegraphics[width=20cm ]{img/myImage.jpg}}                 \caption{This is my image}            \label{fig:ToUseWithReference}      \end{center}     \end{figure}      Then I some how fixed it this way.               \begin{figure}[p]            \vspace*{-2cm}         \makebox[\linewidth]{           \includegraphics[width=20cm ]{img/myImage.jpg}}                \caption{This is my image}           \label{fig:ToUseWithReference}          \end{figure}     \clearpage      But this brought up another problem. there is always an empty page left before and after the image is displayed even if I am displaying on a free and empty page. Does anyone knows what is wrong.


title: What is the most elegant way to provide a cross-platform project with automated compilation routine?

text: There are many different ways to automate the compilation of a LaTeX project. I would like to start a discussion, what would be the most flexible and elegant and omnipotent way to provide a project which is compilable quickly on all operation systems, in most programs and for all users. The example scenario: I am uploading a "super complex project" to BitBucket or alike. I want to work on it on Linux and Windows. If others want to contribute something, they just have to read my `README.md` saying for example "Install `arara` and `make`, open `main.tex` in vim and run `:make` on Linux or `:! make` on Windows! Ready!" * * * I have not used rubber or latexmk but am keen to learn about. Please comment on that, if you like it. * * * My routine for now is: Using arara in the `main.tex`               % arara: lualatex: { shell: yes }     % arara: biber     % arara: makeglossaries     % !arara: indent: { overwrite : yes, trace : yes, files: [ header.tex, main.tex, chapter/Foo.tex, chapter/Bar.tex] }      Edit this file in vim and run `:make` with the following `Makefile` (excerpt)               target = main          all: ararabuild          full:          ararabuild         ararabuild         ararabuild          ararabuild:         arara --log --verbose $(target)          view: ararabuild viewonly          viewonly:         evince $(target).pdf || AcroRd32.exe $(target).pdf          bib:          biber $(target)          %.pdf: %.tex         ararabuild $<          clean:         find . -name "*.log" | xargs rm -vf         find . -name "*.aux" | xargs rm -vf         find . -name "*.toc" | xargs rm -vf         find . -name "*.blg" | xargs rm -vf         find . -name "*.out" | xargs rm -vf         find . -name "build" | xargs rm -vf      This runs good for me (except the cross-platform `view` stuff). But I just would like to see what techniques are around, what is best practice... or simple: How to get rid of all the configurations of different `LaTeX`-programs, the explanations of compiling routines and so on. Just imagine a `TeX`-template for a company. Much easier to provide if they just have to input their text using some familiar editor and then (for example) double click on some batch file... I hope it is allowed to start such a discussion here. TeX automation tools are cool, but their use isn't that popular until now and cool using examples are still missing i.m.o.


title: Vertical centering in multirow table cells

text: The documentation for the multirow package implies that the content of a `\multirow` will be vertically centered by default. In this example (machine- generated from a Word document, hence all the poodlefaking):   * in the first row, the first cell spans 3 rows, and the other cells are just cells;   * in the second row, the first cell continues its spanning, and the other cells all span 2 rows;   * the author has unwittingly added a bogus third row, but it shouldn't matter, as it has to be there to be the recipient of the spans from rows 1 and 2. ![output from code below](http://i.stack.imgur.com/BMoPg.jpg) (Ignore the extra rules: I'm still working on the code to get that right) The problem is that the text in col 1 is not vertically-centred with respect to the 3 rows that it spans. Cells 2/3/4 on row 2 are correctly vertically- centred in themselves. I can try to add the `fixup` optional argument to `\multirow`, but this is within an automated process, so working out how much to add is problematic, as for the general case, there is no easy way to calculate the amount.               \documentclass{article}     \usepackage[utf8x]{inputenc}     \usepackage[T1]{fontenc}     \usepackage[margin=1in]{geometry}     \usepackage{array,multirow}     \pagestyle{empty}     \begin{document}     % code generated from Word OOXML via XSLT2     \begin{tabular}{@{}         |>{\raggedright}p{3cm}         |>{\raggedright}p{3cm}         |>{\raggedright}p{3cm}         |>{\raggedright}p{3cm}         |@{}}\hline     % first row     \multirow{3}{3cm}[-2\baselineskip]{Tests:}     &\multicolumn{1}{|>{\raggedright}m{3cm}|}{Vortest}     &\multicolumn{1}{|>{\raggedright}m{3cm}|}{1. Nachtest}     &\multicolumn{1}{|>{\raggedright}m{3cm}|}{2. Nachtest}\\     % second row     &\multirow{2}{3cm}{Juni vor dem TSC}     &\multirow{2}{3cm}{September nach dem TSC}     &\multirow{2}{3cm}{Mai/Juni im Jahr nach dem TSC}     \\\cline{1-1} % this is line 24     % bogus third row     &&&\\\cline{1-1}\cline{2-2}\cline{3-3}\cline{4-4}     \end{tabular}     \end{document}      The other problem is that processing this document gets me the error:               ! Misplaced \omit.     \@cline #1-#2\@nil ->\omit                             \@multicnt #1\advance \@multispan \m@ne \ifnum \@...     l.24     \\\cline{1-1}          ! Leaders not followed by proper glue.     <to be read again>                     \hfill      l.24     \\\cline{1-1}


title: Add asterisk after labels in enumerate

text: I would like to add an asterisk after certain labels in the enumerate environment. So for example               \documentclass{article}     \begin{document}          \begin{enumerate}         \item Kuttel         \item* Daddeldu     \end{enumerate}          \end{document}      but without the space between 2. und *.


title: Position Specifiers appearing in final pdf document using memoir

text: I am using the `memoir` class to generate my thesis and when I declare a figure or table using a position specifier, where the position specifier is `h`, `t`, etc., my final PDF document has the label/position specifier printed over the figure. I am using               \begin{figure}[h]       to declare my figure. In this case my figure prints where i want it but prints 'h' above the figure. Any ideas as to what's going on or how to fix would be much appreciated.


title: Installation of LaTeX package: fetch external resources

text: I am writing a LaTeX class and aim to bundle it as `.dtx`. My problem is that the class uses graphics that are available for download on the internet, but the license doesn't allow me to spread them along with my class. So my question is: Is there a preferred way to bundle a class so that it fetches external resources on installation (using `curl` / `wget` / whatever)? Is there a way to make this cross-platform? Currently I'm using a Makefile, but this isn't a solution for Windows users.


title: Using an array environment inside an xparse command

text: I would like to define a macro for optimization problems. My attempt is given below. I am wondering why `\optimizationproblema` works, but `\optimizationproblemb` does not (I get a "misplaced alignment tab" error when I try to use the latter). Apparently my constraints aren't viewed as belonging within the array in `\optimizationproblemb`? If there's a better way to approach the problem of defining my macro, that'd be nice to know, too. I'd like to keep the usage more or less the same (that is,               \optimizationproblem{minimize}{x}{f(x)}{g(x) <= 0}      should represent minimize f(x) over x subject to g(x) <= 0; I also need some way to suppress the "subject to" parts for unconstrained problems [I use an `\IfValueTF` test in my actual code]), but I don't really care about the implementation.               \documentclass{article}         \usepackage{amsmath}         \usepackage{xparse}              \NewDocumentCommand{\optimizationproblema}{mmmm}         {             \begin{array}{c@{\ }c@{\ }l}                 \displaystyle\operatorname*{#1}_{#2} & :                     & #3 \\                 \mathrm{subject \ to} & : &                     \begin{array}[t]{@{}r@{\ }c@{\ }l@{\qquad}l}                         #4                     \end{array}             \end{array}         }              \NewDocumentCommand{\optimizationproblemb}{momo}         {             \begin{array}{c@{\ }c@{\ }l}                 \displaystyle\operatorname*{#1}_{#2} & :                     & #3 \\                 \mathrm{subject \ to} & : &                     \begin{array}[t]{@{}r@{\ }c@{\ }l@{\qquad}l}                         #4                     \end{array}             \end{array}         }              \NewDocumentCommand{\constraint}{mmm}         {             #1 & #2 & #3 \\         }          \begin{document}          \[         \optimizationproblema         {             minimize         }         {             x \in \mathbf{R}^{n}         }         {             c^{T} x         }         {             \constraint{A x}{=}{b}             \constraint{x}{\geq}{0}         }     \]          %\[     %   \optimizationproblemb     %   {     %       minimize     %   }     %   [     %       x \in \mathbf{R}^{n}     %   ]     %   {     %       c^{T} x     %   }     %   [     %       \constraint{A x}{=}{b}     %       \constraint{x}{\geq}{0}     %   ]     %\]          \end{document}      I would like to thank @egreg very much for his help. I have two more features that I would like to implement, and I was wondering if I could get just a little more assistance from the community. In particular, I would like to support box constraints and enumerated constraints. Before egreg gave his solution using LaTeX3, my constraint command was a macro with signature mmmggo. The first three arguments represented a standard constraint; the fourth and fifth arguments represented the additional information in a box constraint; and the sixth argument represented the enumeration for an enumerated constraint. My attempt to get these features working in shown below (the failed portions are commented out). A couple of notes about my motivation for certain choices: I would like to make the constraints readable in usage, this is why I prefer formatting constraints using the constraint command given below; if none of the constraints are enumerated, I want to prevent the \qquad used to set off the enumerations from being printed to preserve the horizontal centering of the problem. I consider the box-constraint issue mostly resolved (I can always just include the additional information for the box constraint in the third argument as shown below). However, I would really like the abilities to (1) have the enumeration be an optional argument, (2) suppress the \qquad used to set off the enumerations when no enumerated constraints are used (to preserve the horizontal centering of the optimization problem).               \documentclass{article}         \usepackage{amsmath}         \usepackage{array}         \usepackage{xparse}              \ExplSyntaxOn             % allocate the variables for an optimization problem             \tl_new:N \l_optprob_operator_tl             \tl_new:N \l_optprob_variable_tl             \tl_new:N \l_optprob_objective_tl             \tl_new:N \l_optprob_constraints_tl                  % define the keys             \keys_define:nn{optprob}             {                 operator   .tl_set:N = \l_optprob_operator_tl,                 variable   .tl_set:N = \l_optprob_variable_tl,                 objective  .tl_set:N = \l_optprob_objective_tl,                 constraint .code:n   = \optprob_add_constraint:nnnnnn #1,                 % constraint .code:n   = \constraint{#1}             }                  \NewDocumentCommand{\optimizationproblem}{m}             {                 % clear the variables                 \tl_clear:N \l_optprob_operator_tl                 \tl_clear:N \l_optprob_variable_tl                 \tl_clear:N \l_optprob_objective_tl                 \tl_clear:N \l_optprob_constraints_tl                      % get the keys                 \keys_set:nn{optprob}{#1}                      % print the optimization problem                 \tl_if_empty:NTF \l_optprob_objective_tl                 {                     % feasibility problem                     \begin{array}[t]{@{}r@{}>{{}}c<{{}}@{}l@{}l}                         \l_optprob_constraints_tl                     \end{array}                 }                 {                     % optimization problem                     \begin{array}{c@{{}\mathrel{:}{}}l}                         \displaystyle\operatorname*{\l_optprob_operator_tl}\sb{\l_optprob_variable_tl} &                             \l_optprob_objective_tl \\[2ex]                         \tl_if_empty:NF \l_optprob_constraints_tl                         {                             % constrained optimization problem                             \textnormal{subject~to} &                                 \begin{array}[t]{@{}r@{}>{{}}c<{{}}@{}l@{}l}                                     \l_optprob_constraints_tl                                 \end{array}                         }                     \end{array}                 }             }                  \NewDocumentCommand{\constraint}{mmmggo}             {                 \IfValueTF{#4}                 {                     \IfValueTF{#6}                     {                         #1 & #2 & #3 #4 #5 & \qquad #6 \\                     }                     {                         #1 & #2 & #3 #4 #5 \\                     }                 }                 {                     \IfValue{#6}                     {                         #1 & #2 & #3 & \qquad #6 \\                     }                     {                         #1 & #2 & #3 \\                     }                 }             }                  % helper function to process the constraints             \cs_new_protected:Npn \optprob_add_constraint:nnnnnn #1 #2 #3 #4             {                 \tl_put_right:Nn \l_optprob_constraints_tl {#1 & #2 & #3 & \qquad #4 \\}             }         \ExplSyntaxOff          \begin{document}          \[         \optimizationproblem         {             operator   = minimize,             variable   = x \in \mathbf{R}^{n},             objective  = c^{T} x,             constraint = {A_{i} x}{=}{b_{i}}{i = 1 , \ldots , m},             % constraint = {A_{i} x}{=}{b_{i}}[i = 1 , \ldots , m],             constraint = {F_{j} x}{\leq}{g_{j}}{j = 1 , \ldots , m},             % constraint = {F_{j} x}{\geq}{g_{j}}[j = 1 , \ldots , m],             constraint = {0}{\leq}{x \leq 1}{},             % constraint = {0}{\leq}{x}{\leq}{1},         }     \]          \end{document}


title: Why is picture and matrix not drawn at the same height

text: I'm trying to put a adjacency matrix beneath a graph using `subfloat`. The graph is drawn with `tikz`. No matter what I do, the matrix is put below the graph as shown here: ![Graph and matrix not at same height](http://i.stack.imgur.com/emSXt.jpg) The code is here:               \begin{figure}[h]     \centering     \subfloat{     \begin{tikzpicture}[-,>=stealth',shorten >=1pt,auto,node distance=2cm,       thick,main node/.style={circle,fill=black!20,draw}]            \node[main node] (1) {$v_2$};       \node[main node] (2) [below left of=1] {$v_1$};       \node[main node] (3) [below right of=1] {$v_3$};       \node[main node] (4) [below of=3] {$v_4$};       \node[main node] (5) [below of=2] {$v_5$};            \path[every node/.style={font=\sffamily\small}]         (2) edge node [left] {} (1)         (2) edge node [left] {} (3)         (1) edge node [left] {} (5)         (1) edge node [left] {} (3)         (3) edge node [left] {} (4)         (4) edge node [left] {} (5)         ;     \end{tikzpicture}}     \subfloat{     \begin{math}     A_{G} = \left(     \begin{array}{ccccc}     0 & 1 & 1 & 0 & 0 \\     1 & 0 & 1 & 0 & 1 \\     1 & 1 & 0 & 1 & 0 \\     0 & 0 & 1 & 0 & 1 \\     0 & 1 & 0 & 1 & 0     \end{array}     \right)     \end{math}     }     \caption{\textbf{Sample graph and adjacency matrix.} Example graph with 5 vertices and 5 edges and its adjacency matrix $A_{G}$}     \label{fig: example graph for modularity calculation}     \end{figure}      Does anybody have an idea, why this happens and how I can prevent it?


title: Creating List of Notation

text: I have been using LaTex for a while however I am new to writing a new command. Essentially I wanted to make a list of notation for my thesis. I have seen quite a few styles of nomenclatures, but none of them really meets my desire. In my list of notation I want to have one column for the symbols and one column for the corresponding page numbers. Also I want the list of notation to appear in my table of contents. I have roughly had the algorithm:   1. for each symbol, write a new command to assign a label, and keep them in a certain list;   2. write another new command to add list of notation to table of contents, and print these symbols as well as their page numbers. Apologize if the question is too simple. Maybe there are some packages available but I didn't know. I guess it is not too hard to write a new command for this but I just really haven't learnt any thing about this. So if you can provide me a MWE it would be great.


title: Tikz: Color a region

text: I used the following code to draw a picture. I want to make the region insde (0,7), (0,11),(3,8),(3,4) to be red, and the region above it to be gray, but I don't know how to do this.               \documentclass{article}     \usepackage{tikz}     \begin{document}     \pagestyle{empty}     \begin{tikzpicture}[scale=0.5]          \draw (1.05cm,2pt) node[above];      %  {$\displaystyle\int_0^{3/2} \!\!x^2\mathrm{d}x$};          \draw[style=help lines] (0,0) grid (3.9,11.9);       % [step=0.25cm]      (1,2) grid +(1,1);          \draw[->] (-1,0) -- (4,0) node[right] {$i$};     \draw[->] (0,-1) -- (0,12) node[above] {$j$};          \foreach \x/\xtext in {1/1, 2/2, 3/3}     \draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {$\xtext$};          \foreach \y/\ytext in {1/, 2/, 3/,4/,5/,6/,7/7,8/, 9/, 10/, 11/11}     \draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};          \draw  {(0,11) -- (3,8)} node[below right] ;     \draw  {(0,7) -- (3,4)} node[below right] ;     \draw  {(3,8) -- (3,4)} node[below right] ;     \end{tikzpicture}          \end{document}      ![enter image description here](http://i.stack.imgur.com/JycW0.png)


title: Incorrect running heads on last page of a long table

text: I'm setting a table of logarithms. I'm using longtable, and it works well. Every line of the table has a markboth reference, like so:               \textbf{1.03}\markboth{1.03}{1.03} & .01284 & .01326 & ...     \textbf{1.04}\markboth{1.04}{1.04} & .01703 & .01745 & ...     \textbf{1.05}\markboth{1.05}{1.05} & .02119 & .02160 & ...      My headings are generated using:               \makeatletter     \def\@oddhead{\thepage\qquad\textsc{Decimal Logarithms}\hfill       \rightmark{} -- \leftmark}     \def\@evenhead{\rightmark{} -- \leftmark \hfill       \textsc{Decimal Logarithms}\qquad\thepage}     \makeatother      The text in the running head is correct for most of the table: 1.00 – 1.47, 1.48 – 1.96, ... except the last page, which just displays 9.99 – 9.99, when it should be 9.81 – 9.99. The last page isn't quite filled by the table. I've tried the methods suggested in Indexing an interval of words on top of every page, which only results in the last page having a single header of 9.99. My TeX is a bit rusty; haven't used it seriously in over a decade. Any assistance appreciated. **Update** : Here's a test case just long enough to generate a page throw:               \documentclass{article}     \usepackage{longtable}     \pagestyle{headings}          \begin{document}          % page headings     \makeatletter     \def\@oddhead{\thepage{} \hfill \rightmark{} -- \leftmark{}}     \def\@evenhead{\rightmark{} -- \leftmark{} \hfill \thepage{}}     \makeatother          \begin{longtable}{|*{4}{c|}}       & 0 & 1 & 2 \\ \hline \endhead     \hline \endfoot      1.00\markboth{1.00}{1.00} & .00000 & .00043 & .00087 \\      1.01\markboth{1.01}{1.01} & .00432 & .00475 & .00518 \\      1.02\markboth{1.02}{1.02} & .00860 & .00903 & .00945 \\      1.03\markboth{1.03}{1.03} & .01284 & .01326 & .01368 \\      1.04\markboth{1.04}{1.04} & .01703 & .01745 & .01787 \\      1.05\markboth{1.05}{1.05} & .02119 & .02160 & .02202 \\      1.06\markboth{1.06}{1.06} & .02531 & .02572 & .02612 \\      1.07\markboth{1.07}{1.07} & .02938 & .02979 & .03019 \\      1.08\markboth{1.08}{1.08} & .03342 & .03383 & .03423 \\      1.09\markboth{1.09}{1.09} & .03743 & .03782 & .03822 \\      1.10\markboth{1.10}{1.10} & .04139 & .04179 & .04218 \\      1.11\markboth{1.11}{1.11} & .04532 & .04571 & .04610 \\      1.12\markboth{1.12}{1.12} & .04922 & .04961 & .04999 \\      1.13\markboth{1.13}{1.13} & .05308 & .05346 & .05385 \\      1.14\markboth{1.14}{1.14} & .05690 & .05729 & .05767 \\      1.15\markboth{1.15}{1.15} & .06070 & .06108 & .06145 \\      1.16\markboth{1.16}{1.16} & .06446 & .06483 & .06521 \\      1.17\markboth{1.17}{1.17} & .06819 & .06856 & .06893 \\      1.18\markboth{1.18}{1.18} & .07188 & .07225 & .07262 \\      1.19\markboth{1.19}{1.19} & .07555 & .07591 & .07628 \\      1.20\markboth{1.20}{1.20} & .07918 & .07954 & .07990 \\      1.21\markboth{1.21}{1.21} & .08279 & .08314 & .08350 \\      1.22\markboth{1.22}{1.22} & .08636 & .08672 & .08707 \\      1.23\markboth{1.23}{1.23} & .08991 & .09026 & .09061 \\      1.24\markboth{1.24}{1.24} & .09342 & .09377 & .09412 \\      1.25\markboth{1.25}{1.25} & .09691 & .09726 & .09760 \\      1.26\markboth{1.26}{1.26} & .10037 & .10072 & .10106 \\      1.27\markboth{1.27}{1.27} & .10380 & .10415 & .10449 \\      1.28\markboth{1.28}{1.28} & .10721 & .10755 & .10789 \\      1.29\markboth{1.29}{1.29} & .11059 & .11093 & .11126 \\      1.30\markboth{1.30}{1.30} & .11394 & .11428 & .11461 \\      1.31\markboth{1.31}{1.31} & .11727 & .11760 & .11793 \\      1.32\markboth{1.32}{1.32} & .12057 & .12090 & .12123 \\      1.33\markboth{1.33}{1.33} & .12385 & .12418 & .12450 \\      1.34\markboth{1.34}{1.34} & .12710 & .12743 & .12775 \\      1.35\markboth{1.35}{1.35} & .13033 & .13066 & .13098 \\      1.36\markboth{1.36}{1.36} & .13354 & .13386 & .13418 \\      1.37\markboth{1.37}{1.37} & .13672 & .13704 & .13735 \\      1.38\markboth{1.38}{1.38} & .13988 & .14019 & .14051 \\      1.39\markboth{1.39}{1.39} & .14301 & .14333 & .14364 \\      1.40\markboth{1.40}{1.40} & .14613 & .14644 & .14675 \\      1.41\markboth{1.41}{1.41} & .14922 & .14953 & .14983 \\      1.42\markboth{1.42}{1.42} & .15229 & .15259 & .15290 \\      1.43\markboth{1.43}{1.43} & .15534 & .15564 & .15594 \\      1.44\markboth{1.44}{1.44} & .15836 & .15866 & .15897 \\      1.45\markboth{1.45}{1.45} & .16137 & .16167 & .16197 \\      1.46\markboth{1.46}{1.46} & .16435 & .16465 & .16495 \\      1.47\markboth{1.47}{1.47} & .16732 & .16761 & .16791 \\      1.48\markboth{1.48}{1.48} & .17026 & .17056 & .17085 \\      1.49\markboth{1.49}{1.49} & .17319 & .17348 & .17377 \\      1.50\markboth{1.50}{1.50} & .17609 & .17638 & .17667 \\      1.51\markboth{1.51}{1.51} & .17898 & .17926 & .17955 \\      1.52\markboth{1.52}{1.52} & .18184 & .18213 & .18241 \\      1.53\markboth{1.53}{1.53} & .18469 & .18498 & .18526 \\      1.54\markboth{1.54}{1.54} & .18752 & .18780 & .18808 \\      1.55\markboth{1.55}{1.55} & .19033 & .19061 & .19089 \\      1.56\markboth{1.56}{1.56} & .19312 & .19340 & .19368 \\      1.57\markboth{1.57}{1.57} & .19590 & .19618 & .19645 \\      1.58\markboth{1.58}{1.58} & .19866 & .19893 & .19921 \\      1.59\markboth{1.59}{1.59} & .20140 & .20167 & .20194 \\     \end{longtable}          \end{document}


title: Biblatex style not working

text: I need to generate the following style for my thesis, ![Desired university format](http://i.stack.imgur.com/dg9Rb.jpg) For this, the following `biblatex` style has been tried, and still I experience two problems. ![problematic format](http://i.stack.imgur.com/EKepf.jpg)   1. In the Prefix to year, no punctuation should come.   2. Between author name intials, no punctuation and no space should be left.   3. Some of the names in bib card itself, having name with more than a character initial and in between initials, space and punctuation available. How can I process to get desired university format? For example, `author = {Allwin, A. K. and Maria, P. K. and Ruby, J. L.}` **Here is the minimum working example:`mwe.tex`**               \documentclass[a4paper]{article}     \usepackage[citestyle=authoryear,hyperref=true,     natbib=true,minnames=1,maxnames=2,minbibnames=10,     maxbibnames=11,bibstyle=custom,firstinits=true,backend=bibtex]{biblatex}     \bibliography{literature}     \begin{document}     \nocite{*}     \printbibliography[title=REFERENCES]     \end{document}      **biblatex style file : custom.bbx**               \ProvidesFile{custom.bbx}          \DeclareFieldFormat[article]{title}{~`#1',}     \DeclareFieldFormat[article]{journal}{~#1,}     \DeclareFieldFormat[article]{year}{~#1,}     \DeclareFieldFormat[article]{pages}{~pp. #1.}     \DeclareFieldFormat[article]{volume}{~vol.~#1,}     \DeclareFieldFormat[article]{number}{no.~#1,}          \DeclareNameFormat[article]{author}{%     \ifthenelse{\value{listcount}=1}{     \ifblank{#1}{}{#1\addcomma\space}     \ifblank{#4}{}{#4\addcomma}}{     \ifthenelse{\value{listcount}=\value{liststop}}     {     \ifblank{#1}{}{~\&~#1\addcomma\space}     \ifblank{#4}{}{#4\addcomma}     }     {     \ifblank{#1}{}{#1\addcomma\space}     \ifblank{#4}{}{#4\addcomma}     }     }     }     \DeclareBibliographyDriver{article}{%     \printnames{author}%     \newunit\newblock     \printfield{year}%     \newunit\newblock     \printfield{title}%     \newunit\newblock     \printfield{journal}%     \newunit\newblock     \printfield{volume}%     \newunit\newblock     \printfield{number}%     \newunit\newblock     \printfield{pages}%     \finentry}      **sample bib card file:`literature.bib`**               @article{allwin_drilling_2009,         title = {Drilling of fibers},         volume = {18},         number = {2},         journal = {Journal of Materials},         author = {Allwin, A. K. and Maria, P. K. and Ruby, J. L.},         year = {2007},         pages = {1--7},         },     @article{suraj_solid_2007,         title = {Solid-tool machining},         volume = {10},         shorttitle = {Solid-tool machining handbook},         number = {1},         journal = {International Composite Committee},         author = {Suraj, J. K. and Chandran, M. P.},         year = {2007},         pages = {66--72},        },     @article{jayakumar_mech_2011,       title={Mechanical  behaviors of  polyester composite},       author={Jayakumar, S. G.},       journal={Polymers and Fibers},       volume={15},       number={11},       pages={155--164},       year={2011},      },           @article{waldron2003generalized,       title={Generalized Welch bound equality sequences are tight frames},       author={Waldron, Shayne},       journal={Information Theory, IEEE Transactions on},       volume={49},       number={9},       pages={2307--2309},       year={2003},       publisher={IEEE}     },          @article{conley1998nativity,       title={Nativity and wealth in mid-nineteenth-century cities},       author={Conley, Timothy G and Galenson, David W},       journal={Journal of Economic History},       volume={58},       pages={468--493},       year={1998},       publisher={Cambridge Univ Press}     },          @article{alishahi2009bounds,       title={Bounds on the sum capacity of synchronous binary CDMA channels},       author={Alishahi, Kasra and Marvasti, Farokh and Aref, Vahid and Pad, Pedram},       journal={Information Theory, IEEE Transactions on},       volume={55},       number={8},       pages={3577--3593},       year={2009},       publisher={IEEE}     }


title: how to lower last term in a continued fraction after a diagonal row of dots?

text: How can I lower the last term of a continued fraction when it follows a diagonal row of dots?


title: How can I fix the following problem with subsection alignment in table of contents?

text: I am trying to set the depth of the table of contents. I used               \setcounter{tocdepth}{2}      This actually works fine, almost. The table of contents is showing subsections as well, but these are not pushed _forward_ below the dominating section names. The list of sections _and_ subsections is aligned to the left with the same margin. Is there a way to fix it?


title: Adding appendix "chapters," without sections, in table of contents

text: I have a document with two appendices, and I would like the appendices to appear in the table of contents but without the sections of each appendix appearing. For example, I would like the table of contents to contain something like the following:               Appendices ................ 100       A  First Appendix ....... 101       B  Second Appendix ...... 110          Bibliography .............. 130      I've tried toying with the appendix package, but haven't been able to get the result I'd like. Any help would be most appreciated. Just for comparison, right now my code is               \begin{appendices}         \chapter{First Appendix}         \chapter{Second Appendix}     \end{appendices}      Using `\usepackage[toc,page]{appendix}` the table of contents looks like               Appendices  .............. 100          A  First Appendix ........ 101        A.1  First section .... 101        A.2  Second section ... 102          B  Second Appendix ....... 110        B.1  First section .... 110        B.2  Second section ... 113          Bibliography ............. 120      I apologize if this is a duplicate; I know there are several questions regarding appendices and the table of contents, but I didn't see any that were quite like my question. Here is a complete example:               \documentclass{book}     \usepackage[toc,page]{appendix}          \begin{document}     \tableofcontents          \mainmatter     \chapter{First Chapter}          \begin{appendices}       \chapter{First appendix}       \section{First section}       \section{Second section}            \chapter{Second appendix}       \section{First section}       \section{Second section}     \end{appendices}          \bibliographystyle{amsalpha}     \addtotoc{Bibliography}{\bibliography{bibliography}}          \end{document}


title: Spurious blank space when loading a datatool database

text: I am getting spurious blank spaces inserted upon loading a `dtltool` db. The MWE below produces links to all the image files named with a prefix the same as the .tex file: ![enter image description here](http://i.stack.imgur.com/coO1d.png) But if I comment out the `\DTLloaddb` line (as indicated by the comments in the code), this produces: ![enter image description here](http://i.stack.imgur.com/3bLFJ.png) Note that the indentation increases as the number of files being linked to increases. Even with zero matches (as is the case for the `A.tex` file), there is still an indentation. I suspect that this is related to an earlier problem of mine where I was seeing a Spurious blank space when adding a member to a database within \foreach. I tried to use added an `\unskip` whenever I invoke `\AddMemberToDB`, but that does not help in this case. ## Bonus Question:   * This is not really TeX related, but how do I change the invocation of `ls` such that the error messages such as the following are not displayed in the console.  > ls: B-*.pdf: No such file or directory I had this working with a discussion in the chat room, but started to break in my real use case. ## Code:               \documentclass{article}     \usepackage{datatool}     \usepackage{xparse}     \usepackage{xstring}     \usepackage{tikz}     \usepackage{showframe}     \usepackage{hyperref}          %% -------------------------------------- Create the necessary files     %% Four .tex files:     \begin{filecontents*}{A.tex}     \end{filecontents*}          \begin{filecontents*}{B.tex}     \end{filecontents*}          \begin{filecontents*}{C.tex}     \end{filecontents*}          \begin{filecontents*}{D.tex}     \end{filecontents*}          % No .png file associated with A          % One image file associated with B     \begin{filecontents*}{B-1.png}     \end{filecontents*}          % Two image files associated with C     \begin{filecontents*}{C-1.png}     \end{filecontents*}     \begin{filecontents*}{C-2.jpg}     \end{filecontents*}          % Three image files associated with D     \begin{filecontents*}{D-1.png}     \end{filecontents*}     \begin{filecontents*}{D-2.png}     \end{filecontents*}     \begin{filecontents*}{D-3.jpg}     \end{filecontents*}     %% --------------------------------------                % http://tex.stackexchange.com/questions/51854/dtldeletedb-from-datatool-package-has-no-effect-within-foreach     %     %  Usage: Use \DTLgdeletedb instead of \DTLdeletedb     \makeatletter     \newcommand*{\DTLgdeletedb}[1]{%       \DTLifdbexists{#1}{%         \dtlforeachkey(\@dtl@key,\@dtl@col,\@dtl@type,\@dtl@head)\in{#1}\do         {%           \global\expandafter\let\csname dtl@ci@#1@\@dtl@key\endcsname\undefined         }%         \global\expandafter\let\csname dtldb@#1\endcsname\undefined         \global\expandafter\let\csname dtlkeys@#1\endcsname\undefined         \global\expandafter\let\csname dtlrows@#1\endcsname\undefined         \global\expandafter\let\csname dtlcols@#1\endcsname\undefined       }{%         \PackageError{***** Error: Can't delete database `#1':            database doesn't exist}{}{}%       }%     }     \makeatother                    \newcommand{\AddLinkToFile}[3][black]{%         %#1 = text color         %#2 = file to open upon clicking         %#3 = text to display         %         \href{run:#2}{\protect\textcolor{#1}{#3}}%     }%               \newcommand{\ListAllAssociatedImageFilesOfTypeInCSV}[3][\jobname.ImageDB]{%         % #1 = temp file name         % #2 = dir                 % #3 = file extension         \immediate\write18{%             ls -1 #2#3 %             | grep -v "No such file or directory" %             | sort -f%     %       >&2 % List ALL files             > ./#1% Store in given file name          }%     }%               \newcounter{NumRowElements}     \newcommand*{\NumberOfElementsBeforeLinebreak}{2}     \newcommand*{\ListOfImageFileTypes}{jpg,png,pdf}          \begin{document}         \setcounter{NumRowElements}{0}%         \par\noindent%         \foreach \x in {A,...,D}{%             \DTLifdbexists{ImageDB}{\DTLgdeletedb{ImageDB}}{}%             \ListAllAssociatedImageFilesOfTypeInCSV[\jobname.ImageDB]                     {\x}{-*.{\ListOfImageFileTypes}}%             % If comment out the following \DTLloaddb, the no additional indentation             \DTLloaddb[noheader,keys={FileName}]{ImageDB}{\jobname.ImageDB}%             %------------------------------------------------------------             \makebox[4.0cm][l]{%                 \AddLinkToFile[red]{\x.tex}{\x}%                 \hspace*{1.0ex}%                 \DTLifdbexists{ImageDB}{%                     \DTLifdbempty{ImageDB}{%                         % no associated image files found.                     }{%                         \DTLforeach{ImageDB}{\ImageFile=FileName}{%                             \hspace*{1.0ex}%                             \AddLinkToFile[gray]{\ImageFile}{\ImageFile}%                         }%                     }%                 }{}%             }%             % Add a new line if we are at the appropriate multiple             \stepcounter{NumRowElements}%             \IfEq{\arabic{NumRowElements}}{\NumberOfElementsBeforeLinebreak}{%                 \setcounter{NumRowElements}{0}%                 \par\noindent%             }{}%         }%     \end{document}


title: How to draw the following diagram in Tikz?

text: ![how to draw this picture in tikz](http://i.stack.imgur.com/XAnWO.png) i am getting problem drawing this type of tree using tikz and how to write two line labels for a node in tikz


title: operator name for kernel

text: I'm trying to define `\newcommand{\ker}{\operatorname{ker}}` just after `\begin{document}` in order to have a nice way to write the kernel of an application but the command is ignored and I don't know why since I put `\usepackage{amsmath}`.


title: Weaving MATLAB m-file into a LaTeX File

text: Hopefully this is a simple question: is there a simple, fast, and general method of porting the the text of an m-file verbatim into LaTeX and have it appear as it does in VI, i.e. ignore all of the MATLAB nomenclature, like % and so on, to appear as standard text consistent with whatever package I am using?


title: How do I set a maximum column width?

text: My problem is that I have many tables in my document with the same layout, and I want to specify the maximum width of a specific column to be 5 cm. I tried with p{5cm} but it make the column fix 5 cm wide and it looks odd with only a short word in it. I want it to be as narrow as possible, and split it into two lines, if it's wider than 5 cm. Is there any solution for my problem?


title: Why is the MacTeX distribution so large? Is there anything smaller for OS X?

text: I would like to know how to install LaTeX on Mac 10.6 or higher. But the MacTeX is some 1.28 GB file! Is there a smaller distribution I could install? What exactly is TeX Live?