title: datatool: why does \DTLifstringeq not work in the address part of a bulk letter

text: I'm trying to create a bulk letter using the package dinbrief and datatool. I created the whole letter and except from one problem everything works fine (that's why I don't want to change any major stuff like switching to other packages) The problem is the command \DTLifstringeq of the datatool-package. Within the letter, this command is working fine, but within the address part of the letter it creates an error. I need this command to distinguish the gender and I'm curious why it is not working as expected. Below I have a minimal working example of my code and a exemplary csv-file. If you run it unchanged it produces the bulk letter as expected, however, deleting the comment in line 22 with the \DTLifstringeq-command I get an error. Can somebody explain me why?               \documentclass[10pt]{dinbrief}     \usepackage[T1]{fontenc}     \usepackage[utf8]{inputenc}     \usepackage[ngerman]{babel}     \usepackage{lmodern}     \renewcommand*\familydefault{\sfdefault}     \usepackage[separator=;]{datatool}          \address{briefkopf}     \backaddress{backaddress}     \nowindowrules          \begin{document}          \DTLloadrawdb{addr}{mwe.csv} % open database     \DTLforeach{addr}{%         \sex=sex,%         \firstname=firstname,%         \surname=surname%     }{ % start bulk letter     \begin{letter}{%         %\DTLifstringeq{\sex}{w}{Frau}{Herr}\\%         \firstname\ \surname\\         street No.\\         ZIP city         }     \subject{\textbf{subject}}     \opening{\DTLifstringeq{\sex}{w}%         {Sehr geehrte Frau \firstname\ \surname}%         {Sehr geehrter Herr \firstname\ \surname}%         ,}     text     \closing{Mit freundlichen Grüßen}     \end{letter}     } % close bulk letter     \end{document}      corresponding csv-data:               sex;firstname;surname     m;Thomas;Eddison     w;Anna;Fisher


title: Natbib and website citation

text: I am using the Natbib package and using the apalike style. However, I cannot get the website citation to work as planned. I do know of the option of BibLatex, however, I do not want to use that as I'm relatively new to Latex. I have found suggestions that I use the @Misc entry, but that does not italicize the title of the website, which is what I need. The best example I could find regarding Natbib and website citations was the following:               @Misc{Tho98w,     Author = "Len Thomas",     Title = "Statistical power analysis software",     Note = "http://www.forestry.ubc.ca/conservation/power/",     year = 1998     }      However, there are two problems with this entry. (1) the "Statistical power analysis software" is not in italics and it does not have an "accessed [date]" field, which is required. In summary, I'd like my citation to look like the following (written in Word): Department of Basic Education. (2010). _Education Statistics in South Africa, 2009_. Available: http://www.education.gov.za/emis/emisweb/09Stats/DoE%20Statistics%20in%20South%20Africa%202009.pdf [Accessed 16 April]


title: \thesection (and related) must be fragile?

text: I think the answer to my question lies somewhere in this thread, but I can't quite find it, and it seems to me that I'm asking the reverse of the question first posed in that thread. In any case... I've been trying to redefine `\thesection` (and related `\the...` sectioning commands) to produce alternative ordinals for my sections. If I use `\renewcommand`, things work out just fine. If I try to use `\DeclareRobustCommand` or any of the command declarators in the `xparse` package, I run into problems with the table of contents. So this first question is, do I have to use `\renewcommand` here, because `\thesection` needs to be fragile? That doesn't quite make sense to me, as the ordinal shows up correctly in the document proper. It's just the table of contents that get's a bit messy. The second question would be, if I don't have to use `\renewcommand`, how would I go about using, say, `\RenewDocumentCommand`. Normally, I'd be perfectly happy to just use what works, but I have plans down the future to do some more tricky things with `\thesection` (that is allowing me to parse an ordinal style string, like the one `enumerate` provides for enumerated lists -- something I already have working, and should just be able to plug in.) * * * A MWE to illustrate (have to comment out one of the lines in the preamble):               \documentclass{article}          \DeclareRobustCommand{\thesection}{\Alph{section}}% does not work in toc     \renewcommand{\thesection}{\Alph{section}}% works always          \begin{document}     \tableofcontents     \section{Section One}     \section{Section Two}     \section{Section Red}     \section{Section Blue}     \end{document}


title: Putting an arrow next to table

text: I have a table. Each row in that table represents data at a certain point of time. Lower rows represent data for later times. To illustrate this, I'd like to draw an arrow at the side (which doesn't really matter) of the table, pointing downwards, labelled with something like "time". How would I do this?


title: How to convert a Google docs document to LaTeX?

text: I am working in a team with people who didn't know LaTeX, and while I would have loved to get them into it through shareLaTeX or a similar service, we don't have the time for this. As a result, we are working on Google Docs. But while the WYSIWYG is really helpful for them, I am very frustrated with the limitations of the interface and the tediousness of making it look good¹ and I would like to get it as a LaTeX document, essentially keeping the structure (Keeping paragraphs, turning headings into \sections and so on, maybe even page breaks!) and the basic style (bold, italics…) So: is there a way to convert a Google docs document to a LaTeX file while retaining as much of its structure as possible? * * * 1. And don't get me started on the bibliography. Ugh.


title: Replicate pseudocode format

text: I have to include algorithms in a paper and they must appear as follows:               [A]     X ← X-1             Y ← Y+1             IF X ≠ 0 GOTO A      so I am trying to replicate this exactly, exploring some new packages as well but unfortunately it seems I can't get the hang of it. I'm finding particularly difficult including the `[A]` label before the statement and then the space on the next line. Is there any formatting tip I can follow or any package I can include? **Edit** : For the assignment part I would love to use the math mode, mostly because there are lots of math signs I have to include, as for the appearence it should really be rendered as shown above: the label on the left, if present and if not there should be a nice space and all the statements must be stacked and aligned.


title: TikZ: simple diagram

text: I'm trying to get the hang of TikZ as I need images I try to create them. I found this nice example from TeXample (you can find the code for the diagram there) which looks like nearly what I would like to create. I'm trying to remove some of the nodes but as I'm very new to TikZ I get errors that I don't understand yet. What I'm trying to accomplish is to keep the blue boxes of the transmitter and receiver but have them side by side and the transmitter containing Laser and SOA only and the receiver containing SOA and Rx only. I would like to undestand how I can add those blue dashed boxes and add more nodes so I can create my own diagrams. I have tried to get rid of Polarisation controller node but this gets me as far as having another empty box in place. I'm guessing that the problem is that I'm still drawing the nodes somehow. I would like to know how it actaully works. ![original example](http://i.stack.imgur.com/WI9eH.png)


title: How do you remove a space before a citation in LaTeX?

text: I have something like               \documentclass{article}     \usepackage{cite}     \begin{document}          Blah Blah (\cite{All14})          \bibliography{Ref}     \bibliographystyle{alpha}     \end{document}      But LaTeX keeps placing a space before my citation, i.e. my output looks like "Blah Blah ( [All14])". So, I modified it to `Blah Blah (\hspace*{-3px}\cite{All14})`. However, this seems to be a less than elegant solution. Is there a better way to eliminate this space?


title: Why does \titlepage cause an error when using Warsaw theme?

text: Following a recent update, my beamer document will no longer build. I have traced the problem to the \titlepage line. Here is my minimal working example:               \documentclass{beamer}          \usepackage[T1]{fontenc}          \usepackage{fontspec}          \usepackage[ngerman]{babel}          \usepackage{csquotes}               \usetheme{Warsaw}          \title{Mixeransteuerung mit Leistungselektronik}     \author{Stephen Bosch}     \institute{Johannes-Schlaumeier-Universität Mömbris}     %\date{\today}                    \begin{document}          \begin{frame}         \titlepage     \end{frame}          \end{document}      The error messages are: > (./test_umrichtersteuerung.nav) ! Missing { inserted. - l.25 \end{frame} A > left brace was mandatory here, so I've put one in. You might want to delete > and/or insert some corrections so that I will find a matching right brace > soon. (If you're confused by all this, try typing `I}' now.) > > ! Missing { inserted. - l.25 \end{frame} A left brace was mandatory here, so > I've put one in. You might want to delete and/or insert some corrections so > that I will find a matching right brace soon. (If you're confused by all > this, try typing `I}' now.) > > Overfull \hbox (299.25987pt too wide) detected at line 25 [] [] > > ! Missing } inserted. } l.25 \end{frame} I've inserted something that you > may have forgotten. (See the above.) With luck, this will get me unwedged. > But if you really didn't forget anything, try typing `2' now; then my > insertion and my current dilemma will both disappear. > > ! Missing } inserted. } l.25 \end{frame} I've inserted something that you > may have forgotten. (See the above.) With luck, this will get me unwedged. > But if you really didn't forget anything, try typing `2' now; then my > insertion and my current dilemma will both disappear. > > Package pgf Warning: Your graphic driver pgfsys-xetex.def does not support > fadi ngs. This warning is given only once on input line 25. (I wanted to attach my log file, but couldn't find a way to do it. Suggestions are welcome.) So far, I have tested with \usetheme{Warsaw} and with the default (no \usetheme statement). If I use the default, it builds fine. I am using beamer 3.18, because that is what tlmgr installed after a recent update. That's when my problems started. I can see that the current version of beamer is 3.20, but it does not appear as though that version is available to my texlive 2011, which has been frozen in preparation for the new release. I tried manually installing it to texmf-local using the instructions I found here, but even after running mktexlsr, latex is still using 3.18. Here are my options, as I see things:   * find a workaround to the bug with Warsaw   * revert to the previous version of beamer (which was working) using tlmgr restore beamer    * install beamer 3.20 over the version currently in my texlive tree (I'm reluctant to try this on my own because I am afraid of breaking something)   * find a way to get texlive to use my local version over the one in the distribution Any ideas?


title: How to modify imported pdf graphics?

text: Is it possible to modify the thickness of lines in an imported pdf image using latex? P.S. I have plots (vector graphics) in pdf format. I import them in latex and zoom into sum parts using `tikz` with `spy` library. I don't want the lines to become thicker in the magnified plot to be able to see more details. I decided to use a modified version of the plot with thin lines to zoom-in. However, I can't find a way to change the thickness of lines.


title: Title formatting with graphics

text: I am trying to achieve this look for my chapter titles: ![Desired look](http://i.stack.imgur.com/lDC8e.png) To achieve this formatting I use **titlesec** package like this :               \titleformat{name=\chapter}[hang]             {\LARGE\sffamily\raggedright}{\includegraphics[height=5em]{chapter.png}      \large{\chaptertitlename\ \thechapter}}{0em}{\textbf{\textit{#1}}}          \titlespacing*{\chapter}{0pt}{0.5em}{2em}      and so far it looks like this : ![My current look](http://i.stack.imgur.com/YnO1I.png) Could you please help me how to achieve this ? I tried to experiment with multicols but it didn't work. Thank you very much for your help.


title: Any software-tool off-line to create LaTeX text as a graph?

text: I like to make math graphs, with Mathematica, with Adobe Fireworks, with Hypersnap etc. However I have a problem, because I would like to have a plugin to Adobe Fireworks or HyperSnap, to enter LaTeX code, like I enter normal text _ABC...abc..._. Is it possible? I know about an on-line equation editor Sciweavers but it´s a little slow, and I prefer off-line tools. Instead I'm looking for something like LaTeX en Inkscape con TeXText but I prefer Adobe Fireworks & Hypersnap to InkScape. The other feasible way for me is to code LaTeX in WinEdt and obtain a graph with transparent background. Is it also possible?


title: Page numbering and binding offset

text: I have a two-sided document with a few unnumbered introductory pages, and I want to start page numbering from 1 after these pages. To do that, I suppress page numbers with `\pagenumbering{gobble}`, and later start it with `\pagenumbering{arabic}`. However, this method screws up page numbering for things like `fancyhdr` and `geometry`'s `bindingoffset`. As to the headers, I can easily circumvent that by swapping around the headers for odd/even pages, but I see no way of making `bindingoffset` work with it. Is there a way to make `bindingoffset` use global page numbers for the whole document instead of the counter that LaTeX uses for `\pagenumbering`? If not, is there a better way to suppress and later start page numbering without messing up `bindingoffset`? Thank you. Minimal working example:               \documentclass{article}          \usepackage[twoside, bindingoffset=5mm]{geometry}     \usepackage{lipsum}          \begin{document}     \pagenumbering{gobble}     \lipsum[1-4]     \clearpage     \pagenumbering{arabic}     \lipsum[1-4]          \end{document}      I would like the second page (page number 1) to be correctly treated as a left page.


title: Lstinputlisting and listings styles

text: To further extend my recent question about new listings environments, found here: Multiple listings styles. How do I define a new `lstlistings` environment, via the command `\lstnewenvironment`, and, be able to use the command `\lstinputlisting` to draw the desired contents from file? I am referring to newly created `lstlistingenvironments` via the command `\lstnewenvironment{MYENV}`. These are then accessed by               \begin{MYENV}      BODY      \end{MYENV}       Anything where `BODY` is, gets formatted, including the command \input{mycode.whatever}, instead of pulling the contents of the file `mycode.whatever` and formatting the contents.


title: \@ne \tw@ \thr@@

text: The LaTeX (2e) source code is quiet hard to read. There are a lot of macros with `@` symbol. I understand those are "latex macros". There is, in particular, a series of macros called `\@ne`, `\tw@`, `\thr@@` (and maybe more). Their `\meaning` is `\char"1`, `\char"2`, `\char"3`. I wonder (1.) how and where those are defined? Further interests: They seem to be used mainly to identify internal registers. "The Texbook" mentions that there are 256 internal registers of each type, e.g. `\box0` ... `\box256`. So which register does `\box\@ne` denote? After reading Martin's answer I reached to the texbook, page 121: > Besides `\newcount`, plain TEX provides `\newdimen`, `\newskip`, > `\newmuskip`, and `\newbox`; there also are `\newtoks`, `\newread`, > `\newwrite`, `\newfam`, and `\newinsert`, for features we haven’t discussed > yet. Appendices B and E contain several examples of the proper use of > allocation. In the cases of `\newbox`, `\newread`, etc., the allocated > number is deﬁned by `\chardef`. For example, if the command > "`\newbox\abstract`" is used to deﬁne a box register that will contain an > abstract, and if the `\newbox` operation decides to allocate `\box45` for > this purpose, then it deﬁnes the meaning of `\abstract` by saying > "`\chardef\abstract=45`". TEX allows `\chardef`’d quantities to be used as > integers, so that you can say `\box\abstract` and `\copy\abstract`, etc. > (There is no `\boxdef` command.) ... so `\box\@ne` is equal to `\box1` ?


title: What formats do the file extensions in the TeX Live source tree denote

text: The TeX Live source tree is really huge. Is there an overview somehow somewhere of the meaning of all those file extensions? I mean e.g. in texlive/Master/texmf, there are 10 .sty, 18 .enc, 21 .tcx, 22 .map, 23 .tlu, 35 .cfg, 366 .asy and 425 .xdy files. I have no clue what kind of files these are. All in all there are almost 1000 (!) different file extensions :-O http://sprunge.us/KDJh 1) What do they all mean? Clarification: What list is 1) ?               texlive/Master$  # a command is run in the TeX Live tree's root directory     find ...         # finds all files in this directory, omits the bin directory...      | sed .         # filters out everything except the filenames extensions      | sort          # sorts the list lexically      | uniq -c       # counts the number of duplicates of each line      | sort -nr      # sorts the resulting "list of counts" numerically reverse      -> The result is a list of file extensions ordered by their frequencies


title: How to center column values in a table?

text: How can I center the column values in this code?               \documentclass[conference]{IEEEtran}     \begin{document}     \begin{table}       \centering       \begin{tabular}{|p{2.5cm}|p{2.5cm}|p{2.5cm}|}         \hline         Reconstruction strategy & aa          & bb( \%) \\ \hline         Classic                 & 3342 voxels & 68 \%   \\ \hline         VC                      & 4296 voxels & 87 \%   \\ \hline         V m=7                   & 4745 voxels & 96 \%   \\ \hline       \end{tabular}       \newline\newline        \caption{title}\label{tab1}     \end{table}     \end{document}


title: Adjust font size local table of contents

text: My minimum working example:               \documentclass{article}     \usepackage{appendix}     \usepackage{etoc}          \begin{document}          \section{My First Section}     \section{My Second Section}          \begin{appendices}     \section{My First Appendix}     \localtableofcontents     \subsection{My First Subsection}     \subsection{My Second Subsection}          \section{My Second Appendix}     \localtableofcontents     \subsection{My First Subsection}     \subsection{My Second Subsection}     \end{appendices}          \end{document}      The result: ![enter image description here](http://i.stack.imgur.com/ulFVW.png) Now I like to adjust the font size of the "Contents" header.


title: One path or several paths for a tikzpicture?

text: Perhaps the title of my question is not fine (let me know). I try to finish a document about the best practices when programming with TikZ. I remark in several answers that a lot of users like to use long path where nodes are created, edges are drawn (with `edge`- etc. The four next pictures shows the result that I want, then some mistakes with bad practices. If a rule could be given, what would it be? If you know of other ways to get the same kind of results, you can let me know. Good results ![enter image description here](http://i.stack.imgur.com/3AFca.png) If we look at the pgfmanual, specially the tutorial, a lot of codes look likes 1 but sometimes T. Tantau uses 3 Bad results ![enter image description here](http://i.stack.imgur.com/cUZdU.png) Code for the first example :               \documentclass[11pt]{scrartcl}        \usepackage{tikz,tkzexample,fullpage} % tkzexample from TL2011     \usetikzlibrary{arrows}          \colorlet{graphicbackground}{blue!10}     \colorlet{codebackground}{red!10}          \begin{document}     \parindent=0pt     \thispagestyle{empty}          \begin{enumerate}     \item       \begin{tkzexample}[width=3cm]     \begin{tikzpicture} [every node/.style={blue,draw,circle}]     \node(a){a};     \node(b) at (2,1){b} ;      \draw[red,->] (a)  to[out=90,in=180] (b);     \end{tikzpicture}      \end{tkzexample}        \end{document}


title: xelatex and pstricks

text: I am using miktex 2.9 with texworks & windows 7 ultimate SP1 to compile my code. I am compiling using xelatex however, my code is not compiling. What should I do ? Here is my code:               \documentclass{article}      \usepackage{pstricks}     \begin{document}         \begin{pspicture}(-0.5,0)(2.5,1)     \psdots(0,0)(2,0)(1,1)     \end{pspicture}     \end{document}


title: hyperlinks problem with dvipdfm compiler

text: I'm want to use hyperlinks in my PDF, but they don't work. MWE:               \documentclass[a4paper,14pt]{extarticle}          \usepackage{hyperref}          \begin{document}          \href{http://google.ru}{Google}          \end{document}      I'm using `dvipdfm` to compile my file.


title: Placing \section, \subsection in the right margin of an RTL document

text: Rather than the default placing of `\section` and `\subsection` on their own line, I'd like to place them on the right margin (in a Right To Left document). My current usage looks like this:               \documentclass{article}          \usepackage{polyglossia}     \setdefaultlanguage[calendar=hebrew, numerals=arabic]{hebrew}     \setotherlanguage{english}     \newfontfamily\hebrewfont{David CLM}          \begin{document}     \section{}       \subsection*{א}         אבג       \subsection*{ב}         דהו     \end{document}      Which gives: ![enter image description here](http://i.stack.imgur.com/voi4F.png) Instead, I want to achieve this: ![enter image description here](http://i.stack.imgur.com/OfyHG.png) It is not exactly clear in the image but the bold text should be on the right margin. Ideally I would like each `\subsection` to also include the current `\section` when it's printed, but if there is a `\section` without any `\subsection`s, then only the `\section` should be displayed.


title: how to change the pagenumbering position in scrbook?

text: I am writing a document in lyx using scrbook I want to change the numbers in every page from bottom to top With the folowing code in the preamble I get it,but I think the default position remains so now I have two page numbers in every page               \usepackage{scrpage2}     \pagestyle{scrheadings}     \addtokomafont{pagenumber}{\oldstylenums}     \rehead[\pagemark]{\pagemark}     \lohead[\pagemark]{\pagemark}      I am not sure I understand this Can anybody help please Thanks in advance


title: minted chokes on umlauts

text: I would like to use `ü` in the caption of my listings. It works with the `lstinputlisting` command, but not with `inputminted`:               \documentclass[11pt]{report}     \usepackage{geometry}     \geometry{a4paper, left=2cm, right=2cm, top=2cm, bottom=2cm}     \usepackage[utf8]{inputenc}     \usepackage{setspace}     \usepackage[ngerman]{babel}     \usepackage{color}     \usepackage{minted}          \newcommand{\code}[4][text]{         \inputminted[label=#3, frame=lines, framesep=2mm]{#1}{#2}     }          \begin{document}          \code[make]{makefile}{Gemeinheiten für Listing \ref{code:auto-einfach}}{code:gemeinheiten}          \end{document}      Makefile:               Bericht.pdf: Bericht.tex         pdflatex -shell-escape $<      This is the error when I use `pdflatex` on that.               *** Error while highlighting:     UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 23: ordinal not in range(128)        (file "/usr/lib/python2.7/codecs.py", line 351, in write)      (./Bericht.out.pyg)     Runaway argument?     commandchars=\\\{\}      ! File ended while scanning use of \FV@GetKeyValues.     <inserted text>                      \par      l.16 ...ref{code:auto-einfach}}{code:gemeinheiten}      The error disappears when I remove the `ü`. How can I get this to work with umlauts?


title: How can I distribute a sorting scheme

text: I have made a personal sorting scheme for my final bibliography. It's like the `nty` scheme but anonymous work before the non-anonymous work. As it's a usual need in my field (classical philology) I would like to publish it. But, as I know, there is no way in `biblatex` to publish a sorting scheme in a file, as there is for example .cbx or .bbx file. Of course, I could distribute it as a .sty file, but that would imply that users should:   * load the package for sorting   * load the `biblatex` package with the sorting option. It will be a two step and not intuitive method. Does anybody have you any other idea ?


title: Cross-referencing between tex-files

text: I have a main TeX-file named `Thesis.tex` that contains this:               \documentclass[11pt, a4paper, oneside]{Thesis}     \begin{document}     \input{./Chapters/MethodologyAndResearchStrategy}     \input{./Chapters/CreationOfTheNovelDesignPrinciples}     \end{document}      Within the file named `MethodologyAndResearchStrategy.tex` - I have a section that looks like this:               \section{Quantitative Data Analysis}     \label{sec:QuanDat}     Quantitative data means data, or evidence, based on numbers.      Then I have a reference to it that looks like this within a file named `CreationOfTheNovelDesignPrinciples.tex`:               As mentioned in (Section~\ref{sec:QuanDat})      This then produces "Section ??", which means that it is not finding the label that I have made. I have already tried adding               \usepackage{xr}     \externaldocument{MethodologyAndResearchStrategy}      in the chapter that I want the reference in, but to no avail. I get an error saying that one can only use such code in the preamble. Putting it there in the main `Thesis.tex` did not yield any results either for that matter. This is my first post, so if you need any other data to be able to assist, just let me know! **EDIT:** So I finally found the problem, and it had nothing to do with TeX at all. I had been editing the wrong version of `CreationOfTheNovelDesignPrinciples.tex` which was uploaded to Dropbox with an older version of the paper.


title: Table of contents without title

text: I would like to have two-columned table of contents:                   \begin{multicols}{2}               \tableofcontents         \end{multicols}      But it looks wierd if I have a title included in two columns - second column is above the title. So I would like to have something like that:                   \section*{My content}         \begin{multicols}{2}               % table of contents without title               \tableofcontents         \end{multicols}      Is there any way to do this?


title: Specifying multiple hyphenation exception lists for multi-lingual documents

text: > **This question led to a new feature in a package:**   >  `babel` By default, (La)TeX fails at hyphenating some words, e.g., the English word `potable` (should be `pot-able`) or the German word `Mor-dop-fer` ( _murder victim_ , should be `Mord-op-fer`). There are two strategies to achieve correct hyphenation:   * adding a "hyphenation exception" list for the document's main language in the preamble with `\hyphenation{pot-able}`;   * using `pot\\-able` at every instance in the document body. (This is also the only resort for words that already contain hyphens.) But what to do in case of multi-lingual documents? As `\hyphenation` only works for the main document language, must one fall back to manual hyphenation correction in the document body for other languages? Or is it possible to specify separate hyphenation exception lists for the respective languages?               \documentclass[draft]{article}          \usepackage[ngerman,english]{babel}          \begin{document}          The language is \languagename\ (correct hyphenation is \verb|pot-able|):          XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX X potable          \selectlanguage{ngerman}          The language is \languagename\ (correct hyphenation is \verb|Mord-op-fer|):          XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX Mordopfer          \end{document}      ![enter image description here](http://i.stack.imgur.com/bqQdM.jpg)


title: How to replace \\ with \\& in math mode?

text: I am having the following isssue: I have to write a mathematical paper/book with many different optimization problems formulated. To be consistent all over I'd like to create an environment to typeset these opt problems. I'll give you a minimal running example:               \documentclass[a4paper,10pt]{scrartcl}     \usepackage{amsmath,amsfonts,amssymb}     \usepackage{environ}     \begin{document}          \NewEnviron{OptEnv}[1]{%     \begin{align}     \text{min. } & #1 \\     \text{s.t. } & \BODY     \end{align}     }          \begin{OptEnv}{a}     a \leq 1 \\     & b \leq a \\     & 3 \leq b     \end{OptEnv}          \end{document}      My question now: Is there an easy way to omit the `&` in the environemnt and append in the definition of the environment on each `\\\`? Thanks


title: scrbook page numbers margin problem

text: I was looking for the setting to adjust the vertical margin of the page numbers in the `scrbook` class but haven't found anything. I want to have them "nearer" to the page margin.               \documentclass[oneside,ngerman]{scrbook}     \begin{document}     Some text     \end{document}


title: \stackrel with \sim symbol

text: I am using `\stackrel{<}{\sim}` to stack up two symbols. However I need to lower `\sim`, which naturally goes above the line, otherwise `<`raises too. This is the output at the moment: ![example of my output](http://i.stack.imgur.com/gq2xC.jpg) Any idea?


title: Preventing page break in \documentclass[twocolumn]{article} after \author{}

text: A page break appeared between `\author{}` and `\date{}` after I added the `\twocolumn[]` section. The `\twocolumn[]` section was added to achieve a single column abstract in the `twocolumn` document. How can I remove the page break or rewrite the single column abstract so that it doesn't cause a page break.               \title{TITLE}     \author{NAMES     }          \nopagebreak          \date{}          \begin{document}     \maketitle          \twocolumn[       \begin{@twocolumnfalse}         \maketitle         \begin{abstract}           ABSTRACT CONTENT...         \end{abstract}       \end{@twocolumnfalse}     ]


title: Error applying Chapter Style in Memoir Class

text: I use memoir class, I get an error message `file ended when scanning \makechapterstye` This is what I want. I get the code from "Variation over VZ39, contributed by Danie Els, Various chapter styles for the memoir class" by LarsMadsen ![](http://i.stack.imgur.com/EYq5R.jpg) Can anyone help me please? This is the code :               \documentclass{memoir}     \usepackage{fourier} % or what ever     \usepackage[scaled=.92]{helvet}%. Sans serif Helvetica     \usepackage{color,calc}     \newsavebox{\ChpNumBox}     \definecolor{ChapBlue}{rgb}{0.00,0.65,0.65}     \makeatletter     \newcommand*{\thickhrulefill}{%     \leavevmode\leaders\hrule height 1\p@ \hfill \kern \z@}     \newcommand*\BuildChpNum[2]{%     \begin{tabular}[t]{@{}c@{}}     \makebox[0pt][c]{#1\strut} \\[.5ex]     \colorbox{ChapBlue}{%     \rule[10em]{0pt}{0pt}%     \rule{1ex}{0pt}\color{black}#2\strut     \rule{1ex}{0pt}}%     \end{tabular}}     \makechapterstyle{BlueBox}{%     \renewcommand{\chapnamefont}{\large\scshape}     \renewcommand{\chapnumfont}{\Huge\bfseries}     \renewcommand{\chaptitlefont}{\raggedright\Huge\bfseries}     \setlength{\beforechapskip}{20pt}     \setlength{\midchapskip}{26pt}     \setlength{\afterchapskip}{40pt}     \renewcommand{\printchaptername}{}     \renewcommand{\chapternamenum}{}     \renewcommand{\printchapternum}{%     \sbox{\ChpNumBox}{%     \BuildChpNum{\chapnamefont\@chapapp}%     {\chapnumfont\thechapter}}}     \renewcommand{\printchapternonum}{%     \sbox{\ChpNumBox}{%     \BuildChpNum{\chapnamefont\vphantom{\@chapapp}}%     {\chapnumfont\hphantom{\thechapter}}}}     \renewcommand{\afterchapternum}{}     \renewcommand{\printchaptertitle}[1]{%     \usebox{\ChpNumBox}\hfill     \parbox[t]{\hsize\width\ChpNumBox{1em}{%     \vspace{\midchapskip}%     \thickhrulefill\par     \chaptitlefont ##1\par}}%     }     \chapterstyle{BlueBox}     \begin{document}     \chapter{Introduction}     \end{document}      Error message : File ended while scanning use of \makechapterstyle.


title: Biblatex: Date-Fields B.C.

text: If I wanted to quote a book written 45 B.C. - how would I have to enter the year in fields like `origyear` or `year` to cite (and list it in the bibliography) accordingly? Using the `authoryear`-style …


title: Title of the papers are not shown in the reference list

text: I am using a latex template (class) to write my thesis but I get a weird output for the references at the end of the thesis. For instance, if I use something like this in the bib file:               @article{hh1952,       title={A quantitative description of membrane current and its application to conduction and excitation in nerve},       author={Hodgkin, A.L. and Huxley, A.F.},       journal={The Journal of Physiology},       year={1952}     }      I get the following output: ![reference](http://i.stack.imgur.com/RV3RI.png) Simply, the title of the papers is not shown but book titles are just fine. This is all what I found in the template file about bibliography:               % Redefine \thebibliography to go to a new page and put an entry in the     % table of contents     \let\@ldthebibliography\thebibliography     \renewcommand{\thebibliography}[1]{%         \newpage         \addcontentsline{toc}{chapter}{Bibliography}         \@ldthebibliography{#1}     }          %\let\@ldbibliography\bibliography     %\renewcommand{\bibliography}[1]{\ifprint@bib\@ldbibliography{#1}\fi}      I wonder if it is just a matter of style or it is a bug of the class that I am using? How can I fix the problem? _Update:_ The `.bbl` file contains the title:               \bibitem{hh1952}     A.L. Hodgkin and A.F. Huxley.     \newblock A quantitative description of membrane current and its application to       conduction and excitation in nerve.     \newblock {\em The Journal of Physiology}, 1952.


title: Classicthesis in Chinese?

text: I wish to compile my dissertation in the beautiful `classicthesis`. My setting: Mac OX 10.6.8, TeX Live 2012 + LyX 2.0.5. I am able to work and produce document in Chinese elsewhere including in `book`, `memoir`, but just not in `classicthesis`. After several attempts, including copying following solution... http://www.latex-community.org/forum/viewtopic.php?f=40&t=11098 Maybe the problem is on `babel` that doesn't accommodate Chinese? I wonder if anyone can provide a direction for solving this issue.


title: Pseudocode overflow out of column

text: I am writing pseudocode using the `algorithmicx` package in `IEEEtran` class (double column). My problem is, some of the statement in the code are quite long which I expected to wrap to next line. However, the lines are overflowing out of the margin, something like:               \documentclass[10pt,conference,letterpaper]{IEEEtran}     \usepackage{algorithm}     \usepackage{algorithmicx}     \usepackage{algpseudocode}     \begin{document}     \begin{algorithm}     \caption{Network similarity}     \begin{algorithmic}[2]     \Require{$G\_ref, G\_tar,ref\_community, tar\_community$}     \ForAll{$ref\_node \in G\_ref $}     \ForAll{$tar\_node \in G\_tar$}     \State{ $pair\_sim\_table[ref\_node,tar\_node] \gets Calculate\_similarity(ref\_feature\_vec[ref\_node],tar\_feature\_vec[tar\_node])$}     \EndFor     \EndFor \\     \Return pair\_sim\_table, cluster\_sim     \end{algorithmic}     \end{algorithm}     \end{document}      Since the code associated with the `\State` command is quite long, it overflows out of the margin, instead of wrapping around. Excuse me if this is a trivial question. Any help would be appreciated ! ![algo](http://i.stack.imgur.com/xYsPP.png)


title: customize tabular

text: i want to customize my table using the **tabular** environments, i write :               \begin{tabular}{|l|c|r|}      \hline      colonne 1 & colonne 2 & colonne 3 \\      \hline      1.1 & 1.2 & 1.3 \\      \hline      2.1 & 2.2 & 2.3 \\      \hline     \end{tabular}       i want to delete some line , something like the picture below ![enter image description here](http://i.stack.imgur.com/h5saI.png)


title: Cylinder using only tikz

text: I have just about what I want.               \documentclass[a4paper,12pt]{report}     \usepackage{tikz}               \begin{document}          \begin{tikzpicture}[x=3cm,y=3cm,font=\footnotesize]     \fill[blue!20] plot[domain=0:1,samples=200] (\x,{sqrt(\x)})--(1,0)--(0,0);     \draw[->] (-0.25,0)--(1.25,0) node[right]{$x$};     \draw[->] (0,-0.25)--(0,1.25) node[above]{$y$};     \draw[->] plot [domain=0:1.25,samples=200] (\x,{sqrt(\x)}) node[above right]{$f(x)=\sqrt{x}$};;     \draw (0,0) node[below left]{$0$};     \draw (1,3pt)--(1,-3pt) node[below]{$1$};     \draw[red,dashed] (0.5,0)--(0.5,0.71);     \draw (0.5,3pt)--(0.5,-3pt) node[below]{$x$};     \end{tikzpicture}          \begin{tikzpicture}[x=3cm,y=3cm,font=\footnotesize]     \fill[blue!20] plot[domain=0:1,samples=200] (\x,{sqrt(\x)})--(1,0)--(0,0);     \draw[->] (-0.25,0)--(1.25,0) node[right]{$x$};     \draw[->] (0,-0.25)--(0,1.25) node[above]{$y$};     \draw[->] plot [domain=0:1.25,samples=200] (\x,{sqrt(\x)}) node[above right]{$f(x)=\sqrt{x}$};;     \draw (0,0) node[below left]{$0$};     \draw (1,3pt)--(1,-3pt) node[below]{$1$};     \filldraw[color=black,fill=red!40] (.45,0) rectangle (.55,.71);     \draw[fill=black] (.5,0) node[below]{$(x,0)$} circle (1pt);     \draw[fill=black] (.5,.71) node[above]{$(x,\sqrt{x})$} circle (1pt);     \end{tikzpicture}          \begin{tikzpicture}[x=3cm,y=3cm,font=\footnotesize]     \fill[blue!20] plot[domain=0:1,samples=200] (\x,{sqrt(\x)})--(1,0)--(0,0);     \fill[blue!20] plot[domain=0:1,samples=200] (\x,{-sqrt(\x)})--(1,0)--(0,0);     \draw[fill=gray!50] (1,0) circle [x radius=.1,y radius=1];     \draw[fill=red!40] (.45,0) circle [x radius=.1,y radius=.71];     \draw[fill=red!40] (.55,0) circle [x radius=.1,y radius=.71];     \draw[->] (-0.25,0)--(1.25,0) node[right]{$x$};     \draw[->] (0,-1.25)--(0,1.25) node[above]{$y$};     \draw[->] plot [domain=0:1.25,samples=200] (\x,{sqrt(\x)}) node[above right]{$f(x)=\sqrt{x}$};;     \draw[->] plot [domain=0:1.25,samples=200] (\x,{-sqrt(\x)}) ;     \draw (0,0) node[below left]{$0$};     \draw (1,3pt)--(1,-3pt) node[below]{$1$};     \end{tikzpicture}               \end{document}      Which gives me these images. ![enter image description here](http://i.stack.imgur.com/eIS2u.png) The third image is where I need help. The two red ellipses need to be combined to create a cylinder when the rectangle in the second figure is revolved about the x-axis. Any thoughts or suggestions? P.S. I'd like to do this strictly in tikz, pgf, not another pgf package. Thanks. P.S. Looks like I have a technique that works, changing the third picture to:               \begin{tikzpicture}[x=3cm,y=3cm,font=\footnotesize]     \fill[blue!20] plot[domain=0:1,samples=200] (\x,{sqrt(\x)})--(1,0)--(0,0);     \fill[blue!20] plot[domain=0:1,samples=200] (\x,{-sqrt(\x)})--(1,0)--(0,0);     \draw[fill=gray!50] (1,0) circle [x radius=.1,y radius=1];     \draw[fill=red!40] (.45,0) circle [x radius=.1,y radius=.71];     \fill[red!40] (.45,-.71) rectangle (.55,.71);     \draw[fill=red!40] (.55,0) circle [x radius=.1,y radius=.71];     \draw (.45,.71)--(.55,.71);     \draw (.45,-.71)--(.55,-.71);     \draw[->] (-0.25,0)--(1.25,0) node[right]{$x$};     \draw[->] (0,-1.25)--(0,1.25) node[above]{$y$};     \draw[->] plot [domain=0:1.25,samples=200] (\x,{sqrt(\x)}) node[above right]{$f(x)=\sqrt{x}$};;     \draw[->] plot [domain=0:1.25,samples=200] (\x,{-sqrt(\x)}) ;     \draw (0,0) node[below left]{$0$};     \draw (1,3pt)--(1,-3pt) node[below]{$1$};     \end{tikzpicture}      Here is the resulting picture. ![enter image description here](http://i.stack.imgur.com/jUdyg.png)


title: Display short title and long title (both) in a caption?

text: The syntax for a caption is               \caption[listoffigures/tables text]{Text actually displayed under picture/table}      But what I would like to have is something like this: If I use the above command, the text under the floating object should be               Label #.: listof text -- long text      With `#` being just the number and with `\--` being an arbitrary separator (either the `\--` dash itself or maybe even a `\newline`). Is this possible? I'm using KOMAScript.


title: I need to reduce the fontsize of only one equation/formula because it's too long

text: \begin{equation}     \left| Y(j \omega) \right| = \sqrt{\frac{\omega^2 \left( C\ped{DC} + C\ped{eq} \right)^2 + \omega^4 \left[ \left( R\ped{eq} C\ped{eq} C\ped{DC} \right)^2 - 2 \left(  C\ped{DC} + C\ped{eq} \right) \left( L\ped{eq} C\ped{eq} C\ped{DC} \right) \right] + \omega^6 \left( L\ped{eq} C\ped{eq} C\ped{DC} \right)^2}{1 + \omega^2 \left[ \left( R\ped{eq} C\ped{eq} \right)^2 - 2 L\ped{eq} C\ped{eq} \right] + \omega^4 \left( L\ped{eq} C\ped{eq} \right)^2}}.     \label{eq:cmut:abs_y_w_eq}     \end{equation}      Hi. This is an equation I have to write. It's too long. (I cannot show you the results because I don't have enough reputation points to post images). How can I reduce the fontsize of the equation (without reducing the fontsize of the number of the reference)? Any suggestion to solve this problem? Thank you.


title: Package tgpagella and text figures

text: Is there a way that text figures (old style numerals) can be set as default for text when loading the package `tgpagella`? I get them if I use the .otf files under `XeLaTeX`, but I'd like to get them when running `pdfLaTeX`.


title: Animate movement/transition of sections on a slide in Beamer?

text: I'm not sure if this is even possible with the current PDF format specification, but I'd like to animate transitions between slide or between slide overlays by having part of the slide move or "fly" to a new spot. For instance,               \documentclass{beamer}     \usepackage{tikz}     \begin{document}          \begin{frame}       \only<1-2>{some text before}       \begin{tikzpicture}         \draw<1> (0,0) node [fill=blue!20] (a) {hello} -- (1, 1) node [fill=red!20] (b) {world};         \draw<2-> (0,0) node [fill=blue!20] (a) {hello} -- (0, 1) node [fill=red!20] (b) {world};         \draw<1-> (2,2) node [fill=violet!20] (c) {this stays put};       \end{tikzpicture}       \only<3->{some text after}     \end{frame}     \end{document}      Ideally, there would be some way to animate between overlays 1 and 2 so that the audience gets a sense of continuity (for those familiar with the iOS developer library, or anyone who has ever studied user interface design on iOS, this concept will be familiar). Even better, when the text "some text before" goes away (overlays 3 and beyond), the whole tikz figure would slide left into it's new place. Is this even possible with the current PDF standard (or anything else that TeX/LaTeX/*TeX can output)? Is there a package anywhere that implements this behavior? It sounds pretty extreme for a simple TeX/LaTeX/*TeX file, but I've learned to put nothing past `tikz`/`pgf` and `beamer`.


title: Crop image bigger than page from top left to bottom right

text: I have a small problem when including an image bigger than an A4 page. Normally, I would use this code, but with this I am able to crop it using the bounding box, from 0, 0 to 500,700:               %%image start     \begin{figure}[h!]           \caption{\url{http://www.url.com/.htm}       \newline       Text       \newline     }       \centering        % cropped at 500 x 700         \includegraphics[bb= 0 0 500 700 ,clip]{images/001.png}     \end{figure}     %%image end      The thing is that my image is bigger than the page (but every image has a different size), so I'd like to crop it from the upper left to the bottom right, cutting the lower part, let's say having an image tall 700. Is it possible to do that using the bounding box or some other thing?


title: How to draw frame around side captioned figure

text: I want to draw frame around a side captioned figure. I have created side captioned figure using `sidecap` package and using `\begin{SCfigure} \end{SCfigure}` environment. I have tried `mdframed` package but it is not working. I have also tried `\fbox{}` but frame is coming around graphicx only not around caption. I have googled a lot but could not find out a suitable answer.   The following example works               \documentclass{report}     \usepackage[demo]{graphicx}     \usepackage{sidecap}     \usepackage{mdframed}     \begin{document}     \begin{figure}     \begin{mdframed}     \centering     \includegraphics{image}     \caption{A figure and its caption framed}     \label{fig:test}     \end{mdframed}     \end{figure}     \begin{SCfigure}     \includegraphics{image}     \caption{A figure and its caption framed}     \label{fig:test}     \end{SCfigure}          \end{document}      But following example doe snot works               \documentclass{report}     \usepackage[demo]{graphicx}     \usepackage{sidecap}     \usepackage{mdframed}     \begin{document}     \begin{figure}     \begin{mdframed}     \centering     \includegraphics{image}     \caption{A figure and its caption framed}     \label{fig:test}     \end{mdframed}     \end{figure}     \begin{SCfigure}     \begin{mdframed}     \includegraphics{image}     \caption{A figure and its caption framed}     \label{fig:test}     \end{mdframed}     \end{SCfigure}          \end{document}      Giving the following error `Something's wrong--perhaps a missing \item. \includegraphics`


title: problem with moderncv and \bf inside bibliography

text: I've this problem using `moderncv`. I'm using multibib and the first bibliography entry is:               @article{Aad:2011tw,       author         = "Aad, Georges and others",       title          = "{Measurement of the inclusive isolated prompt photon cross-section in pp collisions at sqrt(s)= 7 TeV using 35 pb-1 of ATLAS data}",       collaboration  = "ATLAS Collaboration",       journal        = "Phys.Lett.",       volume         = "B706",       pages          = "150-167",       doi            = "10.1016/j.physletb.2011.11.010",       year           = "2011",       eprint         = "1108.0253",       archivePrefix  = "arXiv",       primaryClass   = "hep-ex",       reportNumber   = "CERN-PH-EP-2011-115",       SLACcitation   = "%%CITATION = ARXIV:1108.0253;%%",     }      and it is translated by bibtex to:               \bibitem{Aad:2011tw}     {ATLAS Collaboration} Collaboration, G.~Aad et al., {\em {Measurement of the       inclusive isolated prompt photon cross-section in pp collisions at sqrt(s)= 7       TeV using 35 pb-1 of ATLAS data}\/},       \href{http://dx.doi.org/10.1016/j.physletb.2011.11.010}{Phys.Lett. {\bf B706}       (2011)  150--167},     \href{http://arxiv.org/abs/1108.0253}{{\tt arXiv:1108.0253 [hep-ex]}}.     %%CITATION = ARXIV:1108.0253;%%.      When I run `pdflatex` I get:               [4]) (./pub.bbl     ! Undefined control sequence.     <argument> \Hy@safe@activesfalse Phys.Lett. {\bf                                                       B706} (2011) 150--167     l.8   (2011)  150--167}                            ,      what's the problem? I used the same `.bib` file without `moderncv` and I haven't such problems. My preample looks like this:               \documentclass[11pt,a4paper,sans]{moderncv}          \moderncvstyle{classic}     \moderncvcolor{blue}          \renewcommand*\bibliographyitemlabel{\arabic{enumiv}.}          \usepackage[left=2cm,right=2cm,top=1.8cm,bottom=2.2cm]{geometry}     \setlength{\hintscolumnwidth}{2.5cm}          \usepackage[utf8x]{inputenc}     \usepackage{color}     \usepackage{multibib}     \usepackage{url}     \usepackage{amsmath}          \newcites{conf}{Conferences and talks}     \newcites{pub}{Publications}     \newcites{confnote}{Selected conference and public notes}     \newcites{intnote}{Selected internal notes}     \newcites{poster}{Posters}     \newcites{proceedings}{Proceedings}


title: Problem with bibliography

text: ![Bibliography][1] How do I remove RefWorks quote at the beginning? I used these commands:               \addcontentsline{toc}{chapter}{\bibname}     \nocite{*}     \bibliography{bib}     \bibliographystyle{plain}


title: How to change seagull color theme alert text to non-bold

text: Some beamer color themes (as seagull) define alert text as bold font. However, sold font alerts are annoying when one uses overlay (eg: `\onslide+<2->`), because bold text takes more space than normal text, which breaks the illusion of an animation. To change alert from normal to bold, we can use the command               \setbeamerfont{alerted text}{series=\bfseries}      (see here). Unfortunately, I was unable to revert this by using something like               \setbeamerfont{alerted text}{series=\normaltext}      I don't know if this is because this command is wrong or if it is because it can't override seagull's settings. Does someone know a trick to set non-bold text with the `\alert` command while using seagull color theme?


title: How do I get Libertine + Libertine in math mode + historical ligatures + french-style?

text: I would like to write a document using:   * Libertine;   * Libertine in a correct math mode;   * Historical ligatures;   * French style of mathematics (upright greek letters and capital letters). I know I should use XeLaTeX, newtxmath and unicode-math for this, but all my attemps failed. What is the correct code to get this done?


title: EXAM Class : Choice next to each other

text: Currently using multicol and exam class I'm able to generate MCQ question paper in the formats mentioned below:               Q.1 : Quiescent centre is found in plants at :     A. Shoot tip              C. Root tip     B. Cambium                D. Leaf tip      Is there any option to arrange options as               Q.1 : Quiescent centre is found in plants at :     A. Shoot tip              B. Cambium     C. Root tip               D. Leaf tip


title: Line spacing in ToC, LoF, and LoT

text: I am currently writing my thesis in Latex and the thesis is supposed to be double spaced, so I have used the `\doublespacing` command in my latex file. The problem: Chapter or Section Titles, Figure Captions, and Table Captions which are long tend to split over multiple lines in the Table of Contents, List of Figures, and List of Tables. Currently, the spacing between all lines in the Table of Contents, List of Figures, and List of Tables, are double spaced. However, the multiple lines of a single entry should be single spaced, and the spacing between different entries should be double spaced. There were similar problems and solutions elsewhere, but non seem to work satisfactorily for me thus far. Moreover, the other solutions don't seem to work properly with the `\documentclass{report}`. I have provided a MWE below to describe the problem.               \documentclass[a4paper,12pt]{report}          \usepackage{setspace}     \usepackage{mwe} % just for dummy images     \doublespacing          \begin{document}          \addcontentsline{toc}{chapter}{Contents}     \tableofcontents           \addcontentsline{toc}{chapter}{List of Figures}     \listoffigures          \listoftables     \addcontentsline{toc}{chapter}{List of Tables}          \chapter{Test Chapter with a very very very very long name which splits over multiple lines}          Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer            \section{This is a long section title which splits across multiple lines. Dummy Text Dummy Text Dummy Text Dummy Text}          Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer           \subsection{Another section title}          \begin{figure}[!htb]     \centering     \includegraphics[width=3cm]{example-image}     \caption{This is a long figure caption which splits across multiple lines. Dummy Text Dummy Text Dummy Text Dummy Text}     \end{figure}          \begin{figure}[!htb]     \centering     \includegraphics[width=3cm]{example-image}     \caption{This is a short caption}     \end{figure}          \begin{table}[!htb]     \caption{This is a long table caption which splits across multiple lines. Dummy Text Dummy Text Dummy Text Dummy Text}     \centering     \begin{tabular}{ l | r }     \hline       1 & 2 \\       7 & 8 \\     \hline     \end{tabular}     \end{table}          \begin{table}[!htb]     \caption{This is a short caption.}     \centering     \begin{tabular}{ l | r }     \hline       1 & 2 \\       7 & 8 \\     \hline     \end{tabular}     \end{table}          \end{document}


title: Get the head, the tail, and the last element of a comma-separated list

text: I have a comma-separated list, stored in a macro. It is non-empty, and it has commas between the elements but not at the start or end. How can I get:   1. the first element (a.k.a. the "head")?   2. the last element?   3. every element except the first (a.k.a. the "tail")?  To clarify, I would like commands `\head`, `\last` and `\tail`, such that if               \johnlist={2,3,5,7,11}      then               \head\johnlist=2     \last\johnlist=11     \tail\johnlist={3,5,7,11}       By the way, I would prefer a TikZ-based solution if that's possible. Or, at least, a solution that works in the context of a TikZ picture.


title: Text with two columns (different from multicols)

text: How to write the following text (see the below image) where every line contains two parts. I want the right part of each line to be in the same (horizontal) level. How can I achieve this? ![enter image description here](http://i.stack.imgur.com/pnzoH.png)


title: Default settings for math typing

text: It is not a big issue, but it sometimes becomes annoying. The issue is, according to various sources, default maths type setting is `\mathnormal`, however whenever I write equations the final product becomes as in `\mathrm`. Is there any way to turn back it to default mode _i.e._ , `\mathnormal`? By the way, I am preparing a presentation with beamer (if it matters).


title: How to make longtable occupy its own standalone pages?

text: There is some text and now I want to insert some pages containing a `longtable`. How can I achieve this goal? To state my question clearly, I want               (Main text A)          -----------page break----------          longtable begins          -----------page break----------          longtable ends     (And although here is some space for text, but just leave it blank.)          -----------page break----------          (Main text A continues ...)      If I simply use `longtable` under Main text A, the table will adjoin it; if I add a `\newpage` under Main text A, there will be some unpleasant blank under Main text A -- furthermore, other floating objects still annoyingly break the long table. So how to make `longtable` occupy its own standalone pages? Thank you for your help! ## EDIT I've tried to put the long table in a standalone tex file and `\include{}` it in the expected place. It works fine partly: the `longtable` now can have its standalone pages perfectly, however, there's still some unpleasant blank under Main text A. PS: I have to sleep now. Thanks for any possible help. I will check them tomorrow :)


title: Connecting multiple arguments

text: I recently discovered Latex and is using TexMaker to edit my documents, in one of my university courses we will be performing a number of tests on a hydraulic rig. Since the tests will be conducted by a different person than the one writing the test document, there is considerable room for mistakes. I was thinking something along these lines of creating a command that matches the arguments for the variable to the corresponding value.                   \var{Pressure, Flow, Revolutions}{100 Bar, 25 L/min, 2000 rpm}               Generating the output:          Pressure 100 Bar          Flow 25 L/min         Revolutions 2000 rpm      Is this even possible to create using `\newcommand` or are there any packages that could suit my needs?


title: Table of contents to display (linguex) paragraph numbers

text: I am writing a legal document with numbered paragraphs and I would like the table of contents to list paragraph numbers, not page numbers. I am using `linguex.sty` to count the paragraphs (in the MWE below, the command `\ex.` generates sequentially numbered paragraphs, using the internal counter `ExNo`). For example, if section 1 runs from paragraphs 1 to 13 and section 2, from paragraphs 14 to 19 and section 3, from 20 to 24, then I'd like the table of contents to look like: > Section 1 ........... 1 > > Section 2 ........... 14 > > Section 3 ........... 20 At the start of each section, the paragraph counter is 1 less that the number that I wish to have in the table of contents. If I could replace the page number with:               \stepcounter{ExNo}\theExNo\addtocounter{ExNo}{-1}      then I should get the right result. I’ve used `tocloft.sty` for various other tweaking in the MWE below, but can’t find a parameter with the package that allows me to make this particular change. (I thought that this answer would work, but it has no effect at all.)               \documentclass[12pt]{report}     \usepackage{mathptmx}     \usepackage{linguex}     \usepackage{tocloft}         \renewcommand{\cftsecfont}{\scshape}         \addtocontents{toc}{\cftpagenumbersoff{chapter}}         \renewcommand*\thesection{\sc\roman{section}}         \renewcommand*\thechapter{\sc PART \Roman{chapter}}          \usepackage{titlesec}         \titleformat{\chapter}[hang]{\normalfont\scshape\filcenter}{PART \thechapter    }{0em}{}         \titlespacing{\chapter}{0pt}{0pt}{1.5ex}         \titleformat{\section}[hang]{\normalfont\scshape\filcenter}{\roman{section}.}{0.35em}{}          \usepackage{chngcntr}         \counterwithout{ExNo}{chapter}          \begin{document}          \setlength{\Exlabelsep}{0pt}     \setlength{\Exindent}{-2em}     \setlength{\Exlabelwidth}{2em}     \renewcommand{\ExLBr}{}     \renewcommand{\ExRBr}{.}     \renewcommand{\SubExLBr}{(}     \renewcommand{\SubExRBr}{)}     \setlength{\SubExleftmargin}{1.75em}%     \renewcommand{\theExRBr}{}     \renewcommand{\theExLBr}{}     \renewcommand{\firstrefdash}{}          \tableofcontents          \chapter{}          \section{hier geht's los}          \ex. Sauerkraut          \ex. Senfgurken          \section{hier geht's weiter}          \ex. Kaffee \dots          \ex. \dots\ und Kuchen!          \chapter{}          \section{was folgt}          \ex. Bauch-          \ex. -krampf          \end{document}


title: list item multilined ( `\newline` inside of item label ?)

text: How to make multiline item label ? Example               \documentclass[a4paper,10pt]{article}     \usepackage{lipsum}     \begin{document}     \begin{itemize}     \item[Great Item] \lipsum[1]     \end{itemize}     \end{document}      I would love to do               \item[Great \newline Item] \lipsum[1]      But I does not work. Expected result - first lines of litem label and item content aligned:               Great   Lorem ipsum dolor sit amet,     Item    consectetuer adipiscing elit.             Ut purus elit, ver...      * * * To be more specific I use `mydesc` environment provided at http://tex.stackexchange.com/a/23569/7128 . I would love to make it work together. Above example is overslimplified. Here is more detailed :               \documentclass[a4paper,10pt]{article}     \usepackage{lipsum}     % mydesc thanks for http://tex.stackexchange.com/a/23569/7128     \newenvironment{mydesc}[1]       {\list{}{\renewcommand\makelabel[1]{\it##1\hfil}%          \settowidth\labelwidth{\makelabel{\it#1}}%          \setlength\leftmargin{\dimexpr\labelwidth+\labelsep\relax}}}       {\endlist}     \begin{document}     \begin{mydesc}{LongestItem}     \item[Great Item] \lipsum[1]     \end{mydesc}     \end{document}


title: Add item to bst

text: I have a custom .bst made with `makebst`. It works well, except I would like to add an extra field for translated works. Ideally I would like something like "translated by [translator]" to appear after the book's title, where [translator] is the translator's name, when appropriate. I have the information stored in my .bib (under translator), but I don't know how to code the .bst.


title: Create Beamer-Theorem like boxes

text: I would like to create frames / boxes for equations or text like in the Beamer class: ![enter image description here](http://i.stack.imgur.com/WTE38.png) outisde of the beamer documentclass, for example in the `article` class. Is there any package or trick to do this? thanks


title: Multiple references order in LaTeX

text: I'm writing a paper using the `informs3.cls` class and `natbib` in LaTeX. I need to have some multiple references. I wonder if there is any general rule for sorting the references within the same `\cite`. Should it be by year or author names ?


title: Change colors/contrast in beamer navigation between active and dimmed section

text: The code below gives the following output for the head: ![](http://i.stack.imgur.com/qy8zy.png) Here the first section on the left is active and the others not, but the difference is quite small, I would like the active section to be in gray. Is there a way to control how the colors are mixed, so that I can increase the contrast (by dimming the inactive section even further)?               \documentclass{beamer}     \usetheme{Singapore}     \setbeamercolor{section in head/foot}{fg=gray,bg=white}           \begin{document}      \section{one}      \begin{frame}      \end{frame}           \section{two}      \begin{frame}      \end{frame}           \section{three}      \begin{frame}      \end{frame}     \end{document}


title: Alternatingly shading rows with @{}

text: I want to alternately shade the rows in my table. I am aware of How to alternately shade rows in a table and similar questions. However, as my table is long and needs to be aligned very neatly in order to not be totally confusion, I make heavy use of the self-defined delimiters for cells via `@{}`. The formatting gets totally screwed when I try the solutions proposed elsewhere. I suppose the `@{}` is what trips up `\rowcolors`. How can I color the rows without screwing up the formatting? A minimal example with my table is               \documentclass[a4paper]{scrartcl}          \usepackage{booktabs}     \usepackage[table]{xcolor}          \begin{document}          \rowcolors{2}{white}{gray!15} % <--- this is the solution from the other questions          \begin{center}     \begin{tabular}    {cl@{}r@{\,}r@{\,}r@{\,}r@{\,}r@{}l@{\qquad}l@{}r@{\,}r@{\,}r@{\,}r@{}lc@{\qquad}l@{}r@{\,}r@{)(}r@{}llc}     \toprule     & \multicolumn{7}{c}{\(SO(10)\) }  & \multicolumn{7}{c}{\(SU(5)\)} & \multicolumn{6}{c}{\(\mathcal G_\mathrm{SM}\)} & \\     Level & \multicolumn{7}{c}{weight} & \multicolumn{6}{l}{weight} & \(\mathrm{IR}_x\) & \multicolumn{5}{c}{weight} & \(\mathrm{IR}_Y\) & SM state \\ \midrule     0 & (&0& 0& 0& 0& 1&) & (&0& 1& 0& 0&) & \(\mathbf{10}_1\) &        (&1&0&1&) & \(\mathbf{3} \times \mathbf{2}_\frac{1}{6}\)&\(u_l\)\\     1 & (&0& 0& 1& 0& -1&) & (&0& 0& 0& 1&) & \(\overline{\mathbf 5}_{-3}\) &   (&0&1&0&) & \(\overline{\mathbf{3}} \times \mathbf 1_\frac{1}{3}\) & \(d^c_r\)\\     2 & (&0& 1& -1& 1& 0&) & (&1& -1& 1& 0&) & \(\mathbf{10}_1\) &      (&0&1&0&) & \(\overline{\mathbf{3}} \times \mathbf 1_{-\frac{2}{3}}\)& \(u^c_r\)\\     3 & (&1& -1& 0& 1& 0&) & (&0& 0& 1& -1&) & \(\overline{\mathbf 5}_{-3}\) &  (&0&0&1&) & \(\mathbf{1} \times \mathbf 2_{-\frac{1}{2}}\) &\(\nu_l\)\\     3 & (&0& 1& 0& -1& 0&) & (&1& 0& -1& 1&) & \(\mathbf{10}_1\) &      (&1&0&-1&) & \(\mathbf{3} \times \mathbf{2}_{\frac{1}{6}}\) &\(d_l\)\\     4 & (&-1& 0& 0& 1& 0&) & (&-1& 0& 1&0&) & \(\mathbf{10}_1\) &       (&-1&1&1&) & \(\mathbf{3} \times \mathbf{2}_{\frac{1}{6}}\) &\(u_l\)\\     4 & (&1& -1& 1& -1& 0&) & (&0& 1& -1& 0&) & \(\overline{\mathbf 5}_{-3}\) &     (&1&-1&0&) & \(\overline{\mathbf{3}} \times \mathbf{1}_\frac{1}{3}\) &\(d^c_r\)\\     5 & (&-1& 0& 1& -1& 0&) & (&-1& 1& -1& 1&) & \(\mathbf{10}_1\) &        (&0&0&0&) & \(\mathbf{1} \times \mathbf{1}_1\) &\(e^c_r\)\\     5 & (&1& 0& -1& 0& 1&) & (&1& 0& 0& -1&) & \(\mathbf{10}_1\) &      (&1&-1&0&) & \(\overline{\mathbf{3}} \times \mathbf{1}_{-\frac{2}{3}}\)& \(u^c_r\)\\     6 & (&-1& 1& -1& 0& 1&) & (&0& 0& 0& 0&) & \(\mathbf 1_5\) &        (&0&0&0&) & \(\mathbf 1 \times \mathbf 1_0\) &\(\nu_r\)\\     6 & (&1& 0& 0& 0& -1&) & (&1& -1& 0& 0&) & \(\overline{\mathbf 5}_{-3}\) &  (&0&0&-1&) & \(\mathbf 1 \times \mathbf 2_{-\frac{1}{2}}\) &\(e_l\)\\     7 & (&0& -1& 0& 0& 1&) & (&-1& 1& 0& -1&) & \(\mathbf{10}_1\) &         (&0&-1&1&) & \(\mathbf 3 \times \mathbf 2_\frac{1}{6}\) & \(u_l\)\\     7 & (&-1& 1& 0& 0& -1&) & (&0& -1& 0& 1&) & \(\mathbf{10}_1\) &         (&-1&1&-1&) & \(\mathbf{3} \times \mathbf 2_\frac{1}{6}\) &\(d_l\)\\     8 & (&0& -1& 1& 0& -1&) & (&-1& 0& 0& 0&) & \(\overline{\mathbf 5}_{-3}\) &     (&-1&0&0&) & \(\overline{\mathbf{3}} \times \mathbf{1}_\frac{1}{3}\) &\(d^c_r\)\\     9 & (&0& 0& -1& 1& 0&) & (&0& -1& 1& -1&) & \(\mathbf{10}_1\) &         (&-1&0&0&) & \(\overline{\mathbf{3}}\times \mathbf{1}_{-\frac{2}{3}}\) &\(u^c_r\)\\     10 & (&0& 0& 0& -1& 0&) & (&0& 0& -1& 0&) & \(\mathbf{10}_1\) &         (&0&-1&-1&) & \(\mathbf{3} \times \mathbf 2_\frac{1}{6}\)& \(d_l\)\\     \bottomrule     \end{tabular}     \end{center}     \end{document}


title: Two Columns whose content is positioned relative to each other

text: In theatre (and film) there's a tendency for actors to let each other finish what they're saying, possibly even making a small pause before starting their turn. But that is not how real life conversation work and it leads to a particular stiff "theatre tone". To counter that I'm letting my actors practise speaking at the same time (intentionally, that is, in real life they're doing it all the time). And in order to help them gain an idea of what the result is supposed to be like, I want to give them their text already in a format that visualises this. I made a text/plain example for what I need:               ALICE: I‘m saying something in     this mock drama of ours, it is      BOB: Yes.     supposed to be a little             CHARLES: No doubt.     monologue of medium length. I‘m     still supposed to be talking,       BOB: I can see that.     because our author needs an     example for you trying to     interrupt me. But, while I‘m     certainly perceiving what you‘re     saying, I‘m not yet letting you     take what linguists call your       BOB: I want to ...     „turn“, for I really want to     finish my thought.                  BOB: I want to say something right                                         now. I have to admit, I don‘t really     CHARLES: I feel that, too ...       have something to say. But I would                                         feel left out, if I did not get my     ALICE: Of course.                   turn. I would feel that I‘d be                                         vanishing in this piece, if I                                         wouldn‘t say something. I feel that                                         my sole purpose is to have a little     CHARLES: That‘s ...                 speech right here. And although I                                         rather feel compelled to talk right     CHARLES: That‘s great, because      now, I also derive some strange kind     it expresses exactly my             of joy from it.     sentiments also. You‘re really     giving voice to ...                 ALICE: Of course, Bob, and now we                                         all had our turn, except Charles,                                          whom I‘m interrupting right now, but                                         that is intentional. And now we                                         can finish this little farce,                                         right? I mean, like: Stop it                                         right now!      So, basically, I need two columns. The content of each column needs to be positioned relative to the text in the other column. In the example, when Bob says "Yes." in the right column, this should occur on the same line as the word "drama" in Alice's speech in the left column. And the other way around: When Charles says "I feel that, too ..." in the left column, this should occur after Bob's "I don't really have" in the right column. I guess, that, provided it is feasible at all, this is rather non-trivial to achieve in LaTeX. Basically, I need a solution right now, but also a possibly more thorough one for future projects. I have a nagging suspicion that for right now I'm better off with Inkscape or Scribus. I'd love to be wrong about this. For the future, I'd like to find a solution with LaTeX or TeX. I have little to no experience with LaTeX hacking, but I'm confident that I can get into it, given enough time. Pointers on where to look and tips as for the general logic on how to achieve it could greatly facilitate it. Also, I'm an org-mode user and feel quite at home with Emacs-Lisp hacking. So, one possibility would be to write an emacs interface and produce TeX code programmatically. A possible LaTeX interface could, for instance, include a command `\turn{LABEL}` to indicate the start of a new turn in the other column and `\turnlabel{LABEL}` to indicate where it should be vertically positioned in relation to the previous turn. The interface could, again just for instance, include a command `\interruption` for interruptions that don't constitute a turn. For instance:               %% mock LaTeX          \turn{Alice}           ALICE: I‘m saying something in this mock drama     \interruption{BOB: Yes.} \interruption{CHARLES: No doubt.}     of ours, it is supposed to be a little monologue of medium     length. I‘m still supposed to be talking \interruption{BOB:       I can see that.}, because our author needs an example for     you trying to interrupt me. But, while I‘m certainly     perceiving what you‘re saying, I‘m not yet letting you take     what linguists \interruption{BOB: I want to ...} call your     „turn“, for I really want to finish \turnlabel{Bob} my     thought.          \turn{Bob}     BOB: I want to say something right now. [...]


title: Removing horizontal lines from the header and footer of the title page

text: I intend to set two blank pages before my thesis title page. However, the workaround I use does good job for the first page, but introduces horizontal lines in the title page (there were "text text..." is). The following is my code:               \documentclass[a4paper,12pt]{book}     \usepackage{amsmath, amsthm, amssymb}     \usepackage{url}     \usepackage[algoruled,vlined]{algorithm2e}     \usepackage{graphicx,subfigure}          % for nice tables     \usepackage{booktabs}     % end for nice tables          % for using color names     \usepackage[usenames,dvipsnames]{color}     % end for using color names          % for nicer figure captions     \usepackage[font=small,format=plain,labelfont=bf,up,textfont=it,up]{caption}     % end for nicer figure captions               % fancy headers and footers     \usepackage{fancyhdr}     \pagestyle{fancy}     \renewcommand{\headrulewidth}{0.1pt} % for upper line     \renewcommand{\footrulewidth}{0.1pt} % for lower line     \fancyhead[LE,RO]{\itshape \nouppercase \rightmark}     \fancyhead[LO,RE]{\itshape \nouppercase \leftmark}     \fancyfoot[C]{\thepage}     % end fancy headers and footers          % for shaded table cells     \usepackage{colortbl}          % for multirow option in the tables     \usepackage{multirow}                    \usepackage[semicolon]{natbib}          \usepackage{fancybox}          \usepackage{xcolor}     \usepackage{framed}          \newcommand{\HRule}{\rule{\linewidth}{0.5mm}}          \newenvironment{myfancybox}{%       \def\FrameCommand{\fboxsep=\FrameSep \fcolorbox{black}}%       \color{black}\MakeFramed {\FrameRestore}}%     {\endMakeFramed}          % for theorems, lemmas...     \theoremstyle{plain}            % use "default" font          \newtheorem{thm}{Theorem}[chapter]     \newtheorem{lemma}[thm]{Lemma}     \newtheorem{prop}[thm]{Proposition}     \newtheorem{cor}[thm]{Corollary}     \newtheorem*{thma}{Theorem}          %\theoremstyle{definition}      % use "definition-style" font for the rest                    %\bibliographystyle{plain} %Choose a bibliograhpic style          \usepackage{sectsty}     \allsectionsfont{\itshape}          % for height of the heading      \setlength{\headheight}{15pt}          \parskip1ex     \begin{document}      \begin{titlepage}     \fancyhf{}     \newpage     \mbox{}     \newpage     \mbox{}     \newpage      {\large text text text text               text text text text text text text text              text text text text text text text text               text text text text text text text text}      \end{titlepage}          \end{document}      Is it possible to get two initial pages blank, and the title page without the horizontal lines? Note that the horizontal lines are necessary for the rest of the document, but should be absent from the title page.


title: No space between vertical rule and image

text: I want to design a titlepage for a beamer presentation (XeLaTeX, Miktex 2.9-64, Win7-64) and need to reduce the space between a rule and a graphic to 0. My code:               \setbeamertemplate{background}     {\hspace{0.6\paperwidth}     \rule{0.1cm}{\paperheight}     \includegraphics[width=0.4\paperwidth,height=\paperheight]{mypicture}}      My result: ![myresults](http://i.stack.imgur.com/Wpzj4.jpg) In the image above, the space I want gone is marked in red. What do I need to do?


title: Command line pdflatex vs TeXShop

text: In short my document is compiling without a problem with TeXShop and not at all with command line pdflatex. What is strange is that pdflatex does not recognize some basic packages, that are installed, for sure (ex: url.sty). I need to use the command line option because I am calling it from another script. What do I need to update? Is it a question of setting paths? I am on a OSX 10.6.8, running MacTeX2013. The same set up runs without a problem with command line pdflatex on Ubuntu 12.04 LTS.


title: Exporting animation created with animate package

text: Consider the following minimal working example. It's great to have an animation in pdf format. But sometimes it would be good to be able to **export** it into an **animated gif or something else** (swf, video file, svg?). How do I achieve this? I often have animations together with pgfplots.               \documentclass{article}          \usepackage{animate}          \usepackage[active,tightpage]{preview}     \PreviewEnvironment{animateinline}          \begin{document}          \begin{center}     \fboxsep1mm         \begin{animateinline}[autoplay,loop]{2}         a         \newframe             b         \newframe           c                          \end{animateinline}     \end{center}          \end{document}      **Remark:** The animation is not visible in all pdf viewers. It surely works with a current **Adobe Reader**.


title: smart art style diagram wih tikz

text: I have a question concerning drawing something similar to a smart art feature. If I have a diagram like so: ![enter image description here](http://i.stack.imgur.com/97N1M.png) The first thing I can do is draw the individual panels:               \documentclass{standalone}     \usepackage[margin = 1in]{geometry}     \usepackage{tikz}     \usetikzlibrary{decorations.pathmorphing,calc,shapes,arrows,snakes,shapes.geometric,patterns}     \usepackage{amsmath}     \usepackage{graphicx}          \begin{document}     \begin{tikzpicture}[y = 13mm, x = 10mm,decoration = snake] % used for aspect ratio of diagram     \tikzstyle{every node}=[font=\scriptsize] % ensure all text is relatively small     \coordinate (clipping area) at (10, 5.9);% The figure is drawn a bit bigger, and then clipped:     \clip (0,0) rectangle (clipping area);          % Next reference points are relative to the lower left corner of the clipping area     \coordinate (water level) at (0, 6);     \coordinate (bottom)      at (5, 1);       % (bottom of the pit)     \coordinate (ground1)     at (0, 6);       % (left shore)     \coordinate (ground2)     at (10, 6);      % (right shore)     \coordinate (sedFlux)     at (5, 2.2);     % location where we need the sediment flux arrow          % Coordinates of the bigger area really drawn     \coordinate (lower left)  at ([xshift=-5mm, yshift=-5mm] 0,0);     \coordinate (upper right) at ([xshift=5mm,  yshift=5mm] clipping area);          % Draw the water and ripples     \draw [draw=blue!80!black, decoration={bumps, mirror, segment length=6mm}, decorate,          bottom color=cyan!60!black, top color=blue!20!white]        (lower left) rectangle (water level-|upper right);          % Draw the ground     \draw [draw=white, fill=white]      (lower left) -- (lower left|-ground1)  --     (ground1) .. controls ($(ground1)!.3!(bottom)$) and (bottom-|ground1) ..     (bottom) .. controls (bottom-|ground2) and ($(ground2)!.3!(bottom)$) ..      (ground2) -- (ground2-|upper right) -- (lower left-|upper right) -- cycle;     \end{tikzpicture}     \end{document}      ![enter image description here](http://i.stack.imgur.com/wuZtx.png) Is it then possible to use this diagram and others to draw something like a smart diagram where instead of having text you could gave separate diagrams? I would eventually like to end up with something like: ![enter image description here](http://i.stack.imgur.com/ibkEB.png) But obviously each of the panels will not be identical. Assuming that the panels are identical can anyone suggest a way of doing this?


title: How can I define a new minted environment with optional arguments?

text: I have the following mwe:               % arara: pdflatex: { shell: true }     % arara: pdflatex: { shell: true }     \documentclass{article}     \usepackage{minted}     \usepackage{listings}     \usepackage{caption}     \captionsetup[lstlisting]{font=sf,labelfont=bf,skip=\smallskipamount}     \usepackage{xparse}     \NewDocumentEnvironment {example} { mm  }     {\VerbatimEnvironment      \captionof{lstlisting}{#2}\ifx\relax#1\relax\else\label{#1}\fi%     \begin{minted}[linenos=true]{latex}}     {\end{minted}}     \NewDocumentEnvironment {xexample} { o o  }     {\VerbatimEnvironment       \IfNoValueF { #1 }%         {\captionof{lstlisting}{#1}%           \IfNoValueF {#2} { \label{#2} }%        }%       \begin{minted}[linenos=true]{latex}}%      {\end{minted}}          \begin{document}          \begin{example}{TheLabel}{The caption}     \usepackage{minted}     \usepackage{caption,floatrow}     \end{example}          %\begin{xexample}[Another caption]     %\usepackage{minted}     %\usepackage{caption,floatrow}     %\end{xexample}          See Example~\ref{TheLabel}          \end{document}      The environment `example` works like expected. However this environment has two mandatory arguments. I am a friend of optional arguments/keys. With the environment `xexample` I tried this implementation but it fails. What's going on here? Bonus: Is it possible to pass options to `minted` as well? (of course with an optional argument ;-))


title: Chapter name appearing in the endnotes

text: I have a book document with chapters and endnotes. I want endnotes to be separated by chapter, and I have achieved that, following the answer to my earlier question Chapter numbers in endnotes However, there are two problems with the document below: (1) The Preface and the Epilogue, the two chapters that do not have numbers (that is, are introduced with the \chapter* command), do not appear as headings in the Notes (the way "Chapter 1" and other chapters appear). (2) the very last endnote, instead of having number 1 and appearing under a separate heading "Epilogue" (being the first endnote in the Epilogue), appears with number 2 and is lumped together with the endnotes from Chapter 3. How to fix these problems?               \documentclass[12pt]{book}          \usepackage{endnotes,chngcntr}          \counterwithin*{endnote}{chapter}  % Reset endnote numbering every new chapter          \makeatletter     \renewcommand\enoteheading{%     \setcounter{secnumdepth}{-2}     \chapter*{\notesname\markboth{NOTES}{}}     \mbox{}\par\vskip-\baselineskip     \let\@afterindentfalse\@afterindenttrue     }     \makeatother          \usepackage{xparse}          \let\latexchapter\chapter          \RenewDocumentCommand{\chapter}{som}{%     \IfBooleanTF{#1}     {\latexchapter*{#3}}     {\IfNoValueTF{#2}        {\latexchapter{#3}}        {\latexchapter[#2]{#3}}%      \addtoendnotes{%        \noexpand\enotedivision{\noexpand\subsection}          {\chaptername\ \thechapter. \unexpanded{#3}}}%     }%     }     \makeatletter     \def\enotedivision#1#2{\@ifnextchar\enotedivision{}{#1{#2}}}     \makeatletter          \begin{document}          \setcounter{tocdepth}{1}          \tableofcontents          \chapter*{Preface\markboth{PREFACE}{}}          \addcontentsline{toc}{chapter}{Preface}          This is the Prologue.\endnote{There is one endnote here, which should appear under the heading "Prologue" (it doesn't).}          \chapter{Amazing Story}     As I am describing this story, I make a note which should appear at     the end.\endnote{This the first endnote.} And then I make the second     note.\endnote{This is the second note.}          \chapter{Another Amazing Story}     In this chapter, there are no endnotes. So it should not appear in the     "Notes" at the end.          \chapter{Yet Another Amazing Story}     In this chapter, I have some notes again, which I want to go to the     end.\endnote{This note should appear at the end, under the heading     "Chapter 3. Yet Another Amazing Story", with the counter reset to 1,     since this is the first endnote of this chapter.}          \chapter*{Epilogue\markboth{EPILOGUE}{}}          \addcontentsline{toc}{chapter}{Epilogue}          This is the Epilogue.\endnote{One last endnote. It should have number     1 and should appear under the heading ``Epilogue''. But it     doesn't...}          \addtoendnotes{\unexpanded{\enotedivision{}{}}}          \cleardoublepage          \addcontentsline{toc}{chapter}{Notes}          \theendnotes          \end{document}


title: Subcaption label on the top and center

text: \begin{table}[H]     \tiny     \subfloat[A]{     \centering     \begin{tabular}{l l l l}     g1 & g2  & ex & Error Rate\\     \hline          0.001 & 0.001 & 0.001 & 0.331\\          0.001 & 0.001 & 0.01  & 0.336 \\          0.001 & 0.001 & 0.1   & 0.333\\          0.001 & 0.01 & 0.001  & 0.331\\          0.001 & 0.01 & 0.01   & 0.336\\          0.001 & 0.01 & 0.1    & 0.333\\          \end{tabular}}     \qquad     \subfloat[B]{     \centering     \begin{tabular}{l l l l}          g1 & g2  & ex & Error Rate\\          \hline          0.001 & 0.001 & 0.001 & 0.246\\          0.001 & 0.001 & 0.01  & 0.220 \\               \end{tabular}}


title: Vertical centering in several columns in longtable

text: I would like to change the vertical alignment of the second column in this table (the names of the hypotheses) to be centered, just as in the 1st column. My mininal example:               \documentclass[a4paper,fontsize=12pt,a4paper,DIV=10,BCOR=10mm,twoside,titlepage=false,openany,pagesize]{scrbook}          \usepackage[T1]{fontenc}     \usepackage[utf8]{inputenc}     \usepackage[english]{babel}     \usepackage{blindtext}     \setkomafont{disposition}{\normalfont\bfseries}     \usepackage{graphicx}     \usepackage[font=normalsize,labelfont=sc,singlelinecheck=false,justification=raggedright]{caption}     \usepackage[hyphens]{url}     \usepackage{setspace}     \usepackage{subfigure}     \usepackage{longtable}     \setlength\LTleft{0pt}     \setlength\LTright{0pt}     \usepackage{hyperref}     \hypersetup{         colorlinks,         citecolor=black,         filecolor=black,         linkcolor=black,         urlcolor=black     }     \usepackage{array}     \usepackage{multirow}     \usepackage{tabulary}     \usepackage{booktabs}      \usepackage{feyn}     \usepackage[authoryear]{natbib}     \usepackage{chngcntr}     \usepackage{dcolumn}     \usepackage{amsmath}          \begin{document}          \fontsize{10pt}{11pt}\selectfont     \begin{longtable}[c]{l>{\centering\arraybackslash}p{0.2\textwidth}>{\centering\arraybackslash}p{0.4\textwidth}}     \captionsetup{justification=raggedright,width=.82\textwidth}     \caption{Hypotheses}     \label{tab:hypotheses}     \endfirsthead     \multicolumn{3}{c}{{\bfseries \tablename\ \thetable{} -- continued from previous page}}\\     \endhead     \midrule     \multirow{3}{*}{H1} & \textit{`lalalala' hypothesis} & Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. \\     \cmidrule(lr){2-2}\cmidrule(l){3-3}     \multirow{7}{*}{H2} & \textit{`lalalala' hypothesis} & Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec. \\      \cmidrule(lr){2-2}\cmidrule(l){3-3}     \multirow{6}{*}{H2a} & \textit{`lalalalalalalalala' hypothesis} & Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. \\     \cmidrule(lr){2-2}\cmidrule(l){3-3}     \multirow{6}{*}{H2b}& \textit{`lalalalalalalala' hypothesis} & Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. \\      \bottomrule     \multicolumn{3}{l}{\small{\emph{Source: Author's depiction}}}\\     \end{longtable}     \normalsize          \end{document}


title: Horizontal alignment of text nodes of varying length in Tikz matrix like in Tex tabular

text: In `tablular`, we use `{r|c|l}` to define alignment. Is there anything similar for `Tikz matrix`. For example, by using `matrix`, the following MWE produces matrix of nodes, which appear to be center aligned for each column. However, I would like to have the nodes in the first column _right-aligned_ , the middle column _center-aligned_ , while the third column _left-aligned_. How would I achieve this? (also note, the nodes may have different styles)               \documentclass[border=5pt]{standalone}          \usepackage{tikz}     \usetikzlibrary{matrix}          \begin{document}     \begin{tikzpicture}[align=center]     \matrix[matrix of nodes,row sep=0.5cm,column sep=2cm,         nodes={rectangle, draw}]{     col1 & col2 & col3 \\     col111111111 & col2222222222 & col33333\\     col1111 & col22222 & col3333333333 \\     };          \end{tikzpicture}     \end{document}      yields this: ![enter image description here](http://i.stack.imgur.com/Ydwt4.png)


title: Vertical alignment of frame content within a custom theme

text: I'm making a presentation with rmarkdown (in RStudio) and then compiling it to pdf. I'd like to have my frames vertically top-aligned. With beamer only, I'd do that with `\documentclass[t]{beamer}` but I don't find a way to do that with rmarkdown and pandoc. I use a custom theme and could modify a parameter there if I would know the name of the parameter to change. There surely is a parameter to globally set vertical top-alignment? What is that?


title: How to install texlive-fonts-recommended (from Debian/Ubuntu) into texlive2012 (CTAN)?

text: while compiling my tex file, I am getting lots of this error --               kpathsea: Running mktexpk --mfmode ljfour --bdpi 600 --mag 0+540/600 --dpi 540 zplmr7v     mktexpk: don't know how to create bitmap font for zplmr7v.     dvips: Font zplmr7v not found,  using cmr10 instead.     </usr/share/texmf-texlive/fonts/pk/ljfour/public/cm/dpi600/cmr10.pk>     dvips: Checksum mismatch in font zplmr7v      so far I understood (after googling), I need to install a package called 'texlive-fonts-recommended' which is currently maintained as in the texlive version for Debian/Ubuntu. But I am using the main texlive2012 distribution from the CTAN (http://www.tug.org/texlive/acquire-netinstall.html). How do I do that? I am running a *nix system which is not a Debian derivative.


title: Typesetting actuarial term-certain symbol in pure TeX/MathJax

text: I have used the following code for a while to typeset the acturial symbol for a term certain, which is the half-box symbol around the n in this image: Link to Wikipedia example image Link to page               \def \termcertain #1% {% {\setbox 0 = \hbox {$\scriptstyle #1$}% \dimen 0 = \ht 0      \advance \dimen 0 by 1,0 pt \ht 0 = \dimen 0 \dimen 0 = \dp 0 \advance \dimen 0 by 1,50 pt      \dp 0 = \dimen 0 \vbox {\hrule \hbox {\box 0 \vrule }}% }% }      Usage:               a_\termcertain{n}      I got to this code by, frankly, taking something that half worked, combining it with something else that half worked, and poking it with a stick until it met my needs. I'd now like to use this code on a forum that uses MathJax. As is, it doesn't work, and I'm not sure why, but I presume it is using features that are not available in the Mathjax environment. Two questions:   1. How do I fix this to work with MathJax?   2. How do I configure the Mathjax installation to make \termcertain available to users?


title: How can I prevent a node from being cropped in an axis environment?

text: I would like to put labels on the left side of a y-axis, but the text gets cropped. How can I prevent this? ![enter image description here](http://i.stack.imgur.com/FD6yh.jpg) (Also, the entries are looking awful, so any ideas how to make it looking better are greatly appreciated. I want to recreate this: How do I generate a logarithmic x-axis without a y-axis?)               \documentclass{article}     \usepackage{pgfplots}     \begin{document}     \begin{tikzpicture}     \begin{axis}[         width=12cm,         y=2cm,            % y unit vector         hide y axis,        % hide the y axis         xmode = log,        % logarithmic x axis         axis x line*=bottom,% only show the bottom x axis line, without an arrow tip         xmin=1e-4, xmax=1e2,% range for the x axis         xlabel = Dose in Sv,         every x tick/.style={black, line width=0.3pt}     ]     \addplot [no markers, line width=8pt] table {     0.002 1     0.004 1     };          \node[anchor=east] at (axis cs:2e-4,1) {Hello};          \addplot [no markers, line width=8pt] table {     60 2     100 2     };          \node[anchor=east] at (axis cs:2e-4,1) {Hello};     \node[anchor=east] at (axis cs:2e-4,2) {Is it me you're looking for?};          \end{axis}     \end{tikzpicture}          \end{document}


title: Deleting an element from a comma separated list

text: In this answer we learnt how to remove the _n_ -th element from a comma- separated list. How can I remove an element from a list by its _value_ , rather than its _position_? For example: if my global variable `\citylist` currently has the value `derby,leicester,nottingham`, then after executing `\removecity{leicester}` I would like it to have the value `derby,nottingham`. I already have an `\addcity` macro (which I made by adapting a macro by David Carlisle):               \newcommand\addcity[1]{%       \ifx\citylist\@empty\else\g@addto@macro\citylist{,}\fi       \g@addto@macro\citylist{#1}     }


title: BibTeX compilation is corrupting myfiles

text: I am using TexMaker 1.9.9 and managing my references with KbibTeX. I have all the LiveTex package up to date from Debian Stable release. I always use the same template to write assignments:               \documentclass[10pt]{article}          % Some packages I always load, can be omitted:     \usepackage{url,graphicx,tabularx,array,geometry,amsmath,amssymb,apacite}          % Change english to the language you are writing in (for english this can   often be omitted):     \usepackage[english]{babel}          % Uncomment to use Sweave:     % \usepackage{Sweave}     % This is not a comment! Leave it in:     % need no \usepackage{Sweave.sty}          % Layout:     \setlength{\parskip}{1ex} %--skip lines between paragraphs     \setlength{\parindent}{0pt} %--don't indent paragraphs          % Commands for header:     \renewcommand{\title}[1]{\textbf{#1}\\}     \renewcommand{\line}{\begin{tabularx}{\textwidth}{X>{\raggedleft}X}   \hline    \\\end{tabularx}\\[-0.5cm]}     \newcommand{\leftright}[2]{\begin{tabularx}{\textwidth}{X>{\raggedleft}X}#1%     & #2\\\end{tabularx}\\[-0.5cm]}          %\linespread{2} %-- Uncomment for Double Space          %%% BEGIN DOCUMENT %%%          \begin{document}          \title{Title goes here}     \line     \leftright{\today}{Name (student number)} %-- left and right positions in the header      And my bibliography environment is:               \bibliographystyle{apa}     \bibliography{SIP_Project}                    \end{document}      My problem is that for some reason none of the references are written down, and except I get question marks where the references should be. Now, I know this happens quite often and indeed it's not the first time. But before this would be fixed by compiling a few more times and then all would be good. But now, something is clearly wrong. I have managed to reproduce the error. I start with only two files in my folder, the .tex file and the .bib file. I do a Latex compile and the process starts and exits normally. Also, the files .dvi, .log and .aux have been created. Now, I run BibTex from TexMaker. Process starts but ends with errors. The files .bbl and .blg are created. Now, I do a quick build to see the pdf. The pdf file compiles with all references being shown as question marks, and with only 3 references listed at the bottom of the file (I used 7 references). So, I close the pdf and try to make a Quick Build again. This time, the pdf doesn't compile and I get the following error (among others)               ! Undefined control sequence.     \b@King1998 ->\astroncite     {King and Napa}{1998}     l.54 \item The study by \citeA{King1998}     is a study on social pshycology who...     The control sequence at the end of the top line     of your error message was never \def'ed. If you have     misspelled it (e.g., `\hobx'), type `I' and the correct     spelling (e.g., `I\hbox'). Otherwise just continue,     and I'll forget about whatever was undefined.      This is another of the messages:               ! Undefined control sequence.     \b@King1998 ->\astroncite     {King and Napa}{1998}     l.54 \item The study by \citeA{King1998}     is a study on social pshycology who...     The control sequence at the end of the top line     of your error message was never \def'ed. If you have     misspelled it (e.g., `\hobx'), type `I' and the correct     spelling (e.g., `I\hbox'). Otherwise just continue,     and I'll forget about whatever was undefined.     ! Use of \@year@ doesn't match its definition.     \Y@King1998 ->\@year@ \astroncite      And another:               {King and Napa}{1998}     l.54 \item The study by \citeA{King1998}     is a study on social pshycology who...     If you say, e.g., `\def\a1{...}', then you must always     put `1' after `\a', since control sequence names are     made up of letters only. The macro here has not been     followed by the required stuff, so I'm ignoring it.     ! Undefined control sequence.      And so on. All the error messages have this format, but I don't see anything wrong with either my tex file or my bib file. By the way, my bib file was automatically generated by Mendeley, so I doubt there is something wrong with the entries. Just in case, the first entry I cite, which appears to be at least one of the problems, is the following on my .bib file:               @Article{ King1998,         author = "L a King and C K Napa",         issn = "0022-3514",         journal = "Journal of personality and social psychology",         keywords = "Adolescent, Adult, Aged, Aged, 80 and over, Female, Folklore, Happiness, Humans, Individuality, Job Satisfaction, Male, Middle Aged, Morals, Personal Satisfaction, Quality of Life, Social Values, Socioeconomic Factors, Students, Students: psychology",     month = jul,     number = "1",     pages = "156--65",     pmid = "9686456",     title = "{What makes a life good?}",     url = "http://www.ncbi.nlm.nih.gov/pubmed/9686456",     volume = "75",     year = "1998"     }      I have been using LaTex with TexMaker for quite some time now. I have used KBibTex and the same tex template over and over again. My bib files are always automatically generated from Mendeley, my bibliography manager. So I don't know what is wrong this time. Any comments or help are much appreciated.


title: Renewdefine section with additional argument

text: My goal is to redefine the command `\section` with a new argument for labeling: `\section[Title in TOC]{Title}{label}`               \documentclass{article}          \let\oldsection\section     \renewcommand{\section}[3][]{\oldsection[#1]{#2}\label{sec:#3}}          \begin{document}     \tableofcontents          \section{Myhello}{myhello}          \section[Hello in TOC]{Hello}{hello}     See section \ref{sec:myhello}.          \end{document}      I want to do it like in http://stackoverflow.com/a/1812477/2062965. Is `\renewcommand` better style than using `\def`?