title: IEEEtrantools clash with cleveref

text: I have two rather complex equations I would like to align at the two points to the left and to the right of the '=' sign. Elsewhere in the document I am using `cleveref`'s `\cref` command, but that package clashes with `IEEEtrantools`.               \documentclass{report}          \usepackage[retainorgcmds]{IEEEtrantools}      \usepackage{cleveref}          \begin{document}          \begin{IEEEeqnarray}{rCl}        a & = & 3\\        b & = & 4     \end{IEEEeqnarray}          \end{document}      Further would I like to give these two equations one tag, that should be displayed right-aligned and vertically centred. I took the equations from a book (Bohren and Huffman, 2004) and would like to keep both, their numbering and their formatting, which looks like this: ![taken from Bohren & Hoffmann, 2004, p. 100](http://i.stack.imgur.com/tlHmZ.jpg) How can this be achieved, with `cleveref` being kept?


title: Unicode degree symbol ° in math formulas: \textdegree invalid in math mode

text: I'd like to be able to simply input a degree symbol as ° in my source code. German keyboards have a key for this, and it makes the source so much more readable. I'm using `pdflatex` from TeXLive 2012, and this minimal reproducing example:               \documentclass{article}     \usepackage[utf8]{inputenc}     \usepackage[T1]{fontenc}     \usepackage{textcomp}     \begin{document}     Degree symbol in plain text works: 90° is a right angle.     Degree in math won't work: $\cos(90°) = 0$.     \end{document}      Compiling this document, I get the message               LaTeX Warning: Command \textdegree invalid in math mode on input line 11.      printed twice. Looking at the log for this run, I see an additional error message               Missing character: There is no <B0> in font cmr10!      where `<B0>` actually refers to a single byte that does not form a valid UTF-8 sequence, so is not properly printable on my console. I have a rough idea where all of this comes from, but little idea on how to solve this. I'd like to either make the `\textdegree` symbol work in math mode as well, or have the engine substitute some different command in place of my unicode code point. Ideally, that command would choose the right form depending on whether or not the current mode is math mode, which I don't know how to check (yet). For the final result, it would be nice if the symbol looked the same in both text and math modes, so I'd probably aim for a solution that dies switch to text mode to output that symbol. But perhaps there is an easier way to do all this. Perhaps there even is a package for this. Searching through previous posts here, I found there is a package `unicode-math`, but that does not work with pdfLaTeX, and switching the engine does not appear to be a reasonable requirement for most of my applications.


title: TikZ figure always positioned at the center of a new page

text: I run into this rather strange problem when using TikZ with LyX 2. I have this graph programmed using TikZ, and it is supposed to follow a paragraph of text and be positioned at the top of next new page. Instead, it is positioned exactly at the center of the new page, leaving a chunk of space between the text and itself. In my document, I place the tex code for the figure immediately after the text itself with a space, and the TikZ code is as follows.               \usetikzlibrary{shapes}     \usetikzlibrary{fit}     \usetikzlibrary{calc}     \usetikzlibrary{arrows}     \begin{figure}[ht!]         \centering         \begin{tikzpicture} [label distance=2mm,             vertice/.style={circle, fill=gray!30, thick, inner sep=0pt, minimum size=7mm},             dot/.style={shape=circle, fill=black, minimum size=2pt, inner sep=0pt, outer sep=2pt}]             \node [vertice] (a) at (0,7) {$t_1$};             \node [vertice] (b) at (0,6) {$t_2$};             \node [vertice] (c) at (0,5) {$t_3$};             \node [dot] (d) at ($(c) + (270:1)$) {};             \node [dot] (e) at ($(d) + (270:0.5)$) {};             \node [dot] (f) at ($(e) + (270:0.5)$) {};             \node[draw, ellipse, label=below:$T$, fit=(a) (b) (c) (d) (e) (f)] {};\node [vertice] (h) at (5,7) {$a_1$};             \node [vertice] (i) at (5,6) {$a_2$};             \node [vertice] (j) at (5,5) {$a_3$};             \node [dot] (k) at ($(j) + (270:1)$) {};             \node [dot] (l) at ($(k) + (270:0.5)$) {};             \node [dot] (m) at ($(l) + (270:0.5)$) {};             \node[draw, ellipse, label=below:$A$, fit=(h) (i) (j) (k) (l) (m)] {};                  \path (h) edge [-stealth, auto, swap] node {$w_1$} (a)                       edge [-stealth, auto] node[below, sloped] {$w_2$} (e)                 (i) edge [-stealth, auto, swap] node {$w_3$} (b)                 (j) edge [-stealth, auto] node[below, sloped] {$w_4$} (a)                       edge [-stealth, auto] node[above, sloped] {...} (f)                   (k) edge [-stealth, auto] node[above, sloped] {...} (c)                   (l) edge [-stealth, auto] node[below, sloped] {...} (d)                   (m) edge [-stealth, auto] node {...} (f);         \end{tikzpicture}         \caption{A graph $G$}     \end{figure}      Any suggestion how it can be fixed? I am using Springer LNCS document class, if that makes any difference.


title: Light up table of contents in beamer

text: I am trying to color ToC in beamer. By default when ToC appears all entries are gray, but I want them to becoloured as my theme. How can this been done? A MWE is the following               \documentclass[slidestop,compress,mathserif,11pt,xcolor=dvipsnames]{beamer}     \definecolor{LHCblue}{RGB}{4, 114, 255}     \usecolortheme[named=LHCblue]{structure}     \usepackage[bars]{beamerthemetree} %Beamer theme v 2.2     \usepackage{kerkis}     \setbeamercovered{higly dynamic}     \usetheme{Ilmenau} % Beamer theme v 3.0     \useoutertheme[subsection=true]{smoothbars}%Beamer Outer Theme-circles on top     \usefonttheme{serif}     \useinnertheme{circles} %rectangle bullet points instead of circle ones     \usepackage{beamerthemebars}     \title[Short Title]{Full Title}     \author{Author}     \institute{Institute}          \begin{document}          \begin{frame}     \titlepage     \end{frame}          \begin{frame}     \frametitle{Contents}     \tiny{\tableofcontents[currentsection]}     \end{frame}          \section{first section}     \begin{frame}     Intro to section     \end{frame}          \subsection{first subsection}     \begin{frame}     Theory     \end{frame}          \subsection{second subsection}     \begin{frame}     Experiment     \end{frame}          \subsection{third subsection}     \begin{frame}     Results     \end{frame}          \section{Back up slides}          \begin{frame}     1st Back up slide     \end{frame}          \begin{frame}     2nd Back up slide     \end{frame}          \begin{frame}     3rd Back up slide     \end{frame}          \end{document}


title: A macro to typeset a difficult table

text: The following table was created with the following LaTeX-code (mwe): ![table](http://i.stack.imgur.com/uk4eg.png)               \documentclass{article}     \usepackage{tabu}     \usepackage{multirow}     \begin{document}     \newtabulinestyle{stip=on 1.5pt off 2pt}     \begin{tabu} to \linewidth {X[0.8l]X[2.5l]X[c]X[c]X[c]X[c]X[c]} \hline     \rowfont{\bfseries} \multicolumn{2}{c}{\multirow{2}{*} {NUMBERS}} &     \multicolumn{2}{c}{Type} & \multicolumn{2}{c}{Size} &      \multirow{2}{*}{All} \\      & & A & B & Big & Small & \\ \hline     \multicolumn{2}{l}{Good}  & 1 & 4 & 2 & 3 & 5\\ \tabucline[stip]{-}      \multirow{3}{*}{Ugly} & Cow & 7  & 1 & 4 & 4 & 8 \\ \tabucline[stip]{2-}      & Goat & 1 & 2 & 0 & 3 & 3 \\ \tabucline[stip]{2-}      & Horse & 2& 1 & 3 & 0 & 3 \\ \tabucline[stip]{-}     \multicolumn{2}{l}{Bad}& 12 & 1 & 6 & 7 & 13  \\ \hline      \rowfont{\bfseries} \multicolumn{2}{l}{TOTAL} & 23 & 9 & 15 & 17 & 32 \\ \hline     \end{tabu}     \end{document}      Is it possible to create a macro that makes such tables from the following input?                \begin{mytable}[NUMBERS]      1 & 4 & 2 & 3 & 5 \\       7 & 1 & 4 & 4 & 8 \\      1 & 2 & 0 & 3 & 3 \\      2 & 1 & 3 & 0 & 3 \\      12 & 1 & 6 & 7 & 13 \\      23 & 9 & 15 & 17 & 32      \end{mytable}      I have been playing around with pgfplotstable for a while, but especially the multirows are giving me a headache. (Ideally, even the sums would be automatically calculated and an error would be returned if the numbers did not match. (A + B = Big + Small). But this is luxury rather than necessary.)


title: New command for bold characters in math mode

text: I am using bold characters u,v,w,x in math mode. Is there a way to make a new command for that? Now I always have to type `\bm{u}`.


title: Qtree Text Positioning

text: My document looks like this:               \documentclass{beamer}     \usepackage[T1]{fontenc}     \usepackage[utf8]{inputenc}     \usepackage{lmodern}     \usepackage{tikz}     \usepackage{tikz-qtree,tikz-qtree-compat}     \usepackage{graphicx}     \title{}     \author{}          \begin{document}     \begin{frame}     \resizebox{\linewidth}{!}{%          \begin{tikzpicture}[level 1/.style={level distance=1cm}]          \Tree     [.(-,(3,3),1)      [.(1,(8,0),2)                        [. (1,(1,1),1) {(1,(1,1),$\perp $)\\ (-1,1)} ]                        [.(1,(1,1),2) [.(1,(1,1),1) {(1,(1,1),$\perp $) (-1,1)} ] ]                       [.(1,(8,0),1) (1,(8,0),$\perp $)  ]                    ]       [.(-,(3,3),2)                                      [.(2,(0,8),1)                                                              [.(2,(1,1),2) {(2,(1,1),$\perp $)} ]                                                             [.(2,(1,1),1) {(2,(1,1),2)} ]                                                             [.(2,(0,8),2) {(2,(0,8),$\perp $)} ]]                      { (-,(3,3),$\perp$)}                    ]     ]          \bigskip     \end{tikzpicture}     }     \end{frame}     \end{document}      The text `(-1,1)` (in the first indented line) should appear below the leaf, but when I insert a line break (`\\\`), I get an error.


title: Plot to illustrate secant lines

text: I am trying for teaching purpose to explain how basically linear regression might work and how it could be extended. Since I am not the TeXpert I fear that my idea might be tricky and more difficult than it probably can be. I have seen many nice plots with `tikz` and `pgfplots`. I searched around and found finally the following image. ![enter image description here](http://i.stack.imgur.com/5fdTF.gif) This image looks quite appropriate, cause I can explain how the regression might look like. But the problem is that I cannot manipulate, e.g. draw grid, change the naming of `x_0` resp `\epsilon`, change the red line to a dotted one, add other points than P and Q, etc. If the function itself is `x^2` or some mixture, I don't mind for explanation. My main objective is to illustrate the basic ideas. And if I would have a sample, then I could extend it little bit further to mean, variance, etc. Is anybody willing to give me a helping hand? I don't mind if somebody could point me to existing samples. Would be fine as well.


title: differently colored polygons?

text: I want to create 6 hexagons side by side, each having a different number of edges dashed instead of normal. How is it possible?   The code I currently use to create a single hexagon is:                   \foreach \n in {1,2,...,6} {         \node at (\n*2.5-4,1)[above left] {\n$.$} ;         \draw [xshift=\n*2.5cm-3cm] (0:1cm) \foreach \x in {1,2,...,6} {             -- (\x*60:1cm)} --cycle (90:1cm);     }      I don't mind creating each hexagon individually if there's no simple way to create them in a loop, but I don't even know how to do that. edit: Clarifications: What I want to achieve is basically a list of hexagons, each with a different "order" of edges dashed (That is, all the possible variations of dashed edges such that you can't get from one to the other by rotating the hexagon). I though that's a bit too broad of a questiong so I asked about the coloring of one hexagon with a certain dashed pattern, but I guess I wasn't clear enough (sorry for that, English is not my mother tounge so stuff tend to get messy). I'm using TeX through Lyx and don't really know how to use it very well, so I don't know how to post an MWE, sorry :(.


title: Automatic conversion from picture commands to tikz-pgf

text: I'm trying to modify an old document with a bunch of images created using the `picture/pict2e` environment.   The problem is that I need to improve these images, but adding some new features in those old environments sometimes require a lot of work, while in TikZ would be just a couple of parameters. So, the question: is there a way to automatically convert `picture` images into TikZ/`pgf` images ?


title: Permanent "Undefined Control Sequence?"

text: I'm incredibly confused, and I have absolutely no explanation for this whatsoever. I was happily going about writing my document, which had compiled just fine for weeks beforehand, when I added something minor and got this result:               ! Undefined control sequence.     l.65 \zref@n          ?      Ok, so I went to line 65. _That line was a comment_. Just to be sure, I deleted out the comment anyway, and got the exact same error. I deleted out the part which I had added, thus going back to a document that had compiled perfectly literally 5 minutes before. Same error. Here's where it got weird. I deleted everything _around_ line 65 as well (which was still part of my premable so it was some command definitions) - and got the exact same error! Now I'm really confused, so I deleted _everything in my preamble_ except the bare minimum necessary (e.g. \documentclass and \begin{document}). Once again, the result was an undefined control sequence at line 65. Out of curiousity, I deleted the **entire thing** , replacing it with a simple Hello World document. Again - undefined control sequence at line 65 (which didn't even _exist_ in the Hello World document, much less define a command) I don't really know very much about LaTeX beyond how to create a relatively simple document, and google has not been particularly helpful on this subject. I'm completely stuck. Has anyone had any similar issue whatsoever?


title: Replace asterisk with nothing in string

text: I have a function which grabs cells out of a table and returns them. Many of these cells end with two asterisks, and I would not like these returned from the function if they are present. For example:               % Function to get data     \def\getdata#1#2{%     \pgfplotstablegetelem{#1}{#2}\of{\table}\pgfplotsretval%     }      If this returns a value such as "2.3**", I would like "2.3". Thanks, I assume this is rather straightforward.


title: Changing the title height in a beamer

text: How can I change the height of the title in the `beamer`? Height of the title block is big and I want to make it smaller and similarly the width of the left block is big and I want to make it smaller too. I know this is a simple question but I could not find which `.sty` files I need to look.


title: tikz: clipping a node

text: i would like to obtain this effect               \documentclass{standalone}          \usepackage{tikz}     \usetikzlibrary{calc}          \begin{document}     \begin{tikzpicture}     \clip (-1ex,-12pt) rectangle (1ex,12pt);     \node [align=center] (text) {A \\ B \\ C};     \end{tikzpicture}     \end{document}      but i cannot find a way to clip the node that is still to be drawn, something like               \clip ($(text.south west) + (0,6pt)$) rectangle ($(text.north east) - (0,6pt)$);      how can i achieve it without explicit use of the position to clip?


title: Writing a macro which will know the current state

text: I wish to write a macro which will be able to tell whether the machine is currently in mathmode or not. The pseudo-code is:               IF IN MATHMODE{     %commands     }     ELSE{     %other commands     }      Is such a thing possible? And if so, how?


title: Tables header row's: how to ignore the column type?

text: I have several column types defined using the `array` and `collcell` package. An example               \newcolumntype{N}{>{\collectcell\num}c<{\endcollectcell}}      This alleviates making tables a lot, and makes them more readable in the source file. Yet when I make a table with some header rows, I have to escape the column commands (the headers don't need to be inside the `\num`) using `\multicolumn`:               \begin{tabular}{NN}         \hline         \multicolumn{1}{c}{Header 1} & \multicolumn{1}{c}{Header 2}\\         \hline         1.234 & 2.345\\         ....     \end{tabular}      is there a quicker way of doing this? Perhaps by redefining the column type mid-table, or having a command that will generate an escape row?


title: Is there a \lowertitleback for \extratitle?

text: I am using the `koma` package to typeset my thesis and was wondering if there is something like "`\lowerextratitleback`", i.e. the analog of `\lowertitleback` for the extra title page which can be set using `\extratitle`, to put text on the backside of the extra titlepage?


title: The item in my title will not centre

text: I am trying to make a title page for a report, and everything comes out great, except for the one line (Lecturer:John Doe) that does not want to centre properly. My code:               \title{      \normalfont \normalsize      \textsc{Some place} \\    [25pt]      \horrule{0.5pt} \\[0.4cm]      \huge Assignment \\      \horrule{2pt} \\[0.5cm]       Lecturer: John Doe     \newline     {\Huge 2014}     \date{}     }


title: A way to change how the header of a AMS-LaTeX file is presented?

text: I'd like to change the way the header is presented in an AMS-LaTeX file... I based my file on `testmath.tex`. First, I'd like to allow my header, or represented by `\markboth`, to show up in the first page. Second, instead of showing REFERENCE in the header of the pages where reference is listed, I'd like to make my file present the header as in other pages. How can I do this?


title: "Missing $ inserted" errors generated in tabular figure

text: I've compiled my LaTeX document into a PDF using the website ScribTeX, and everything seems to look fine, but I keep getting the following errors: ![enter image description here](http://i.stack.imgur.com/lIDom.png) Similar errors happen every time I use a table. The code in question is this block, which starts with line 141:               \begin{figure}[h]     \begin{center}     \begin{tabular}{|c|}          \hline     `a' \rightarrow  \tt{e}, \tt{@}, \tt{A} \\          `nice' \rightarrow   \tt{naIs}, \tt{nis} \\          `cold' \rightarrow \tt{kould} \\          `hour' \rightarrow \tt{aU\char18 r} \\     \hline     \end{tabular}     \captionfonts     \caption[queryDBwithOrthoWordForSampa example]{ In this and all subsequent diagrams, a `string in quotes' indicates an orthographic word or phrase, and a \texttt{monospaced string} indicates that it is a SAMPA word or phrase.  }     \label{fig:oronymGeneration:queryDBwithOrthoWordForSampa}     \end{center}     \end{figure}


title: Tikz: Avoiding line segments in snake path

text: I am using tikz to draw Feynman diagrams, and I learned how to draw a curved snake path. The problem is that in general line segments are present (I'd like to avoid them). I found a couple of post with could help to solve the problem, but none of them is working properly for me. The post are:   * coil-path-decoration-without-straight-segment   * tikz-decorated-paths-without-straight-segment The second method results in the figure below, ![Diagram generated with the code below](http://i.stack.imgur.com/T0BUr.png)               \documentclass{beamer}               \usepackage{tikz}     \usetikzlibrary{decorations.pathreplacing,decorations.markings,snakes}     \newif\ifstartcompletesineup     \newif\ifendcompletesineup     \pgfkeys{         /pgf/decoration/.cd,         start up/.is if=startcompletesineup,         start up=true,         start up/.default=true,         start down/.style={/pgf/decoration/start up=false},         end up/.is if=endcompletesineup,         end up=true,         end up/.default=true,         end down/.style={/pgf/decoration/end up=false}     }     \pgfdeclaredecoration{complete sines}{initial}     {         \state{initial}[             width=+0pt,             next state=upsine,             persistent precomputation={                 \ifstartcompletesineup                     \pgfkeys{/pgf/decoration automaton/next state=upsine}                     \ifendcompletesineup                         \pgfmathsetmacro\matchinglength{                             0.5*\pgfdecoratedinputsegmentlength / (ceil(0.5* \pgfdecoratedinputsegmentlength / \pgfdecorationsegmentlength) )                         }                     \else                         \pgfmathsetmacro\matchinglength{                             0.5 * \pgfdecoratedinputsegmentlength / (ceil(0.5 * \pgfdecoratedinputsegmentlength / \pgfdecorationsegmentlength ) - 0.499)                         }                     \fi                 \else                     \pgfkeys{/pgf/decoration automaton/next state=downsine}                     \ifendcompletesineup                         \pgfmathsetmacro\matchinglength{                             0.5* \pgfdecoratedinputsegmentlength / (ceil(0.5 * \pgfdecoratedinputsegmentlength / \pgfdecorationsegmentlength ) - 0.4999)                         }                     \else                         \pgfmathsetmacro\matchinglength{                             0.5 * \pgfdecoratedinputsegmentlength / (ceil(0.5 * \pgfdecoratedinputsegmentlength / \pgfdecorationsegmentlength ) )                         }                     \fi                 \fi                 \setlength{\pgfdecorationsegmentlength}{\matchinglength pt}             }] {}         \state{downsine}[width=\pgfdecorationsegmentlength,next state=upsine]{             \pgfpathsine{\pgfpoint{0.5\pgfdecorationsegmentlength}{0.5\pgfdecorationsegmentamplitude}}             \pgfpathcosine{\pgfpoint{0.5\pgfdecorationsegmentlength}{-0.5\pgfdecorationsegmentamplitude}}         }         \state{upsine}[width=\pgfdecorationsegmentlength,next state=downsine]{             \pgfpathsine{\pgfpoint{0.5\pgfdecorationsegmentlength}{-0.5\pgfdecorationsegmentamplitude}}             \pgfpathcosine{\pgfpoint{0.5\pgfdecorationsegmentlength}{0.5\pgfdecorationsegmentamplitude}}     }         \state{final}{}     }     \tikzset{       % style to apply some styles to each segment of a path       on each segment/.style={         decorate,         decoration={           show path construction,           moveto code={},           lineto code={             \path [#1]             (\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);           },           curveto code={             \path [#1] (\tikzinputsegmentfirst)             .. controls             (\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb)             ..             (\tikzinputsegmentlast);           },           closepath code={             \path [#1]             (\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);           },         },       },       % style to add an arrow in the middle of a path       mid arrow/.style={postaction={decorate,decoration={             markings,             mark=at position .5 with {\arrow[#1]{stealth}}           }}},     }          \begin{document}     \begin{frame}       \frametitle{Field and Mass Renormalization}     \begin{center}           \begin{tikzpicture}[thick,scale=.6]             \path [draw=blue,postaction={on each segment={mid arrow=blue}}]             (-4,0) -- (-2,0) -- (2,0) -- (4,0);             \draw[draw=blue,decorate, decoration=complete sines] (2,0) arc (0:180:2cm);           \end{tikzpicture}         \end{center}     \end{frame}     \end{document}      **Any fresh ideas on this respect?**


title: How not to indent the very first line on a page in LaTeX?

text: If the first line on a page happens to be the first line of a paragraph at the same time, I would like not to indent it (just as if it is the first line of a section). Is there a way to do this automatically? I don't want to use `\noindent` command, because if this line moves elsewhere, I want to indent it. Thanks ahead for help!


title: Floating wrapped figure in a twocolumn page

text: I am creating a big composite book `\documentclass[A4,twocolumn]{book}`. I need wrapped floating figures (and tables) over both columns. I know the enviroment `figure*`, but the full width of a page is so big. There are a lot of figures with small one-column overlaps - using `figure*` will result in an enormous increase in the number of pages. Here How to use wrapfig to span multiple columns I read about using `wrapfig` to do it, but it isn't an easy way to do it. Is there some another solution? Example:               Lorem ipsum   Lorem ipsum     et dolorem    et dolorem     amenbat aqu   amenbat aqu     +-----------------+ Lorem      |                 | ipsum     |      figure     | et dolo-     |                 | rem ame-     +-----------------+ bat Lo-     Lorem ipsum   rem ipsum      et dolorem    et dolorem


title: LyX type software

text: I am a big fan of LyX(I find typing up in TeX directly really annoying, I like being able to see my formulas), however are there any other programs that make it a lot easier to TeX too? I just want to see if there are others too so I can try them out. I am looking for LaTeX software which will work on Linux- Ubuntu. (If it generates the PDF view directly that is a plus.. I know there is a paid versions that works that way)


title: Chapter style using chaptername and chapter number inside TikZ

text: I am trying to define my own chapter style for my thesis. I am using `memoir`, and want to put the part that says e.g. "Chapter 3" or "Appendix C" inside a single TikZ figure. My code so far is the following, but naturally it doesn't work for appendices, because they will also just read e.g. "Chapter C" and not "Appendix C". I have been looking around the web and the `memoir` documentation, and I found that I might be able to use `\@chapapp`, but I got nowhere with that.. Can you help?               \makechapterstyle{nicechap}     {         \setlength{\beforechapskip}{0cm}    % Distance from top of page to chapter headings         \setlength{\afterchapskip}{1cm}     % Distance from chapter text to body         \setlength{\midchapskip}{0cm}       % Distance between chapter number and heading              \renewcommand*{\chapnamefont}{\huge\scshape}         \renewcommand*{\printchaptername}{}         \renewcommand*{\chaptitlefont}{\huge\scshape\bfseries}         \renewcommand\chapternamenum{}         \renewcommand\printchapternum         {             \makebox[0pt][l]             {                 %\tikzset{external/remake next}                 \begin{tikzpicture}[->, thick]                     \node[draw, minimum height=3em] at (0,0) (chap) {\chapnamefont {\bfseries Chapter~\thechapter}};                     % other TikZ drawing stuff here..                        \end{tikzpicture}             }         }     }


title: How to type multiple choice questions with more than one correct choice

text: I want to type multiple choice question (which may have two or more answer) book using exercise package such as               \begin{questions}     \question This is the first question     \choice Wrong answer     \correctchoice This is a correct answer     \correctchoice This is another answer     \choice Wrong answer          \question     ....     \end{questions}      I want to type the answer at the end of the book with chapter name and exercise number or page number of the book. The choices in the questions must be in a single row or in two rows to save the space. In the answer sheet, I like to give explanation to select the answer.


title: How to put a float *right here* if possible, or at the top of the next page if it is not possible?

text: Using the `float` package, I can use the `H` specifier and position a float exactly where I want it. For example,               \documentclass{article}          \usepackage{lipsum}     \usepackage{float}     \usepackage[demo]{graphicx}     \restylefloat{figure}          \begin{document}          \lipsum[1-3]          \begin{figure}[H]     \begin{center}     \includegraphics{foo}     \end{center}     \end{figure}          \lipsum[10-20]          \end{document}      Sometimes this will cause an unsightly page break. For example, if I changed the `\lipsum[1-3]` to `\lipsum[1-4]`, the graphic will not fit on the page, so the page will break and the float will appear at the top of the next page. The amount of space at the end of the broken page is not desirable. A way to fix this is with the `afterpage` package as follows:               \documentclass{article}          \usepackage{lipsum}     \usepackage{afterpage}     \usepackage{float}     \usepackage[demo]{graphicx}     \restylefloat{figure}          \begin{document}          \lipsum[1-4]          \afterpage{\clearpage     \begin{figure}[H]     \begin{center}     \includegraphics{foo}     \end{center}     \end{figure}     }          \lipsum[10-20]          \end{document}      That puts the float at the top of the next page as before, but avoids the page break. In effect, the `afterpage` business tells LaTeX to place the graphic at the top of the next page, and nowhere else, but allows the first page to fill up completely. What I would like is combination of these two tricks. In other words, I would like to tell LaTeX to put a float right here if you can do so without breaking the page. If you can't do that, then insert it at the top of the next page. In pseudo-code it might go something like this               if you-can-do-this-without-a-page-break then         \begin{figure}[H]         \begin{center}         \includegraphics{foo}         \end{center}         \end{figure}     else:         \afterpage{\clearpage         \begin{figure}[H]         \begin{center}         \includegraphics{foo}         \end{center}         \end{figure}         }      It is a simple conditional, but I don't know how to determine whether the page break will occur. Presumably, it would require calculating the box size of the graphic and then seeing if that box size fill fit comfortably on the page if it were inserted at the requested position.


title: Creating bullet-list from string with delimiters

text: I want to create a bullet list from a string with delimiters in it. The delimiter in my example is `|` Example string:               This is|A bullet|List from|A string      I want to get that to become a bulletlist like this:   * This is   * A bullet   * List from   * A string What do I need to do this? Some extra packages or? I can use any delimiter but `,` since the string comes from a CSV file that gets parsed with csvsimple if that makes it easier. MWE (after suggestions in answer):               \documentclass{scrreprt}     \usepackage{csvsimple}     \usepackage{etoolbox}       \csvreader[head to column names]{content/usecases.csv}{}{%         \begin{table}           \begin{tabular}{|l|l|}             \hline             Name             & \ucname \\ \hline             Pre conditions   &                \begin{itemize}                 \renewcommand*{\do}[1]{\item #1}%                 \ListParser{\preconditions} %               \end{itemize} \\ \hline           \end{tabular}         \end{table}       }     \end{document}      CSV Example:               ucname,precondition     test,This is|A test     test2,Barely     test3,No List     test4,List|Again|Here      Follow-up posted here: Auto generate list-items within table from string with delimiter


title: Bibliography Style - Order of Appearance

text: I am looking for a bibliography style with the following characteristics:   1. Numbers references in the order they appear in text.   2. Does not strike out repeated authors like (siam.bst).   3. Very plain formatting on titles (i.e. articles, book, journal).   4. Is able to handle a wide variety of reference types (i.e. journals, book chapters, websites, personal communications, etc.). I have looked around and tried a handful of alternatives without finding one that fits for my purpose, which is a graduate thesis (i.e. a formal document, but without the space constraints of a journal article). If there are alternative ways to manage this type of request using the `biblatex` that'd be fine too.


title: Problem with the subscripts of adjacent sums

text: I have a problem with the subscript under the sum,               \sum_{i \in X} \sum_{i \in \bar{X}}      for example gives the subscript at different heights for each sum. Does anyone know how to fix this?


title: Plot non-continuous function with TikZ

text: How can I plot a non-continuous function with TikZ (using continuous lines for continous stretches of the function and dashed lines for discontinuities)? Does anybody know an efficient method?


title: Fixed horizontal spacing in itemize environment

text: How can I put space after Itemmmmmmm: etc. I want to write               First Itemmmmmmm:     Value     Second Itemmmm:       Value          third Itemmmmmmmmm:   Value      Currently, I'm getting                  \documentclass[11pt]{article}     \usepackage[T1]{fontenc}     \usepackage{enumitem}     %\setlist{itemize}{leftmargin=4em,labelsep=2em}  % global adjustment          \begin{document}       \begin{itemize}[noitemsep,topsep=0pt,parsep=0pt,partopsep=0pt]      \item First Itemmmmmmm:  Value      \item Second Itemmmm: Value      \item third Itemmmmmmmmm: Value       \end{itemize}               \end{document}


title: What is the cleanest way to redefine math-mode font commands such as \mathrm and \mathit to use a different font?

text: **What is the cleanest way to redefine math-mode font commands such as`\mathrm` and `\mathit`?** I would like everything else to be unaffected; for example, perhaps I enjoy working with `mathptmx` and I want to keep its `\mathnormal`, but I want to change `\mathrm` and `mathit` to use a different font.               \documentclass{article}     \usepackage{mathptmx}               \begin{document}          Some text.          Some formula: \(abc = de/f \quad[\mathrm{var}, \mathit{val}]\)          \(\mathnormal{abc = de/f}\)          var, \textit{val}          \(\mathrm{var}, \mathit{val}\)          % Bitstream Charter     {\fontfamily{bch}\fontseries{m}\fontshape{n}\selectfont  var,      \fontfamily{bch}\fontseries{m}\fontshape{it}\selectfont val}          % Linux Biolinum     {\fontfamily{LinuxBiolinumT-OsF}\fontseries{m}\fontshape{n}\selectfont  var,      \fontfamily{LinuxBiolinumT-OsF}\fontseries{m}\fontshape{it}\selectfont val}          % Linux Libertine     {\fontfamily{LinuxLibertineT-OsF}\fontseries{m}\fontshape{n}\selectfont  var,      \fontfamily{LinuxLibertineT-OsF}\fontseries{m}\fontshape{it}\selectfont val}          \end{document}


title: Is there something like chktex for ConTeXt?

text: I'm using ConTeXt MKIV (if that makes a difference here). The problem is I'm writing my ConTeXt in vim, and a I have a syntax/style checker plugin called syntastic. The thing is it's using chktex for tex files, which spits out tons of warnings for perfectly reasonable ConTeXt, like               \starttext     \startsection[title={Testing ConTeXt}]     This is a little test for \CONTEXT.     \stopsection     \stoptext      And chktex gives me: > > Warning 1 in test.tex line 1: Command terminated with space. \starttext   >  ^ Warning 13 in test.tex line 3: Intersentence spacing (`\@') should > perhaps be used. This is a little test for \CONTEXT.   >  ^ Warning 1 in test.tex line 4: Command terminated with space. \stopsection   >  ^ Warning 1 in test.tex line 5: Command terminated with space. \stoptext   >  ^ No errors printed; 4 warnings printed; No user suppressed warnings; No > line suppressed warnings. Now it'd be easy to just ignore these warnings, but getting style warnings is actually pretty useful. Just much less so when you get into the habit of ignoring them, which is what getting wrong warnings all the time does for you. So the question is: Is there something like this for ConTeXt yet? Or is there perhaps some option I could pass to chktex to make it behave more agreeable here?


title: Environment align undefined line 11, all I can see to do is to retype the line and it still isn't working

text: \documentclass [12pt]{article}     \oddsidemargin=0pt     \topmargin=0pt     \textwidth=6.5in     \textheight=8.5in     \begin{document}     \begin{center}     {\large\bf\LaTeX\ Example 8}     \end{center}     Sometimes we have to typeset a sequence of calculations:     \begin{align}     \sum_{r=1}^k\left( l(r)-l(r-1)\right)      &= \sum_{r=1}^k\left(N-2r+1\right) \\      &= k(N+1)-2\sum_{r=1}^kr \\      &= k(N+1)-k(k+1) \\      &= k(N-k)      \end{align}     \begin{quote}     \begin{verbatim}     \begin{align}     \sum_{r=1}^k\left( l(r)-l(r-1)\right)      &= \sum_{r=1}^k\left(N-2r+1\right) \\      &= k(N+1)-2\sum_{r=1}^kr \\      &= k(N+1)-k(k+1) \\      &= k(N-k)      \end{align}     \end{verbatim}     \end{quote}     Here is another way:     \begin{eqnarray*}      \sum_{r=1}^k\left(l(r)-l(r-1)\right)      &=& \sum_{r=1}^k\left(N-2r+1\right) \\      &=& k(N+1)-2\sum_{r=1}^kr \\      &=& k(N+1)-k(k+1) \\ &=& k(N-k)      \end{eqnarray*}     \begin{quote}     \begin{verbatim}     \begin{eqnarray*}      \sum_{r=1}^k\left(l(r)-l(r-1)\right)      &=& \sum_{r=1}^k\left(N-2r+1\right) \\      &=& k(N+1)-2\sum_{r=1}^kr \\      &=& k(N+1)-k(k+1) \\ &=& k(N-k)      \end{eqnarray*}     Observations:     \begin{itemize}     \item The eqnarray environment is a displayed array with three columns.  It is aligned on     the center column.     \item The \verb+*+ supresses the generation of equation numbers.     \end {itemize}     ---Britney Wiggins     \end{document}


title: Shortening margin citations in tufte class

text: How would one display just the Author and Year of the citation in the margin, while keeping the full citation in the references page? I've tried to modify a previous suggestion that would display abbreviated citations only after they had be cited once. This unfortunately didn't work -- the reference number appears instead of any citation at all: ![enter image description here](http://i.stack.imgur.com/fUWmO.png) This is what they usually look like: ![enter image description here](http://i.stack.imgur.com/yvBCV.png) As you can see it gets very busy very quickly. Some pages the margin is all citations! I've searched everywhere for this and tried editing solutions to similar requests -- alas! No luck. Any help or advice would be greatly appreciated. Thanks! Edit: Here's a minimal working example:               \documentclass[a4paper,nofonts,oneside]{tufte-book}     \usepackage{amsfonts, amsmath, amssymb}     \begin{document}     %------------------------------------------------     \subsection{Non-equilibrium Spin Mixing}          Spontaneous Magnetization!! \cite{lamport94}          Under the constraint of number and magnetization conservation, there are just two dynamical variables\cite{lamport94}: $\rho_0$, the fractional population of the $m=0$ component, and     relative phase difference $\theta (t)\equiv\theta_+ + \theta_- - 2\theta_0$. $\theta$ can     be thought of as a control for the degree of magnetization.          Under the SMA, the spin-dependent energy functional is given by\cite{lamport94}:              \begin{thebibliography}{9}          \bibitem{lamport94}       Leslie Lamport,       \emph{\LaTeX: A Document Preparation System}.       Addison Wesley, Massachusetts,       2nd Edition,       1994.          \end{thebibliography}          \end{document}


title: Color running over the doublerule separator in a table

text: I want to draw a simple colored table with 4 columns. First row is a multicolumn row which spans columns one and two. There is one doublespace between columns 2 and 3. When i apply color (blue in this case) to multicolumn 1&2 it actually crosses the doublerule separator which is not what I want. Any ideas how to solve this? Here is the code which produces the table.               \documentclass[12pt]{article}          \usepackage{colortbl}     \usepackage[margin=1in,headsep=2.5cm]{geometry}          \setlength{\textwidth}{500pt}     \setlength{\parindent}{0pt}     \setlength{\doublerulesep}{4pt}     \setlength{\extrarowheight}{3pt}          \begin{document}     \begin{tabular}     { >{\columncolor[gray]{0.8}}b{79pt}       >{\columncolor[gray]{0.8}}b{145pt}||       >{\columncolor[gray]{0.8}}b{79pt}        >{\columncolor[gray]{0.8}}b{145pt}  }     \multicolumn{2}{>{\cellcolor{blue}}l}{SOME TEXT GOES HERE}& & \\     \textbf{E-mail:} & test@example.com & \textbf{Name:} & My Name\\     \hline \hline     \textbf{Date:} & 18.3.2011 & \textbf{ID number:} & 1234567\\     \end{tabular}     \end{document}      ![result](http://i.stack.imgur.com/OLnC6.png)


title: How to disable sorting in cleveref for one instance?

text: I can disable reference sorting globally using the `nosort` or the `compress` package options, that's described in the docs. The same chapter explains how to disable compression for one instance of `\cref`. But it doesn't mention how to disable sorting for one instance. MWE:               \documentclass[12pt,a4paper]{article}     \usepackage{cleveref}          \begin{document}          \section{Foo}     \label{sec:foo}          \subsection{Bar}     \label{sec:foo.bar}          \section{Refs}     Check \cref{sec:foo.bar,sec:foo}          \end{document}      Output is "See sections 1 and 1.1", but I would like "See sections 1.1 and 1".


title: Adding weight to a font in xetex

text: My monospaced font in Xetex is Courier New, but appears too thin on screen. I can switch to the bold version, but that's too heavy. Is there is a way with Xetex and fontspec to add some weight to a font?               \setmonofont{Courier New}       % too thin     \setmonofont{Courier New Bold}  % too heavy      Thanks for any advice.


title: How to use the pullquote package on a two-column layout?

text: I've been reading about pull quotes. In this question, a great answer is posted with a link to a custom package called pullquote. I've installed this package and have been trying to make it work, as part of a document which already has two columns. Here's what I want to achieve: ![enter image description here](http://i.stack.imgur.com/BrtqP.png) Here is a MWE:               \documentclass[twocolumn]{article}     \usepackage{xunicode}     \usepackage{pullquote}     \usepackage{lipsum}     \usepackage[english]{babel}          \begin{document}          \def\addquote     {%       \Large       \begin{tabular}[b]{p{5cm}}         \textit{Wir m\"ussen wissen.}\\         \textit{Wir werden wissen.}\\         \mbox{}\hfill\large\textsc{David Hilbert}\\       \end{tabular}%     }          \lipsum          \begin{pullquote}       {         object={\addquote}       }       \lipsum[1-3]     \end{pullquote}          \lipsum          \end{document}      This gives me THREE columns wherever the pull quote appears: ![enter image description here](http://i.stack.imgur.com/LqxGp.png) I've taken code from this discussion about the issue, but can not make it work. Any idea how to implement a pull quote in a two-column layout?


title: Defining a new environment whose contents go in a TikZ node

text: I would like to define an environment which typesets the contents in a box, and I'd like to use TikZ (I'm aware of alternatives like fancybox). So I would like something like               \newenvironment{abox}%       {\begin{tikzpicture}\node(box){\begin{minipage}{0.8\textwidth}}%       {\end{minipage}};}      However, this doesn't work, because the `{...}` that wraps the TikZ node can't be split across the beginning and end of the environment. Is there anyway around this? Thanks!


title: Tikz backloop arrow

text: I created a flow chart with boxes all lined up vertically. Now I want to draw an arrow from the last box to the first box. How can I do this, so that the arrow leaves the last box horizontally on the west side and arrives at the first box horizontally on the west side? right now I get only errors or an arrow leaving horizontally but arriving vertically...


title: Rotation by a non-integer amount

text: I have to apply a very slightly rotation to an image, a rotation of less than 1º. But it looks like all the rotation commands I've found can handle only integer angles: all the non-integer measures are truncated to a whole number. Therefore, it is impossible to get a <1º rotation. I've tried to do the rotation with the `\includegraphics`, `\rotatebox` and the **rotating** package. Any advice? * * * Of course, the problem is not to rotate one image but some hundreds of them. And 1º is quite relevant in a 20x20cm image inside a perfectly square frame.


title: How to cite a University lecture (or its slides or script)

text: I need to write an introduction to a topic which relies heavily on several University lecture slides and scripts. I would like to acknowledge this by using something like this: > The following exposé is based on the lectures by \citet{A, B, C} and on > \citep{X, Y}. But the question is, how do I cite them properly? In particular, what is the right BibTeX category? Is the following the only way? I would like to use something as unspecific as `misc` as little as possible.               @misc{LectureA,       Author = {Ridcully, Mustrum},       Institution = {Unseen University},       Howpublished = {University Lecture},       Year = {2000},       Title = {An Introduction to Crossbow Hunting}     }


title: Nicer way to test that exactly one flag is set

text: I have a package that takes a long list of boolean flags (currently about 10) in its options, and I want to test if _exactly_ one of these is set to true - something like an XOR for 10+ booleans. The only way I can think of is to use the `ifthen` package and construct a gigantic statement combining `\and` and `\or` to test this, but it quickly gets real ugly, and will be incredibly hard to maintain. Is there a better way to do this?


title: labelsep in enumitem: stretch ignored

text: As the title says: `labelsep` setting in the `enumitem` package ignores the stretch part. I would be happy to have a stretch there (in the end actually the current font's interword stretch achieved by `\fontdimen2\font plus 5em minus\fontdimen4\font`). See the MWE (the value `0pt plus 400pt` is of course extreme, but it nicely shows what happes): ![enter image description here](http://i.stack.imgur.com/6Sq9N.png)               \documentclass{article}          \usepackage[textwidth=4cm,textheight=5cm]{geometry}     \usepackage{showframe}          \usepackage{enumitem}          \newskip\mydescskip     \mydescskip0pt plus 400pt          % TRY EITHER ONE OF THESE TWO OPTIONS     \setlist[description]{labelsep=\mydescskip, leftmargin=0pt}     %\setlist[description]{labelsep=0pt plus 400pt, leftmargin=0pt}          \begin{document}          \texttt{REAL OUTPUT:}          \begin{description}     \item[X]     AAA\hspace{\mydescskip}BBB xxxxxxxxxxxxxxxx     \end{description}          \texttt{DESIRED OUTPUT:}          \noindent\textbf{X}\hspace{\mydescskip}%     AAA\hspace{\mydescskip}BBB xxxxxxxxxxxxxxxx          \end{document}      Since it is a part of a class, the solution must be as clean as possible (and surely mustn't require any change in UI).


title: Asana Math Oversized "Big operators"

text: I am having this problem when using Asana Math with XeLaTeX + unicode-math, if you see the pdf found in the download link AsanaProb.zip you can see that `\bigcap` produces much bigger character than it should: ![alt text](http://i.stack.imgur.com/pQsvv.png) Is it a syntax problem or maybe something else? The document compiled on a linux machine with texlive 2010 if that helps...


title: ultrafast pdflatex with precompiling

text: I try to improve the time pdflatex needs to compile my book. # Really working example ### book.tex               %&preamble     \begin{document}     Hi     \end{document}      and ### preamble.tex               \documentclass{article}      I run the following commands on bash console:               $ pdflatex -ini -jobname="preamble" "&pdflatex preamble.tex\dump"     $ latexmk -pdf -pvc -e '$latex=q/latex %O -shell-escape %S/' book.tex      A window opens with a (nearly) live preview that will be updated after each change in the `book.tex` file. The PDF Viewer `evince` reloads automatic when the `.pdf` changed. # Open Questions **I had no success to compile with the preamble of my book** in the `preamble.tex` file.   * How can I find out what I can precompile?    * Can I precompile `\newcommand`'s, `\usepackage`'s?    * Can I precompile a pure chapter without header? # Other aproaches for speed up (I do not understand how to combine this ideas for best result)   * `pdflatex` knows a `-draftmode` I measured 20% faster compilation with `time pdflatex -draftmode 50pagetest.tex`


title: Oldstyle numbers with Charter font

text: I'm using the Charter font using the following package:               \usepackage[charter]{mathdesign}      I want to have oldstyle (lowercase) numbers in conjunction with this package. I've seen this question but it refers to CM and palatino only. Any way of getting oldstyle numbering (throughout the document) with Charter font?


title: In TeXShop, is there a directive to select biber or BibTeX on a per-document basis?

text: As in the title, I'd like to be able to select whether TeXShop uses biber or BibTeX in the document rather than using the command line or changing the default in the TeXShop preferences. For TeX engines this is easy; i.e. you can put the following somewhere near the top of your TeX file               % !TEX TS-program = pdflatex      to tell TeXShop to compile with pdflatex, regardless of the default in the preferences. Does such a directive exist for bibliography passers? I want to be able to hit `⇧`+`⌘`+`B` for this. Latexmk provides the ability to do this, but I want to do compilations manually. ## Final note The solution involved a shell script. I've made this available on GitHub, so please feel free to use and improve it.


title: Visually highlighting symbolic material

text: I have a diagram in which I need to indicate the difference between symbolic mathematics and English words (potentially to someone who doesn't know about it): ![enter image description here](http://i.stack.imgur.com/nnBY1.png) Colour works beautifully for making this distinction. Unfortunately, for the version that is going to go in a book, I can't use colour and have been told not to use greyscale (which was my first fallback). I've tried bold, but it looks pretty horrible and doesn't highlight the distinction terribly well: ![enter image description here](http://i.stack.imgur.com/c4C6z.png) (Also bold is bad because sometimes it has mathematical significance.) Underlining just looks really horrible: ![enter image description here](http://i.stack.imgur.com/OY0Gy.png) I would be _very_ grateful for any alternative suggestions on how to visually highlight symbolic material. Source in case it's useful:               \documentclass{article}     \usepackage{xcolor}     \usepackage{framed}     \begin{document}          \definecolor{textual-colour}{rgb}{0,0,0}     \definecolor{symbolic-colour}{rgb}{0.2,0.2,0.9}     \newcommand{\marktextual}[1]{{\color{textual-colour}#1}}     \newcommand{\marksymbolic}[1]{{\color{symbolic-colour}#1}}          \begin{framed}     \marktextual{{If}  \marksymbolic{$K \leq G$} {and} {there} {are} {inclusions} \marksymbolic{$gKg^{-1}\leq K$}  {for} {every} \marksymbolic{$g\in G$}, {then} \marksymbolic{$K \triangleleft G$}: {replacing} \marksymbolic{$g$} {by} \marksymbolic{$g^{-1}$}, {we} {have} {the} {inclusion} \marksymbolic{$g^{-1}Kg\leq K$}, {and} {this} {gives} {the} {reverse} {inclusion} \marksymbolic{$K\leq gKg^{-1}$}.}     \smallskip          \marktextual{{The} {kernel} \marksymbolic{$K$} {of} {a} {homomorphism} \marksymbolic{$f:G\rightarrow H$} {is} {a} {normal}  {subgroup}: {if} \marksymbolic{$a\in K$}, {then} \marksymbolic{$f(a)=1$}; {if} \marksymbolic{$g\in G$}, {then} \marksymbolic{$f(gag^{-1}) = f(g)f(a)f(g^{-1}) =  f(g)f(g^{-1}) = 1$}, {and} {so} \marksymbolic{$gag^{-1}\in K$}. {Hence}, \marksymbolic{$gKg^{-1}\leq K$}  {for} {all} \marksymbolic{$g\in G$}, {and} {so} \marksymbolic{$K \triangleleft G$}. {Conversely}, {we} {shall} {see} {later} {that} {every} {normal} {subgroup} {is} {the} {kernel} {of} {some} {homomorphism}.}     \end{framed}\end{document}      **Edit:** while I was trying to keep this short, from the comments it looks like a little more explanation of the context is necessary. The text of the book says: "At first sight, the most striking feature of mathematical language is the way in which it mixes material that looks as if it is drawn from a natural language with material built up out of idiosyncratically mathematical symbols. The distinction is illustrated in Figure 2.1." Figure 2.1 looks like this: ![enter image description here](http://i.stack.imgur.com/fnQc3.png)


title: Vertical lines in a multirow and multicolumn table

text: I am trying to finish this table scheme but I can't figure out what I am doing wrong. I want to convert those discontinued lines into continuous lines and I want to center the label "Total" between the 2 first columns.               \documentclass[a4paper]{article}          \usepackage{longtable}     \usepackage{rotating}     \usepackage{array}     \usepackage{multicol}     \usepackage{multirow}          \begin{document}          \begin{longtable}[c]{ccc|c|c|c|c|}     \cline{4-7}     & & & \multicolumn{4}{c|}{Var Y} \\      \cline{4-7}     & & &      \begin{sideways} Cat Y1 \end{sideways} &      \begin{sideways} Cat Y2 \end{sideways} &      \begin{sideways} Cat Y3 \end{sideways} &      \begin{sideways} Cat Y4 \end{sideways} \\      \hline \multirow{6}{*}{\begin{sideways}Var X\end{sideways}} &        \multicolumn{1}{|c}{\multirow{2}{*}{Cat X1}} &     \multicolumn{1}{c|}{N} & 4 &  &  &  \\     \multicolumn{1}{|c}{}        &                &       \multicolumn{1}{c|}{\%} & 100.00\% &  &  & \\     \cline{2-7} &     \multicolumn{1}{|c}{\multirow{2}{*}{Cat X2}} &     \multicolumn{1}{c|}{N} &  & 7 & 3 &    \\     \multicolumn{1}{|c}{}        &                &       \multicolumn{1}{c|}{\%}&  & 70.00\% & 30.00\% &  \\     \cline{2-7} &     \multicolumn{1}{|c}{\multirow{2}{*}{Cat X3}} &     \multicolumn{1}{c|}{N} &  & 25 &  & 10 \\     \multicolumn{1}{|c}{}        &                &       \multicolumn{1}{c|}{\%}&  & 71.43\% &  & 28.57\% \\     \hline &     \multicolumn{1}{c}{\multirow{2}{*}{Total}} &     %\multicolumn{1}{|c}{\multirow{2}{*}{\multicolumn{2}{c}{Total} }} &     \multicolumn{1}{c|}{N} & 4 & 23 & 3 & 10    \\     \multicolumn{1}{|c}{}        &                &       \multicolumn{1}{c|}{\%}& 10.00\% & 57.50\% & 7.50\% & 2.50\% \\     \hline     \end{longtable}           \end{document}      The table output looks like this: ![enter image description here](http://i.stack.imgur.com/qxtX0.png) Thank you very much for your help!


title: Putting a coloured background behind text without adding whitespace

text: Consider this: ![enter image description here](http://i.stack.imgur.com/5yVp4.png) I want to be able to highlight text like this _without_ adding space around it -- so each word in the first line should line up with the corresponding word in the second line. (I know that I may have to fiddle with the size of the highlighting to stop it overflowing onto other words.) That example was generated with PSTricks, although I'd much prefer a tikz solution.               \documentclass[a4paper]{article}       \usepackage{color}     \usepackage{pstricks}     \newrgbcolor{vlgray}{0.87 0.87 0.87}     \newcommand{\highlight}[1]{\psframebox[linearc=1.4mm,cornersize=absolute,fillcolor=vlgray, fillstyle=solid,linecolor=white]{#1}}     \begin{document}     Lorem ipsum \highlight{dolor} sit amet, \highlight{consectetuer} adipiscing elit, sed diam           Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam      \end{document}      Edit: also see the answer at http://tex.stackexchange.com/a/89145/17049 , which I particularly like because it fits the highlighting around the text more tightly than the answers below (or my example above).


title: LaTeX equivalent to R's `help foo`?

text: From the R command line I can do `help foo` -- where `foo` is some R command-- and return a `.html` help file on `foo`. This holds even if `foo` is from some non-standard library I just loaded. Q: What's the closest process to this in LaTeX? Here I was helped and found that `mthelp` (`texdoc` on TeXLive systems) can return help files for packages, document classes, and commands. But missing were LaTeX macros (e.g. `\section`) Q: What's the quickest/best way to get full documentation on standard latex commands (e.g., `\section`) or commands from packages that need to be loaded (e.g., `\mathcal` from amsfonts) Until now, I've either been (1) hunting through Kopka and Daly, (2) using _Help_ -> _Keyword Search_ in WinEdt (returns _LaTeX2e Help_ , which is only helpful for very standard LaTeX macros (e.g., `\section`). Even then, the documentation is very limited), (3) standard Google and forum searches, or (4) using manuals (sometimes struggling with `mthelp` to find the manual for the appropriate package containing the macro of interest) Maybe I'm spoiled by R, but this process is terribly inefficient. I must be doing something wrong...right?


title: Citations not working using bibtex

text: I often use your site and I find it incredibly helpful... and now I have a question that I can't seem to find an answer to! I hope someone can help. I am trying to get my bibtex file to work. It has work previously so I am not too sure why it no longer works. I have managed to strip the problem right down to this;               \documentclass{article}     \usepackage{natbib}          \begin{document}     Let us cite \citep{Middleton_etal_1993}.          \bibliographystyle{authordate1}     \bibliography{bibtestagain}     \end{document}      My bibtex file has a single entry;               % This file was created with JabRef 2.7b.     % Encoding: ISO8859_1          @ARTICLE{Middleton_etal_1993,       author = {Middleton, M. and Dentith, M. and Wilde, S. and Face, F.},       title = {Rocks n shit},       journaltitle = {Journal Poop International},       year = {1993},       owner = {thoskin},       timestamp = {2014.06.24}     }          @comment{jabref-meta: selector_publisher:}          @comment{jabref-meta: selector_author:}          @comment{jabref-meta: selector_journal:}          @comment{jabref-meta: selector_keywords:}      when I compile (Latex,Bibtex,Latex,Latex) the above using texmaker I keep getting the warning; Package natbib Warning: Citation `Middleton_etal_1993' on page 1 undefined on i nput line 5. (./test.bbl) Package natbib Warning: There were undefined citations. [1 and all (in this case, my one) citation just has a question mark. Cheers


title: Environment for text to run into margins

text: After posting this closed question, I found a good solution for memoir on this page. However, my margins settings are different then the ones he uses, and as a result, the `widematter` environment only works correctly on odd-numbered pages; on even-numbered pages, the widematter has the text run off to the wrong side, and it even goes off the page. Is there an easy way to debug this? UPDATE: Using @daleif's suggestion, I have the following MWE:                   \documentclass[11pt,a4paper]{memoir}          \setstocksize{297mm}{210mm}     \settrimmedsize{\stockheight}{195mm}{*}     \settypeblocksize{671.6pt}{335.8pt}{*}     %\settypeblocksize{675pt}{337.5pt}{*}     %\settypeblocksize{*}{28pc}{2}     \setlrmargins{*}{*}{4}     \setulmargins{*}{*}{2}     \setmarginnotes{5mm}{45.23mm}{\onelineskip}     \setlength{\footskip}{3.0\baselineskip}     \setlength{\headwidth}{\dimexpr\textwidth+\marginparsep+1.0\marginparwidth\relax}     \checkandfixthelayout          \newlength{\extrawidth}     \setlength{\extrawidth}{\marginparsep}     \addtolength{\extrawidth}{\marginparwidth}          \marginparmargin{outer}     \strictpagechecktrue     \newenvironment{widematter}{     \begin{adjustwidth*}{0mm}{-\extrawidth}     \mpjustification}     {\end{adjustwidth*}}          \begin{document}     Here is some regular text that goes all the way to the margin and wraps around on the next line.     \begin{widematter}     Here is a test of the widematter environment, to see if the text is able to extend beyond the margin.     \end{widematter}     \end{document}      But this still doesn't work for even-numbered pages--the `widematter` text extends into the right margin, when it should be extending into the left margin... (Also, is there any way to insert a page break into this MWE so that I can demonstrate the extra width on even-numbered pages?) ANOTHER UPDATE: Using Marco Daniel's `fullwidth` package, I have the following MWE:               \documentclass[11pt,a4paper]{memoir}          \setstocksize{297mm}{210mm}     \settrimmedsize{\stockheight}{195mm}{*}     \settypeblocksize{671.6pt}{335.8pt}{*}     %\settypeblocksize{675pt}{337.5pt}{*}     %\settypeblocksize{*}{28pc}{2}     \setlrmargins{*}{*}{4}     \setulmargins{*}{*}{2}     \setmarginnotes{5mm}{45.23mm}{\onelineskip}     \setlength{\footskip}{3.0\baselineskip}     \setlength{\headwidth}{\dimexpr\textwidth+\marginparsep+1.0\marginparwidth\relax}     \checkandfixthelayout          \usepackage[innermargin=-2.0cm,]{fullwidth}          \begin{document}          Testing some regular text that goes on past the first line, and then repeats.     Testing some regular text that goes on past the first line, and then repeats.     Testing some regular text that goes on past the first line, and then repeats.          \begin{fullwidth}[width=\linewidth+2cm]          Testing some regular text that goes on past the first line, and then repeats.     Testing some regular text that goes on past the first line, and then repeats.     Testing some regular text that goes on past the first line, and then repeats.          \end{fullwidth}          \end{document}      The first time it compiles, there are warnings about undefined references, but the `fullwidth` text extends past the margin on the right, which looks good. The second time it compiles, the warnings disappear, but now the text extends past the margin on the left (the wrong side)... To clarify: for odd-numbered pages, the margin on the left represents necessary space for binding, whereas the margin on the right is just extra space (and visa-versa for even-numbered pages). With these settings, fullwidth is making the text extend into the binding margin, which is bad--I only want it to extend into the non-binding margin. I tried changing the code to have `\usepackage[innermargin=0cm,]{fullwidth}` and `\begin{fullwidth}[width=\linewidth-2cm]`, but that only seems to work for odd-numbered pages--even-numbered pages still have fullwidth text go into the binding margin


title: Display text as tooltip with pdfcomment - how to ignore complex formatting commands?

text: I have a large document which has to be edited "heavily", so there is a lot of text content which has to be removed for the final version, but I would like to keep it in sight during editing also in the PDF. So generally said I have to replace e. g. a large paragraph with one or two short sentences and I'd like to still be able to see the original version in the PDF. I tried to do that with the `pdfcomment` package and the `pdftooltip` command, as it does not consume significant space on the page (it is important for me to see how the final document will look) and in general that works well with simple text, but if there is more complex formatting (e. g. an environment), I get error messages. I tried to build a minimal example:               \documentclass{scrbook}     \usepackage{color, url}     \usepackage[latin1]{inputenc}     \usepackage[ngerman]{babel}          \usepackage{pdfcomment}     \newcommand{\weg}[1]{\pdftooltip{\textcolor{red}{\bfseries{}W}}{#1}}          \newcommand{\mycommand}[1]{abc--#1--def}               \begin{document}          test of my command: \mycommand{helloworld}          This is my example text. Here comes the tooltip: \weg{This is the tooltip text. \cite{Author2011} \mycommand{helloworld} $y_1 = x^3 +1$  }          here it fails: \weg{\begin{center} centered text \end{center}}           \end{document}      The custom command `\mycommand` which outputs only "text" does not pose a problem, the `\cite` commands seem to be more problematic, an equation gets "simplified" and some commands just fail. my questions:   * how could I change my command `\weg{}` to print all the latex source code verbatim in the tooltip   * which type of LaTeX code will likely cause problems with the tooltip?


title: Aligning equations in multiple places

text: I have an `equation` environment where most equation lines start with an arrow, which I have aligned in the `align*` environment, using `&`. The second line in the example below is too long for the page and so I have split over two lines. Here I would like to align the start of the equations with each other rather than with the start of the arrows. I have tried using multiple `&` signs (and also experimented with the `alignat*` environment) but I cannot find a solution to this. A MWE is below.               \documentclass{article}     \usepackage{mathtools}     \usepackage{amsmath,bm}     \usepackage{amstext}          \begin{document}     \begin{align*}     &\xrightarrow{\frac{\pi}{2} \hat{I}_{\frac{\pi}{4}}} -\cos (\Omega_S t_1) \sin ^2 (\pi J_{IS} \tau) \cos (\Omega_I t_2) \cos (\frac{\pi}{4}) \hat{I}_z \\     &\xrightarrow{\frac{\pi}{2} \hat{S}_x } & - \frac{1}{\sqrt{2}} \cos (\Omega_{S_1} t_1) \sin ^2 (\pi J_{IS} \tau) \cos (\Omega_{I_1} t_2) (1-R_z \tau_{mix}) \hat{I}_z\\      & {} & -\frac{1}{\sqrt{2}} \cos (\Omega_{S_1} t_1) \sin ^2 (\pi J_{IS} \tau) \cos (\Omega_{I_2} t_2) (\sigma_{12} \tau_{mix}) \hat{I}_z\\     &\xrightarrow{\frac{\pi}{2} \hat{I}_x} \frac{1}{\sqrt{2}} \cos (\Omega_S t_1) \sin ^2 (\pi J_{IS} \tau) \cos (\Omega _I t_2) \hat{I}_y \\     &A = \frac{1}{\sqrt{2}} \cos (\Omega_S t_1) \sin ^2 (\pi J_{IS} \tau)  \cos (\Omega _I t_2)\\     \end{align*}     \end{document}      where I would like to achieve the following effect: --> equation... --> equation.... .......equation continued (aligned with start of equation on previous line- I'm using dots here to avoid this line being converted into an equation) A=equation (start of this line aligned with arrows above) --> equation.. etc. At the moment, the equations in lines 2 and 3 of the align environment of the MWE get shifted to the right, to the end of all the equations and hence disappear off the page.


title: Crossed hierarchy

text: I appreciate it if you let me know the most elegant way to draw a crossed hierarchy such as the followings:                   X        /\       Y  Z       /\/\      p q  t      q has two parents Y and Z.