title: Font encoding in LaTeX

text: I've been using LaTeX for a while and I've read a lot of discussion about fonts encodings. Some suggest to use T1 fonts adding `\usepackage[T1]{fontenc}`, other suggest to add nothing, other suggest to use `T1` in addition to the package `ae` while others say this is deprecated and another font should be used instead ... I'm very confused, is there some updated resource that explains the issue well and settles the matter? In my experience adding nothing works fine but sometimes i need additional character sets such as bold small caps, in this case I can use the T1 encoding but the quality is poor. Everything seems to be fixed if I use the `ae` or the `lmodern` packages. What's really happening and what should I really do? PS: I'm sorry if this has been asked before, I've found a lot of discussion about this but I'm posting in the hope to get a definitive answer. PPS: Currently I'm using `latex` + `dvips` + `ps2pdf`. I prefer to use `pdflatex` if I can but, as I work with other, this is not always possible.


title: Second align within first align environment with equation numbers

text: ![enter image description here](http://i.stack.imgur.com/CaQqN.jpg) Is it possible to align the for statements here, without dropping the equation numbers? `\hfill` and `&&` mess up the placement of the equation numbers for me. Edit: Picture of what I get after I tried what was posted as answer ![enter image description here](http://i.stack.imgur.com/lWq8a.jpg)


title: Convert PSTricks to TikZ

text: I use pstricks for all my graphics. Now I am submitting a paper to a conference which, unfortunately, does not allow to use PostScript. I have to send them tex source, which _they_ compile with pdflatex. So, pstricks might not work (I am almost sure they won't apply the solutions here: How to use PSTricks in pdfLaTeX?). The only solution I found was to convert PStricks to TikZ. Is there an automatic converter for this task?


title: Why does the compiler say abstract environment not defined?

text: \documentclass [10pt,a4paper]{report}     \usepackage [utf8]{inputenc}     \usepackage{amsmath}     \usepackage{amsfonts}     \usepackage{amssymb}     \usepackage{graphicx}     \usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}     \begin{document}          \begin{Abstract}     text here     \end{Abstract}          \end{document}


title: Defaulting to clever references

text: I would like to redefine `\ref` to behave like `\cref` while still allowing `\ref*` to be used for the standard behavior of `\ref`. Here is my attempt to achieve this; I would like to use the commented lines instead of the uncommented lines, but unfortunately I get an error. My reference for creating starred commands was the following: http://www.tex.ac.uk/cgi- bin/texfaq2html?label=cmdstar               \documentclass{article}         \usepackage{cleveref}              \let\oldref\ref         \renewcommand{\ref}{%             \makeatletter                 \@ifstar                     \oldref%                     \cref%             \makeatother         }          \begin{document}          \begin{equation}         \label{eqn:2.2.4}         2 + 2 = 4     \end{equation}          \oldref{eqn:2.2.4}          \cref{eqn:2.2.4}          % \ref{eqn:2.2.4}          % \ref*{eqn:2.2.4}          \end{document}


title: algorithm2e single-line control structures

text: I am using `algorithm2e` for formatting pseudo-code: is it possible to compress single-instructions control structure to one single line? For example I would like to modify this so that `l.sort()` appears on the same line as `foreach`:               \begin{algorithm}[htb]       \ForEach{$l \in list\_of\_lists$}{  $l.sort()$\;  }       \caption{...}       \label{...}     \end{algorithm}      Thanks in advance


title: Error using hyperxmp package

text: I'm trying to create xmp metadata using `hyperxmp` package. After having read the documentation I add in my preample this:               \usepackage{hyperxmp}     \usepackage{hyperref}     \hypersetup{% Configurazione del pacchetto hyperref         pdfpagemode={UseOutlines},         bookmarksopen,         pdfstartview={FitH},         pdftitle={},         pdfauthor={},%         pdfauthortitle={},%         pdfsubject={Tesi di laurea},         pdfkeywords={},         pdfcopyright={},         pdflicenseurl={http://creativecommons.org/licenses/by-nc-nd/2.5/it/},         pdfcaptionwriter={},         pdfcontactaddress={},         pdfcontactcity=Lentini (SR)},         pdfcontactpostcode={},         pdfcontactcountry={,         pdfcontactphone={},         pdfcontactemail={},         pdfcontacturl={},         pdflang={it},         colorlinks=true,         breaklinks,         linkcolor={blue},         citecolor={red},         urlcolor={blue}     }      The field obviously are blank because there are personal information. Anyway when I compile I got this error:               Package kvsetkeys Error: Undefined key `pdfcontactaddress' }     Package kvsetkeys Error: Undefined key `pdfcontactcity' }     Package kvsetkeys Error: Undefined key `pdfcontactpostcode' }     Package kvsetkeys Error: Undefined key `pdfcontactcountry' }     Package kvsetkeys Error: Undefined key `pdfcontactphone' }     Package kvsetkeys Error: Undefined key `pdfcontactemail' }     Package kvsetkeys Error: Undefined key `pdfcontacturl' }


How can I replace footnotes for non-floating marginal notes? I have tried to replace my footnotes for sidenotes with `footmisc` package's `side` option, but they continue to be floats, like every `\marginpar`. I don't want them to float around an anchor: I want these marginal notes flowing from the top of the page to the bottom, and with the capacity of being splitted between pages when needed (because some of them might be too long, or there might be too many of them).


title: margin caption and subfloat

text: I'm desperately trying to get a workable setup of margin caption and subfloats. I use mcaption for margin caption which provides an environment which one wraps the inner content of the float in. However, it seems to mess up labels so that I can't refer to figures. The following example illustrates the problem:               \documentclass{scrartcl}     \usepackage{subcaption}     \usepackage{mcaption}     \begin{document}          \begin{figure}     \begin{margincap}       \begin{subfigure}[b]{.5\linewidth}         \centering\large A         \caption{A subfigure}\label{fig:1a}       \end{subfigure}%       \begin{subfigure}[b]{.5\linewidth}         \centering\large B         \caption{Another subfigure}\label{fig:1b}       \end{subfigure}       \caption{A figure}\label{fig:1}     \end{margincap}     \end{figure}          \ref{fig:1b}     \end{document}      Here's a figure of of the output [`??` is the unsuccessful `\ref` ]. ![illustration](http://i.stack.imgur.com/r1ncT.png) I would appreciate any hints on how to get margin captions and some kind of sub-figures (e.g. subfig/subcaption) Thanks, Edit, here's an example where I can't get it to to the outer margin:               \documentclass[twoside]{scrartcl}     \usepackage{scrpage2}          \usepackage{subcaption}     \usepackage{floatrow}     \ohead{outer}     \ihead{inner}     \captionsetup[capbesidefigure]{format=plain}     \floatsetup[figure]{margins=hangoutside,capposition=beside,     capbesideposition={top,right},floatwidth=\textwidth,capbesidewidth=1\marginparwidth}     \pagestyle{scrheadings}     \begin{document}     \begin{figure}     \begin{subfigure}[b]{.5\linewidth}     \centering\large A     \caption{A subfigure}\label{fig:1a}     \end{subfigure}%     \begin{subfigure}[b]{.5\linewidth}     \centering\large B     \caption{Another subfigure}\label{fig:1b}     \end{subfigure}     \caption{A test figure}\label{fig:1}     \end{figure}     \newpage~\newpage     {     \begin{figure}     \begin{subfigure}[b]{.5\linewidth}     \centering\large A     \caption{A subfigure}\label{fig:1a}     \end{subfigure}%     \begin{subfigure}[b]{.5\linewidth}     \centering\large B     \caption{Another subfigure}\label{fig:1b}     \end{subfigure}     \caption{A test figure}\label{fig:1}     \end{figure}     }          \ref{fig:1b}          \end{document}


title: How to disable 'totpages' anchor link created by 'hyperref'?

text: I've been searching like hell for this, trying to hack the `totpages` and/or the `hyperref` packages but to no avail... The `totpages` package automatically creates link on every reference to the total number of pages in a document. I'm doing my CV with the `europecv` package and this places a `Page X / TOTAL` on the footer of every page and the `totpages` package automatically creates a link (if `hyperref` is also being used) on `TOTAL` always linking to the last page. This seems a bit pointless to me. So far I've "disabled" this by setting the border color to white, the link still works, there's just no visual indication that it's a link. But this is not acceptable because this does not allow me to have visual indications on internal links I manually create. I also tried `\usepackage[anchorpages=false]{hyperref}`, it seems to be the option to disable such linking, but it doesn't work. Any other solution?


title: Remove blank page before chapter in book class

text: I know it might be duplicate, but I can't comment on already answered questions, so that's why I am reposting. I tried `openany` and `twoside` in my document class options but still chapters start at odd pages numbers. Also the page numbers are like this: odd numbers on the right and even on the left (which is logical if you have twosided pages). How can I remove the blank page and how to decide on my own where the page number goes? I try `oneside` but it's still the same. As for my environment, I use XeLaTeX because of Greek and Texmaker. I am probably on TeX Live since I use Ubuntu 12.04 and I think it's TeX Live 2009.


title: Reproducing a 3dplot example from texample.net using pgfplots: drawing angles with pgfplots in 3d

text: I am trying to reproduce the 3dplots example from www.texample.net using pgfplots: ![enter image description here](http://i.stack.imgur.com/6GAbv.png) So far, I did not come far at all, actually. One problem is that pgfplots does not allow to work in spherical coordinates, so I have to express everything in cartesian coords. The other problem is that pgfplots does not provide an easy way to draw arcs like 3dplots does with `\tdplotdrawarc` so that showing the angle between the vector and the z-axis (\theta) or the angle between the vector and the x-y-plane (\phi) proves difficult. I could imagine doing the latter by drawing a circle in the x-y-plane, but I don't know how to draw a circle in the plane described by the vector and the z-axis. Any ideas how to tackle this?               \documentclass{standalone}          \usepackage{tikz}     \usetikzlibrary{arrows}     \usepackage{pgfplots}          \begin{document}          \pgfmathsetmacro{\rvec}{.8}     \pgfmathsetmacro{\thetavec}{30}     \pgfmathsetmacro{\phivec}{60}          \begin{tikzpicture}         \begin{axis}[             view={115}{30},             axis lines=center,     %        xlabel=$e^1$,% Horribly misplaced label     %        ylabel=$e^2$,% Makes the entire plot break when used with xlabel             z post scale=1.5             ]              \addplot3[-stealth',domain=0:4] ({x*sin(\thetavec)*cos(\phivec)},%                    {x*sin(\thetavec)*sin(\phivec)},%                    {x*cos(\thetavec)});         \end{axis}     \end{tikzpicture}          \end{document}


title: Draw a horizonal line over the entries of a row in an array

text: How to draw a horizonal line across a row (over the entries) in an array?


title: Wrong space with \footnotemark

text: I am using `\footnotemark`, but the space after the mark is smaller than the space I obtain when I use regular `\footnote`. How can I obtain the usual space after `\footnote`? See example below.               \documentclass{report}     \begin{document}          Phrase. Standard without footnote.          Phrase.\footnote{foot1}     With footnote.          Phrase.\footnotemark\ %     Smaller with footnotemark;     how can I correct it?     \footnotetext{foot2}          Phrase.\footnotemark     Definitively wrong.     \footnotetext{foot3}          \end{document}      Edit: Thanks for all the answers. I will accept the first one, and vote the rest.


title: Removing prepended 0. from Chapters with memoir

text: ![enter image description here](http://i.stack.imgur.com/ZzqdY.png) I compiled a memoir document that has "0." prepended with Contents. How can I remove it?               \documentclass[12pt,oneside]{memoir}          \title{Document}     \author{prosseek}          % http://tex.stackexchange.com/questions/97465/modify-default-memoir-chapter-style     \makeatletter     \newcommand{\fonttitle}{\chaptitlefont}     \makechapterstyle{mystyle}{%     \def\chapterheadstart{\vspace*{\beforechapskip}}     \def\printchaptername{}     \def\printchapternum{}     \def\printchapternonum{}     \def\printchaptertitle##1{\fonttitle \space \fonttitle \thechapter.\space \fonttitle ##1}     \def\afterchaptertitle{\par\nobreak\vskip \afterchapskip}     }     \makeatother          \chapterstyle{mystyle}          \begin{document}          \maketitle     \tableofcontents          \chapter{The Domain Problem and Stakeholders}     \section{First}     abcdef.           \end{document}


title: How to set rightmark after \section command?

text: I need to typset a book with very long section names. The long names should appear in the normal text and in the ToC but not in the header, so I can’t use the optional argument. `\sectionmark` is my fried but only for the page after the `\section` started because the first marking command on a page wins the place in the header. Is it possible to set the header of the current page even after a `\section` set a header already?               \documentclass{book}          \usepackage{lipsum}          \begin{document}         \chapter{Test}         \lipsum         \section{A Section}         \lipsum[3-5]         \section{A very long section title, which doesn't                  fit in the header because it's extremly long}         \sectionmark{Short title}         \lipsum[1-14]     \end{document}      The example is very minimalistic. The template I must use uses `fancyhdr` to change the layout. * * * I found this answer but it works only for chaperts because they always happen to be on a right page and so `\chaptermark` gives the desired result on the next left page. * * * ## Follow up question to my answer Is ist possible to make a (Perl or whatever running on Mac OS X) script that converts               \section{long text}     \sectionmark{short text}      to               \section[long text]{long text\sectionmark{short text}}      or alternatively to               \section{long text}[short text]      I can’t ensure that there are no line breaks in the `long text` or if there is a break between `\section` and `\sectionmark`. I asked the follow up question again here on StackOverflow.


title: How to change the numbering style for enumeration and sub-enumeration

text: I wanted to use the `enumerate` environment. I am using this code:               \begin{enumerate}         \item To define the outliers and events.                 \begin{enumerate}                             \item How can events be defined?                 \end{enumerate}         \item To detect an event.         \item To characterize an event.         \item To evaluate the detected outliers and events.     \end{enumerate}      result:   1. To define the outliers and events. (a) How can events be defined?   2. To detect an event.   3. To characterize an event.   4. To evaluate the detected outliers and events. I wanted to replace the sub numbering of alphabet with numbers. Expected results:   1. To define the outliers and events. 1.1 How can events be defined?   2. To detect an event.   3. To characterize an event.   4. To evaluate the detected outliers and events.


title: How to achieve a perspective where two axes of a 3D scene coincide with the x and y axes of the 2D projection?

text: ![axes sketch](http://i.stack.imgur.com/r6We0.png) How should the corresponding camera line look like?               currentprojection = orthographic(camera=(x,y,z),up=Y,target=O);      In particular, I need a formula for the triple (x,y,z) depending on the angle between the x and y axes.


title: Adjusting automatically the heigth of a single column table containing only text

text: I am new to Latex, trying to using it to prepare a first laboratory test report. I have found a way to mimic the layout of front page of the existing document using a series of stacked tables as shown below. However I could not find a way to automatically adjust the height of the last (bottom) table to the text contained in it. (ie filling the table with empty lines, in such a way that the bottom of the frame would be always at the same place, regardless of the amount of text in the conclusion. Any idea? or another approach to make the layout ?Thanks.               \documentclass[draft, a4paper, 11pt, english]{report} % Mode draft     \usepackage[utf8]{inputenc} % UTF-8 encoding for code editing     \usepackage[T1]{fontenc}     \usepackage{tgheros}% Fonts     \usepackage{fancyhdr}% Handling headers and footers      \usepackage[top=3cm, bottom=3cm, left=2cm, right=2 cm]{geometry} %     \usepackage{array}     \usepackage{tabularx}     \usepackage{colortbl,hhline}     \usepackage{xcolor}     \usepackage{ifthen} % Use of tests     \usepackage{lastpage} % Handling last page numbering      \usepackage{lipsum} %only for tests           % [DEFINITION OF GLOBAL CONFIGURATION AND VARIABLES  ]-------------------------------------     \def\MaxTableWidth{0.8\textwidth}     \definecolor{Color_logo}{RGB}{0, 115, 174} %setting color for logo     \renewcommand{\familydefault}{\sfdefault}%selecting default font (clone of helvetica)   %-------------------------------------------------------------------------     \begin{document}     \thispagestyle{fancy} % enabling special header and footer capability     \fancyhf{} %[cancelling default headers, not suitable for front page]     \renewcommand{\footskip}{1cm} % [distance of footer to bottom]     \setlength{\headheight}{0 pt} %% setting heigth of document header          %--[BEGIN ARGUMENTS FOR FRONT PAGE]---------------     \def\PVnumber {XXXXX} % Setting variable name for document number     \def\CustomerName {Best Customer}      \def\Restricted{Y} %Y     \def\ProductFileNumber {XXXXX}      \def\Date{\today}     \def\Products{Machinery}      \def\PartNumbers{ABCDEF-2, XYZ-2}     \def\TestRequestor{The Requester}     \def\TestPerformer{Test Engineer}     \def\Specification{127-11487 rev 07}     \def\Approver{}     \def\Conclusions{\lipsum[2]}%     %--[END ARGUMENTS FOR FRONT PAGE]---------------     %--------------------------------------------------------------------     %HEADER AND FOOTER FOR PAGE 1 -------------------     \renewcommand{\headrulewidth}{0 pt} %   %  [thickness header line]     \renewcommand{\headwidth}{\linewidth}%  [horizontal length header line]     \renewcommand{\headsep}{0cm}  %  [distance header-main text]      \renewcommand{\footrulewidth}{1 pt} %  [thickness footer line]     \renewcommand{\footskip}{2.5cm}     \lfoot{\footnotesize\textsl{\copyright \ 2011 by MyCompany INC.  All rights reserved. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording, or by any information storage or retrieval system, without permission in writing from MyCompany INC.}}     %  [END OF HEADER AND FOOTER FOR PAGE 1] -------     %-----------------------------------------------------------------   -----     %% [PAGE 1 (MADE OF SEVERAL SMALL TABLES)]  -------     \large\noindent\flushleft     \begin{tabularx}{\textwidth}{|m{11.5cm}|X|}     \hline\smallskip      \large\centering\textit{\textbf{\textcolor{Color_logo}{BEST TEST LABORATORY}}}&\cellcolor{lightgray}\Large\textbf\ {TEST REPORT}\\     \centering\textbf{NEW YORK}&\cellcolor{lightgray}\ifthenelse{\equal{Y}{\Restricted}}{Restricted to:\\ &\cellcolor{lightgray}\CustomerName}{}\\     \end {tabularx}     \noindent              \begin{tabularx}{\textwidth}{|p{8cm}|p{4.5cm}|X|}      \hline       \textbf{Customer:} \CustomerName&Product file: \ProductFileNumber& \textbf {PV\ \PVnumber}\\ &&Page\ \thepage / \pageref{LastPage}\\        \hline     \end{tabularx}     \begin{tabularx}{\textwidth}{|p{9.5cm}|X|}     \textbf{Product :} \Products&Date: \Date\\     \textbf{Part numbers:} \PartNumbers&Requested by:  \TestRequestor\\     &Tests made by: \TestPerformer\\     \textbf{Specification:} \Specification &Visa: \Approver\\     \hline     \end{tabularx}     \begin{tabularx}{\textwidth}{|X|}     \textbf {Scope:} Qualification per specification127-11487\\     \\\\\hline     \textbf {Conclusion:}\\     \Conclusions\\     \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\hline      \end{tabularx}     \end{document}


title: Advanced use of listings package

text: I am a PhD student in A.I. that is using the listings package to render its code snippets. I am trying to define a language environment for Drools - a quite famous Production Rules System - that is meant to display the snippets much like the Eclipse perspective used to edit rules. Despite all my efforts, I still have a few issues/questions that I cannot solve by myself. Could you please give me some help? First of all, an MWE with a Drools code snippet:               \documentclass{article}          \usepackage{listings}     \lstset{morekeywords={},         showstringspaces=false}     \usepackage[dvipsnames,svgnames,x11names]{xcolor}          \definecolor{commentGreen}{RGB}{128,127,41}     \definecolor{stringGreen}{RGB}{0,127,38}     \definecolor{keywordRed}{RGB}{151,0,11}     \definecolor{typePurple}{RGB}{128,3,82}     \definecolor{variableBlue}{RGB}{0,0,255}     \definecolor{annotationRed}{RGB}{198,4,38}     \definecolor{annotationBlue}{RGB}{32,21,223}          \lstdefinelanguage[drl]{Drools}{         sensitive=true,         keywordsprefix=\$,         alsoletter={:, },         morekeywords=[2]{long,int,boolean,double,float,enum},         morekeywords=[3]{declare,end,extends,from,insert,modify,not,new,no loop,query,retract,rule,salience,then,this,when, eval},         morekeywords=[4]{after,before,during,over window:length,over window:time,overlaps},         morekeywords=[5]{{no loop},over window:length,over window:time},         morecomment=[l]{//},         morecomment=[s]{/*}{*/},         moredelim=[s][\color{annotationRed}\itshape]{@}{)},         moredelim=[s][\color{annotationBlue}\itshape]{@[}{]},         morestring=[b]",         morestring=[d]',     %%% default style         basicstyle=\normalfont\ttfamily,         % identifierstyle=\normalfont,         commentstyle=\color{commentGreen}\itshape,         keywordstyle=\color{keywordRed}\bfseries,         keywordstyle=[1]\color{variableBlue}\itshape,         keywordstyle=[2]\color{typePurple}\bfseries,         keywordstyle=[3]\color{keywordRed}\bfseries,         keywordstyle=[4]\color{keywordRed}\bfseries,         keywordstyle=[5]\color{stringGreen}\bfseries,         stringstyle=\color{stringGreen}     }[comments,keywords,strings]                    \begin{document}          \begin{lstlisting}[language={[drl]Drools}]     declare MyEvent       @role(event)       @timestamp(time)       @duration(length)       length  : long = 0 @[2]       time    : long     @[1]     end           rule "Transformation rule for 'Initiates' objects"     no loop     when       Initiates(         $e: event, $ep: eventPtrn,          $f: fluent, $fp: fluentPtrn,          $c: context )     then       Helper h = Helper.getInstance();        // 'h' is a wrapper to ease conversion with $*       String r = h.transform($e, $ep, $f, $fp, $c);       h.insertRule(r);     end          /*     rule "Resulting rule"     when       $e: TurnOn( $t: time )       $f: lightOn() // a query returning this fluent instance       holdsAt( powerAvail(), $t )     then       insert(new Declip($e, $f, $t));     end     */     \end{lstlisting}          \end{document}      And finally the questions:   1. Why have I to add a `\lstset{morekeywords={}}` statement just after `\usepackage{listings}` to avoid warnings on compilation on every `$` symbol within my listing?   2. How do I introduce keywords composed of two or more words? I am trying to accomplish that by using `alsoletter={:, }` but it does not work with the whitespace. I also tried with `\` but with no luck. Just in case you are about to suggest me to define `length,loop,no,over,time,window` as single-word keywords, consider that it is not possible because otherwise valid identifiers as `length` (see the `declare` piece of code) would get the format of keywords.   3. How do I format integer and real numbers? Is there any more elegant (or simple) way to do that other than the two methods already present on this site? Such workarounds are quite cumbersome and difficult to maintain when I do change something...   4. How do I properly highlight variables (they are introduced by a `$` symbol in Drools)? In the MWE I am trying to exploit `keywordsprefix=\$,` but I get those special keywords highlighted in comments too: is there any way to tell `listings` not to look in comments as it is possible to do with `moredelim`? Is this a bug? Shall I report it to the maintainer of the package? Just to add more details to the discussion: I also tried to use `moredelim=[l][\color{variableBlue}\itshape]\$,` but all the rest of the line get highlighted too. Finally I also tried with `moredelim=[s][\color{variableBlue}\itshape]{\$}{:},moredelim=[s][\color{variableBlue}\itshape]{\$}{\ },etc.` but it seems I cannot have more delimiters with the same starting symbol; in addition, termination symbol gets highlighted too while it should not (and if I introduce an asterisk in front of the pattern, both the starting and terminating symbols are hidden which is, again, not what I expect).   5. I have found no mention of how to specify default formats for a language (remember, I am planning to obtain an environment that looks the same to the Drools editor): usually it is totally decoupled, so a user may introduce its own style with a `\lstset{...}` block. However, am I doing something completely fool by adding formats to the `\lstdefinelanguage{...}` block? Is there any best practice to follow? Thanks in advance for your time.


title: Smart Quotes Control in AucTeX

text: If I have the statement `\usepackage{ngerman}` in my source-code AucTeX recognizes this and inserts correct german quotation marks if I press " twice. For example               "`a german quote"'      How can I make this work without having a `\usepackage{ngerman}` statement in my source? A. locally in my current buffer and B. globally? Is it possible to control this with a local emacs variable which I write in my document file?


title: Infinite-depth list

text: I want to create a command set that allows me to do something like               \nestedlist{       \listitem An item       \sublist{         \listitem A sub item         \listitem Another sub item       }     }      and get   1. An item   1.1 A sub item   1.2 Another sub item etc, but with infinite depth (that is, I want to be able to use `\sublist` recursively, without specifying on beforehand how many nesting levels are allowed, or having to write extra code to allow another level). I tried an approach with one counter to keep track of the current depth, and one per nesting level to keep track of the numbers. However, when I try to create the number counters with               \newcounter{n\arabic{depth}}      I get an error the second time I reach a nesting level, since the counter is already defined. Is there any way to check if the counter is already defined, and if it is just set it to zero (or whatever number is appropriate)? And as a side note: Is there already some package where this functionality is provided? My requirements are that there should be no limit on the nesting depth, and on each item, the entire "breadcrumb" should be shown as the bullet.


title: LaTeX Classes or Styles for Schedules and/or Calendars?

text: Maybe TeX isn't the best for this particular problem, but any teachers out there use a particular class or package to plan lessons? Right now I'm just using a spreadsheet, but I always find myself wishing there was a 'lessonplan.sty' or 'classschedule.sty' file out there somewhere so I could still use the LaTeX for equations, tables, lists etc. A bit of searching yielded a few results, but there doesn't seem to be a consensus. Anyone used any of these: http://www.ctan.org/tex-archive/macros/latex/contrib/calendar/ http://www.sultanik.com/LaTeX_calendar_style http://tug.ctan.org/tex-archive/macros/latex/contrib/termcal/ Any recommendations from anyone on best way to make calendar-based class schedules and/or lesson plans?


title: Different margin on first page

text: To meet the conditions of our corporate design I need other margins on the first page of each document. The normal page layout is given by               \usepackage[left=3cm,right=2cm,bottom=3cm,top=2cm]{geometry}      But on the first page I need               \usepackage[left=3cm,right=4.5cm,bottom=3cm,top=2cm]{geometry}      I am aware of commands like `\newgeometry`, but for such things I need to insert pagebreaks by hand. How can I achieve different margins only on the first page without doing pagebreaks by hand? Any trick (like using `wrapfig` or something like this) is allowed. Here is a MWE where I want to use it:               \documentclass[parskip=half,fontsize=11pt,ngerman]{scrlttr2}     \usepackage{babel,lipsum,txfonts}     \usepackage[left=3cm,right=2cm,bottom=3cm,top=2cm]{geometry}          \setkomavar{fromaddress}{Street}     \setkomavar{yourmail}{2013-01-10}     \setkomavar{subject}{Subject}          \begin{document}          \begin{letter}{Insert a name here}     \opening{Hi,}     \lipsum     \end{letter}          \end{document}


title: Putting frame counter in the footer of the [beamer] presentation without a theme

text: Could you please help me with the putting numbers of the current frame/page on the slides of my presentation. I don't use any theme (no need for one). I'd like to have the number in footer aligned to the right. This is what my current code looks like               \documentclass{beamer}     \author{Author name}     \title{Title of the presentation}     \subtitle{Subtitle of the presentation}     \institute{University name}     \date{October, 2013}               \begin{document}     \begin{frame}     \titlepage     \end{frame}          \begin{frame}     \frametitle{Frame title}     Some text         \begin{itemize}             \item one             \item two                \end{itemize}     \end{frame}     \end{document}


title: Autocomplete problem in TeXStudio 2.3

text: I am having problem in autocomplete feature of TeXStudio 2.3 under Windows 7 x64. Most of the times, I don't have the autocomplete of all the commands of the loaded packages as well as the bibliography items, and etc. Especially, for the bibliography, I have to check the bibliography file and look it up there. Fortunately, autocomplete issue fixes by itself randomly and I don't know how I should correct them at the times when it does not work. I tried the tips given in here but no success. Here is the TeXStudio configuration window for autocomplete. It does not have any bibliography entry. ![enter image description here](http://i.stack.imgur.com/YIAZ6.png) I am using it with `classicthesis`. I would be grateful if someone could shed light on this problem.


title: delimiters and accents in WinEdt 8.1

text: I have just downloaded WinEdt 8.1. In the toolbar I do not find all the commands to type delimiters like `{`, that we use when typing latex commands? I do not find the accents too. Thank you


title: Small x axis range in pgfplots

text: I try to plot data in pgfplots. My data file has 1001 points in a range (x axis) from 2499999500 to 2500000500, so I have steps of 1. I get the message “Package pgfplots Warning: Axis range for axis x is approximately empty; enlarging it (it is [2499999500.0000000:2500000500.0000000]) ...” in the log file and a straight line is drawn, the axis limits range from 2e9 to 3e9, overriding them with `xmin = ...` etc. does not help. Any idea what can be done? File test.tex:               \documentclass{article}          \usepackage{pgfplots}          \begin{document}          \begin{tikzpicture}           \begin{axis}[             xmin=2499999500,             xmax=2500000500,           ]           \addplot+ table [x index=0, y index=1] {testdata.dat};         \end{axis}     \end{tikzpicture}          \end{document}      File testdata.dat:               2499999500 0     2500000000 1     2500000500 0


title: How do you change indentation in the middle of a paragraph?

text: I'll start with a little background info. Maybe it will help find an alternative solution. I have made a few macros for simple indented lists, text-editor-efficient (just add or remove an `x` to change indentation). All this by changing `\leftskip`, which just worked. But then I decided to save some space by attaching the description text `\descr` to the item before it - without ending a paragraph but still I want the continuation of this description to have a larger indentation. The code below does this wrong. `\desc` in fact increases indentation of the paragraph it is appended to. Here's my current code. I'm using LaTeX, although it may not look like it:               \newdimen\ListSkip\ListSkip=1cm     \def\nox{\par\bigskip\leftskip=0pt\normalsize\rm\relax}     \def\x{\par\leftskip=0pt\Large\rm\bfseries\relax}     \def\xx{\par\leftskip=1\ListSkip\normalsize\rm\bfseries\relax}     \def\xxx{\par\leftskip=2\ListSkip\normalsize\rm\relax}     \def\desc{\quad\leftskip=3\ListSkip\footnotesize\sf\relax}          \x First Chapter.     \xx A few words from our sponsor.     \xx Theory of ABC explained in detail.     \xxx The scientifical world just a few years back.     \xxx First important discovery.     \desc Here I will describe how professor Humblegoat made the miraculous discovery of the relation behind this theory while he was electroshocked in his bathtub.     \xxx Ground-breaking changes in physical concepts.     \nox Normal text again here.      This renders as: ![rendered example](http://i.stack.imgur.com/b3n0F.png) The problem is, that _First important discovery_ is now more indented than _The scientifical world..._ `\leftskip` obviously isn't the right tool to use in `\desc`. If instead of it I use `\hangindent=1\ListSkip\hangafter=1` the result is correct but **how do I know the current line in a paragraph** that I can use in `\hangafter`?


title: Problem with keys to emulate \rput with TikZ

text: This is a beta version of `\rput` with TikZ. I don't know if the psticks version accepts polar coordinates but I added this option. My problem is to add the options `ref = B, Bl , Br, t, tl , tr, b, bl , br`. I don't know what is the good way to do this(pgfkeys ? IeX ?). I know how to apply these options but I don't how to get the values correctly.               \documentclass{scrartcl}      \usepackage{ifpdf,tikz}               \def\myobject{% this is to make some tests     \pgfpathmoveto{\pgfqpoint{0bp}{0bp}}      \pgfpathcurveto{\pgfqpoint{50bp}{0bp}}                    {\pgfqpoint{150bp}{0bp}}                    {\pgfqpoint{200bp}{16bp}}     \pgfpathcurveto{\pgfqpoint{250bp}{0bp}}                    {\pgfqpoint{350bp}{0bp}}                    {\pgfqpoint{400bp}{0bp}}     \pgfpathlineto{\pgfqpoint{400bp}{1bp}}     \pgfpathcurveto{\pgfqpoint{350bp}{0bp}}                    {\pgfqpoint{250bp}{0bp}}                    {\pgfqpoint{200bp}{22bp}}       \pgfpathcurveto{\pgfqpoint{150bp}{0bp}}                    {\pgfqpoint{50bp}{0bp}}                    {\pgfqpoint{0bp}{1bp}}     \pgfpathlineto{\pgfqpoint{0bp}{0bp}}        \pgfusepath{fill,stroke}}%           \makeatletter     \ifpdf      \pgfutil@ifundefined{rput}     {\def\rput{\pgfutil@ifnextchar[{\rput@i}{\rput@ii}}% the code is based on pstricks version     \def\rput@i[#1]{\global\edef\opt@rput{#1}\rput@ii}%     \def\rput@ii{\pgfutil@ifnextchar({\def\angle@rput{0}\rput@iv}{\rput@iii}}%     \def\rput@iii#1{\def\angle@rput{#1}\pgfutil@ifnextchar({\rput@iv}{\rput@iv(0,0)}}%,     \def\rput@iv(#1){\edef\pos@rput{#1}\rput@v}%        \def\rput@v#1{%     \begingroup%      \makeatletter       \begin{tikzpicture}[overlay]     \path (0,0)--(\pos@rput);     \protected@edef\rput@temp{%     \noexpand     \node[inner sep=0pt,anchor=base,\opt@rput,rotate=\angle@rput]}\rput@temp at (\pos@rput) {#1};      \end{tikzpicture}%      \endgroup%     \ignorespaces}}{}%      \fi      \makeatother     \begin{document}          a\foreach \y in {0,6,...,72}{\pgfmathsetmacro{\ratio}{0.2+\y*0.01}%     \rput[](50pt,\y pt){\pgftransformscale{\ratio}\myobject}}      \vspace{5cm}     a\foreach \a in {0,4,...,356}{\rput(\a:3){$\bullet$}}      \hrule     bad\rput{40}(-90:4){\myobject}\rput(0:5){good}       \hrule      \end{document}


title: Vertically center cells of a table?

text: What is the easiest way to center align each row of table? I have a table column that contains an image and other cells in the same row contain text. I would like to know how to vertically center align the image and text cells. Currently each row is vertically bottom aligned. Here is my code:               \documentclass[a4paper]{article}     \usepackage[margin=1.0in]{geometry}     \usepackage{booktabs, caption, underscore, url, graphicx}     \captionsetup{font=bf}     \date{2012-03-01}     \begin{document}     \begin{table}[ht]     \centering          \begin{tabular}{cccc} \bottomrule[2pt]     A & B & V & D & E \\ \bottomrule     \includegraphics[scale=0.35]{img1.eps} & 2 & 3 & 4 \\      \includegraphics[scale=0.35]{img2.eps} & 2 & 3 & 4  \\      \bottomrule[2pt]     \end{tabular}          \end{table}     \end{document}      Here is a quick sketch of the table I am trying to achieve: ![enter image description here](http://i.stack.imgur.com/ymD70.jpg) The first column contains an image while the other columns contain a single line of text. How can the text be center aligned with the middle of the image?


title: Flush latex file io buffers

text: Is there any way to flush latex's file io buffers. Because of something I'm trying to achieve I have to copy/modify the outputted pdf after it is created(but in the same compile run). The problem is, it seems, that the pdf is not fully flushed before I copy/modify it. The result is a partially copied file which end up corrupt. Is there any way to get tex/latex/lutex/lualatex to flush the buffers before I do the copy? (the copy is in lualatex and happens right after the pdf is generated. It is not done separately)


title: Empty alternate lists of figures and tables with bicaption

text: I am using the `bicaption` package to have bilingual captions for all figures and tables. However, I don't want to typeset the alternate language in the document's body, but only create lists of figures/table. However, when I use the option `\captionsetup{bi-lang=first}`, the caption is not typeset neither below the figure nor in the alternate list of figures. A minimum working example follows:               \documentclass[a4paper]{article}          \usepackage[frenchb,english]{babel}     \usepackage[lang=english,listtype+=FR]{bicaption}          \captionsetup{bi-lang=first}          \usepackage{newfloat}     \DeclareFloatingEnvironment[fileext=lof2]{figureFR}     [Figure][Liste des Figures]     \DeclareFloatingEnvironment[fileext=lot2]{tableFR}     [Tableau][Liste des Tableaux]          \begin{document}     \listoffigures     \listoffigureFRs          \begin{figure}     \centering     A placeholder for an image or whatever     \bicaption{English text}{Texte en français}     \end{figure}     \end{document}


title: How to get correct page number of index in ToC

text: > **Possible Duplicate:**   >  Problem with the numeration appearing in the table of contents   >  Index is incorrectly listed in the table of contents I am using               \usepackage{madeidx}     \makeindex      I added entry of index in ToC with               \addcontentsline{toc}{chapter}{Index}     \printindex      This way I can get entry of Index in ToC, how ever page number it is printing is one less than actual page number. How to get correct page number?


title: Correctly add custom table of content item

text: > **Possible Duplicate:**   >  Index is incorrectly listed in the table of contents I want to add a custom section to my table of contents. I know I can use `addcontentsline{toc}{section}{title}`. However, it doesn't use correct reference. When clicking on the item in the toc, it just jumps to the wrong section. MWE:               \documentclass[a4paper]{scrartcl}     \usepackage[english]{babel}     \usepackage[utf8]{inputenc}     \usepackage[T1]{fontenc}     \usepackage[pdftex,bookmarks=true,bookmarksnumbered,colorlinks=true]{hyperref} % http://ctan.org/pkg/hyperref     \usepackage{nameref}     \usepackage{makeidx}          \makeindex          \begin{document}         \tableofcontents              \section{Section 1}         \index{bla}. \index{blub}.         \section{Section 2}              \addcontentsline{toc}{section}{Index}         \printindex     \end{document}      To compile, run:               pdflatex file.tex     makeindex file     pdflatex file.tex     pdflatex file.tex      When clicking on `Index` it jumps to "2 Section 2" instead of "Index".


title: Index is incorrectly listed in the table of contents

text: I have a large document with an index compiled through `makeindex`, and is included in my source `.tex` as follows:               \cleardoublepage     \phantomsection      \addcontentsline{toc}{chapter}{Index}     \printindex      However, the `\addcontentsline` does not correctly add the Index to either the Table of Contents, or the list of bookmarks in the resulting PDF. > Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . 330 One solution is to write a new command, `\immediateaddcontentsline`, and this adds the Index to both the TOC and the list of Bookmarks. The Bookmark link works correctly. But in the TOC, the page number is now listed with roman numerals as "xvi" rather than "349". > Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . 330 > > Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi "xvi" is the _current page_ , so it looks like something is mighty confused. It is probably related to the immediate-ness of the new TOC command. Is it even possible to have an Index listed the Table of Contents? Or must I use a different index maker?


title: beamer presentation with enumerated list problem

text: I have a beamer presentation. In the presentation I have a numbered list... within each number I have a sub-numbered list which I would like to be like the following. How do I fix this problem?               1. hello        a) hi        b) bye          2. bye        a) hi        b) bye      But unfortunately I get this:               1. hello        1. hi        2. bye          2. bye        1. hi        2. bye


title: How to let three subscripts and three superscripts to be aligned

text: Suppose I need to get a formula like `$L^{2,3/4,5/6}_{1,2,3}$` in Latex. Then `$2$--$1$, $3/4$--$2$, $5/6$--$3$` is not aligned. See ![enter image description here](http://i.stack.imgur.com/TbYMp.gif) Then how can I let these three to be aligned?


title: Using \foreach to generate functions

text: I wish to plot a function based on collection of simple functions. For instance, the maximum of some functions:               \begin{tikzpicture}[]     \begin{axis}       \addplot[smooth, color=black]        {          max( 2*x, 3*x, 4*x, 5*x, 0)       };     \end{axis}     \end{tikzpicture}      How can I generate this function using `\foreach`? The following doesn't seem to work               \begin{tikzpicture}[]     \begin{axis}       \addplot[smooth, color=black]        {          max(              \foreach \k in {2,3,4,5}                {\k*x, }              0)       };     \end{axis}     \end{tikzpicture}      as it gives the following error:               ! Undefined control sequence.       \foreach ...@empty \let \pgffor@assign@after@code                                                     =\pgfutil@empty \let \pgff...       l.164       };


title: Referencing to a subsection with numbers and not the subsection name

text: Assume                \section{first}        \subsection{first-1}         \label{marker}      \section{MySecondSection}      In section ~\nameref{marker} we defined...      In the output I see:               In section first-1 we defined...      However I want the section number. Like:               In section 1.1 we defined...


title: Spacing rows in a table

text: I am having a very difficult time typesetting this Cayley table. When I use this code, it gives me an error and tells me that I am using an illegal unit of measure. I know I do not have the correct spacing but I do not know how to fix it. I would greatly appreciate any help! Here is my code:               \begin{table}[h!]     \centering     \begin{tabular}{c|cccccc}          $\cdot$ & [1] & [2] & [3] & [4] & [5]\\     \hline       [1] & [1] & [2] & [3] & [4] & [5] \\       [2] & [2] & [4] & [0] & [2] & [4] \\       [3] & [3] & [0] & [3] & [0] & [3] \\       [4] & [4] & [2] & [0] & [4] & [2] \\       [5] & [5] & [4] & [3] & [2] & [1] \\     \end{tabular}     \end{table}


title: Automatic PDF generation, image scaling

text: I am currently working with GitHub's wiki and I have markdown pages in the wiki that I would like to convert to PDF files. I have a script that uses Kramdown, bash/sed/grep and custom HTML tags for processing the .md file downloaded directly from GitHub and gettting the final PDF through LaTeX. The only problem I do not really have a solution for is the scaling of images. I am now trying to face it in the following way:   1. I assume that all images are r = 150dpi.   2. I get the dimensions in pixels (w,h).   3. I calculate the width of the image in inches, W = w / r   4. I set the width of the image "\includegraphics[widht=Win]" Most of images work, but the following two problems appear:   1. If the resolution of the image changes, it does not work.   2. Sometimes, very long blank gaps appear in between text and images. Is there a simpler solution to this?


title: Frame option in includegraphics makes an overfull \hbox

text: I'm using the adjust package to add the `frame` option in `\includegraphics` command. The package is loaded in this way:               \usepackage[export]{adjustbox}      Now I can write the following command:               \includegraphics[width=\textwidth, frame]{foo.png}      and borders will be automagically added to the image. Unfortunately using this options I get the well-known `overfull \hbox (.. too wide) in paragraph` warning. Without the `frame` option the warning disappears. Does exixst a way to defeat this warning using the `frame` option?


title: Display some text next to an image regardless of its size

text: I want to create a command that displays an image and some text next to it. The image should be displayed in its original size and the command will be used with several images that differ in size and aspect ratio. The text should wrap around and it should also be possible to add manual line breaks. This is what I tried so far:               \newcommand{\Bild}[2]{%         \begin{tabularx}{\columnwidth}{l|X}             \fbox{\includegraphics{#1}}  &              \begin{minipage}[t]{\TX@col@width}#2\end{minipage}\\         \end{tabularx}     }          \Bild{bild1.png}{%        Lorem ipsum dolor sit amet, consetetur\\sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.     }      Unfortunately the text, which should start at the top, is placed below of the image: ![enter image description here](http://i.stack.imgur.com/p7psq.png) Do you know what the problem might be?


title: tex4ht: alt text for images of equations

text: I'm using tex4ht to translate LaTeX to (X)HTML. Tex4ht automatically generates images of equations it could not translate directly into text. **Problem:** the filename of the image generated, as well as the corresponding 'alt' text is meaningless. **Want:** A way to embed in the LaTeX code the filename of image generated, as well as the 'alt' text. **Partial solution:** I managed to define the filename by using the command? `\NextPictureFile{NameToBeUsed}` just before an equation. But I'm unable to specify the 'alt' text. Any suggestions? Of course, an option is to edit the generated HTML pages by hand to specify the 'alt' text. But since this is to be done on a large number of LaTeX files, which can be updated, this would mean having to specify all 'alt' again, even for minor updates on the original files.


title: Section title doesn't fit in TOC in beamer

text: So I have a section in my presentation with a longer name. And on the slides I just used \small, and it fit onto the slide, but on the toc it doesn't 'break', it just continues on cutting off the title of the section :\ Is there a way to make it fit, or to continue underneath the section? MWE:               \documentclass[xcolor=dvipsnames,mathserif,professionalfont,12pt]{beamer}      \usecolortheme[named=RoyalBlue]{structure}      \useoutertheme{infolines}      \usetheme[height=7mm]{Rochester}      \setbeamertemplate{items}[ball]      \setbeamertemplate{blocks}[rounded][shadow=true]      \setbeamertemplate{navigation symbols}{}     %\usefonttheme{serif}     \usefonttheme{professionalfonts}                    \usepackage{amsmath,amssymb,amsthm,amssymb}     \usepackage{mathtools}     \usepackage{bbm}     \usepackage{graphicx}     \usepackage{float}     \usepackage[croatian]{babel}     \usepackage{ucs}     \usepackage[utf8x]{inputenc}     \usepackage{txfonts}     \usepackage{subfigure}     \usepackage{color}     \usepackage{xcolor}     \usepackage{listings}     \usepackage{time}     \usepackage{extarrows}          \title{Title}     \subtitle{Subtitle}     \author{Me}     \institute[Random institute]{Random institue}     \date{\today}          \begin{document}     \maketitle          \begin{frame}     \frametitle{ToC}     \tableofcontents     \end{frame}          \section{Section 1}     \begin{frame}     \frametitle{Section 1}     bla     \end{frame}          \section{Section 2}          \begin{frame}     \frametitle{Section 2}     bla     \end{frame}          \subsection{A very long subsection that doesn't want to collapse into two row, but rather goes on and on and on}          \begin{frame}     \frametitle{\small{A very long subsection that doesn't want to collapse into two row, but rather goes on and on and on}}     bla     \end{frame}          \end{document}      EDIT: This is the output: ![enter image description here](http://i.stack.imgur.com/BCrW7.jpg)


title: Issues with multirow

text: For some reason, in TeXmaker, I have no issues using `\multicolumn`, but `\multirow` simply just does not exist in my program. I am trying to use both in a `tabular` environment and have the entire table built exactly how I want, except for the fact that I need to cover a couple of row with some of my entries. I know how to write the code for it, but I get an error simply because it does not exist in my program. Even if I try to put `\usepackage{multirow}` at the top, _that_ produces an error!


title: What is the difference between \cs_if_exist:NTF and \cs_if_free:NTF?

text: I don't understand what difference of existance and being free means. Consider this example:               \documentclass{article}     \usepackage{expl3}          \begin{document}          \ExplSyntaxOn          \cs_new:Npn \my_cs: {}          \verb=\my_cs:= ~ does ~ \cs_if_exist:NF \my_cs: { not ~ } exist \\ % exists     \verb=\my_cs:= ~ is ~ \cs_if_free:NF \my_cs: { not } ~ free \\ % not free          \tl_new:N \l_my_tl          \verb=\l_my_tl= ~ does ~ \cs_if_exist:NF \l_my_tl { not ~ } exist \\ % exists     \verb=\l_my_tl= ~ is ~ \cs_if_free:NF \l_my_tl { not } ~ free % not free          \verb=\l_tmpa_tl=~does~\cs_if_exist:NF \l_tmpa_tl { not ~ } exist \\ % exists     \verb=\l_tmpa_tl=~is~\cs_if_free:NF \l_tmpa_tl { not } ~ free % not free          \ExplSyntaxOff          \end{document}      Can a cs exist _and_ be free? Or is the difference more a semantic one?


title: why is beamer breaking this tikz picture

text: I am trying to get this graphic to work and it does, if not used in beamer but in article for example. this here produces some errors:               \documentclass{beamer}     \usepackage{tikz}     \usetikzlibrary{positioning}          \begin{document}          \tikzset{%       box/.style={%         minimum height=5mm,         inner sep=.7mm,         outer sep=0mm,         text width=10mm,         text centered,         draw,         fill=white,         line width=.25mm,         rounded corners=2.3mm,         rotate=0,       },       link/.style={-latex,line width=.3mm},     }     \begin{frame}{title}       \begin{tikzpicture}[x=13mm,y=9mm]         % Pascal's triangle         % row #0 => value is 1         \node[box] (p-0-0) at (0,0) {1};         \foreach \row in {1,...,5} {%           % col #0 => value is 1           \node[box] (p-\row-0) at (-\row/2,-\row) {1};           \pgfmathsetmacro{\value}{1};           \foreach \col in {1,...,\row} {%             % iterative formula : val = precval * (row-col+1)/col             % (+ 0.5 to bypass rounding errors)             \pgfmathtruncatemacro{\value}{\value*((\row-\col+1)/\col)+0.5};             \global\let\value=\value             % position of each value             \coordinate (pos) at (-\row/2+\col,-\row);             % odd color for odd value and even color for even value             \pgfmathtruncatemacro{\rest}{mod(\value,2)}             \ifnum \rest=0             \node[box] (p-\row-\col) at (pos) {\value};             \else             \node[box] (p-\row-\col) at (pos) {\value};             \fi             % for arrows and plus sign             \ifnum \col<\row             \node[above=0mm of p-\row-\col]{+};             \pgfmathtruncatemacro{\prow}{\row-1}             \pgfmathtruncatemacro{\pcol}{\col-1}             \draw[link] (p-\prow-\pcol) -- (p-\row-\col);             \draw[link] ( p-\prow-\col) -- (p-\row-\col);             \fi           }         }       \end{tikzpicture}     \end{frame}          \end{document}      the errors:               ! Missing number, treated as zero.     <to be read again>                         {     l.56 \end{frame}          ?      ! Illegal unit of measure (pt inserted).     <to be read again>                         {     l.56 \end{frame}          ?      ! Missing number, treated as zero.     <to be read again>                         \kern      l.56 \end{frame}          ?      ! Illegal unit of measure (pt inserted).     <to be read again>                         \kern      l.56 \end{frame}          ?       Any Idea what I could do to get beamer to cooperate with this tikz?


title: How do I force a particular bibliography style?

text: I am writing a paper for a journal that enforces the use of the Springer 'splncs03.bst' file for references. I wrote most of the paper with `natbib` and the use of the `\citep` and `\citet` commands so it would be really hard to go back to the default LaTeX citation system. The first problem was that the template file was completely incompatible with natbib but I found a fix here. The problem with this fix, however, is that the bibliography is printed out in the completely wrong style. The author of the fix suggests that you can change the heading of the bibliography to 'References' by adding `\renewcommand\bibname{References}` but this does not fix the style. I'm pretty sure I just need to force Latex to use the default article bibliography style. Here is an an example of the styles, I'm getting the style on the left, I want the style on the right. Notice the font size, numbering and title are all different. ![An example of the bibliography styles.](http://i.stack.imgur.com/LazU1.png) Can anyone help me fix this issue?


title: How can I get skak to highlight squares

text: I'm completely new to TeX/LaTeX so I could be missing something easy. I'm trying to create a simple chess board diagram with highlighted squares via the "skak" package. Here is a test case:               \documentclass{article}     \usepackage[ps]{skak}     \begin{document}     \newgame     \showmoverOn     \notationOff     \showboard     \highlight{a1,a3}     \highlight[x]{c1,c3}     \highlight[X]{c4}     \highlight[o]{d6}     \highlight[O]{c6}     \printarrow{e2}{e4}     \printknightmove{g8}{f6}     \end{document}      Based on the reading I've done, this should result in several highlighted/marked squares - however it does not. It compiles fine and results in a board with all the pieces, but no markings at all. I'm compiling it with the `latex` command on Ubuntu Lucid if that's relevant. Skak is version 1.5 (the latest). Any thoughts?


title: pgfplots surf plot: don't draw 'NaN'

text: I generated a checkerboard style suface plot using matlab2tikz. The data contains nan (not a number) values. I want the squares of nan values to be white (as in matlab). When I compile, I get the following warning: > Package pgfplots Warning: The per point meta data `nan' (3Y0.0e0]) (and > probabl y others as well) is unbounded - using the minimum value instead. on > input line 58. and the square is filled with the colour for '0'. I tried to skip the nan values using               unbounded coords=discard      The warning and the behaviour stayed the same. When removing the nan values, the square seems to take the color of its neighbour. Here's the code generated by matlab2tikz:               \documentclass{article}     \usepackage{pgfplots}     \pgfplotsset{compat=1.10}     \begin{document}          \begin{tikzpicture}          \begin{axis}[%     view={0}{90},     scale only axis,     xmin=1, xmax=5,ymin=1,ymax=5,zmin=-1,zmax=1,     hide axis,     colormap/jet,     colorbar,     point meta min=1,     point meta max=100     ]          \addplot3[%     surf,     shader=flat corner,     draw=black,     colormap/jet,     point meta=explicit,     %unbounded coords=discard,     mesh/rows=5]     table[row sep=crcr,header=false,meta index=3] {         1   1   0   1  \\         1   2   0   10  \\         1   3   0   20  \\         1   4   0   30  \\         1   5   0   1  \\         2   1   0   40  \\         2   2   0   nan  \\         2   3   0   50  \\         2   4   0   60   \\         2   5   0   1  \\         3   1   0   70  \\         3   2   0   80  \\         3   3   0   90   \\         3   4   0   nan  \\         3   5   0   1  \\         4   1   0   75  \\         4   2   0   80  \\         4   3   0   85  \\         4   4   0   100  \\         4   5   0   1  \\         5   1   0   1  \\         5   2   0   1  \\         5   3   0   1   \\         5   4   0   1   \\         5   5   0   1   \\     };     \end{axis}     \end{tikzpicture}          \end{document}      And here the output: ![enter image description here](http://i.stack.imgur.com/tenhg.png) Is there a way to not drawing the squares with nan values? Or to add a discrete color to the continuous colormap so that nan values are drawn in white?


title: Add bold enumerate items on highest level only

text: Can somebody tell me how to make both the item number and the item itself bold - but only on the highest level of my list? So, 1,2,3 etc should be bold, while 1.1, 1.2 etc should stay normal. I'm using `enumitem`. I've tried               \begin{enumerate}[label=\textbf{\arabic*}]       but this turns every first number bold, also on the lower levels.


title: Table: Column auto-width vertically and horizontally centered

text: I'm trying to find a method which allows me to have columns with automatic width which are also centered in horizontal and vertical direction, just like `tabularx`'s `X` columntype just centered. So here is was I tried so far:               \documentclass{article}     \usepackage{tabularx,booktabs}     \newcolumntype{Z}[0]{>{\centering\arraybackslash\let\newline\\\hspace{0pt}}X}%     \begin{document}     \begin{table}     \begin{tabularx}{7cm}{l|X|X}     & long\newline heading 1 & short heading\\     \toprule     row 1 & 2314 & 2134     \end{tabularx}     \end{table}     \begin{table}     \begin{tabularx}{7cm}{l|Z|Z}     & long\linebreak heading 1 & short heading\\     \toprule     row 1 & 2314 & 2134     \end{tabularx}     \end{table}     \end{document}      ![enter image description here](http://i.stack.imgur.com/O8USI.png) ![enter image description here](http://i.stack.imgur.com/n9wc4.png) The second is already almost what I want, just the vertical centering of the third column is missing. How to fix this?


title: Add text to .eps before adding compound labels with chemstyle

text: I am writing a chemistry report and I have a few graphs that I need to insert. As the series labels I want to have the compound number (assigned by chemstyle) + some more text. I use ggplot2 to generate the plots and save as .eps. If the label is just the space holder (e.g. "TMP"), the substitution by chemstyle works fine. However, if the label is for example "TMP + compound A", the substitution no longer works. I also tried adding the extra text to the eps-file in incscape, but when I open it in inkscape and save it, the substitution no longer works either. Here is an example:               \documentclass[11pt, titlepage]{article}           \usepackage[T1]{fontenc}      \usepackage{graphicx}     \usepackage[runs=2]{auto-pst-pdf}          \usepackage{bpchem}     \usepackage[journal=rsc, tracking=bpchem]{chemstyle}           %%% compound labels declared when scheme is put in %%%     \usepackage{letltxmacro}     \LetLtxMacro\oldschemeref\schemeref     \DeclareRobustCommand{\schemeref}[2][]{       \CNlabelnoref{#2}       \oldschemeref[#1]{#2}     }          \begin{document}          \begin{scheme}         \begin{center}             \schemeref[TMP1]{1}         \schemeref[TMP2]{2}         \includegraphics[width=1\textwidth]{Chemdraw_Report/triazole_CD}         \caption{\small{CD spectrum of \CNref{1} and \CNref{2}.}}         \label{fig:triazole_CD}         \end{center}     \end{scheme}          \end{document}       The eps file that works, but without the wanted additional text can be found here. An example of what it looks like after adding text in inkscape, but where the text substitution no longer works can be found here. How can I circumvent this problem? Are there better solutions that don't mean I have to add the compound labels by hand?


title: undefined control sequence error while compiling script using tikz

text: I get the following error when compiling the minimal tex script appended at the end of this post:               (/texmf/tex/generic/libraries/pgflibraryplothandlers.code.tex      ! Undefined control sequence.      l.24 \pgfdeclareplothandler                                 {\pgfplothandlercurveto}{}{%      Does anybody know how to solve this problem?   Thank you in advance, gf7 minimal tex sample:               \documentclass{beamer}     \usepackage{tikz}     \usetikzlibrary{arrows.meta}     \usetheme{Madrid}     \setbeamercovered{transparent}     \title{title}     \author[M]{M}     \begin{document}     \begin{frame}       \frametitle{title}       \begin{tikzpicture}         \draw[->](0.5,0.5) -- (0,0);       \end{tikzpicture}     \end{frame}     \end{document}


title: Adjusting vertical alignment of underbraces

text: Is there a way to align multiple underbraces so that they sit on the same horizontal line? For example, the following code               \[     \biggl(     \underbrace{0,1}_{A},      \underbrace{\frac{1}{2},\frac{1}{3}}_{B}     \biggr)     \]      produces this: ![underbraces](http://i.imgur.com/E05iq.png) But I would like "A" and "B" to be on the same line.


title: Autosizing two-column layouts

text: In preparing a solutions manual for a textbook, I quite often wanted to place some text and an associated figure side-by-side as part of the solution. What I ended up doing was either using multicolumn mode or else (more often) a two- column table. The problem with the latter solution is that it required tuning to get the widths of the columns correct so that the entire thing looked right. What I'd like is a more automatic way to accomplish this. Specifically, I want two columns, with text in one and a figure in the other; I'd like the column containing the figure to be sized so that the figure just fits in the column, and the column containing the text to be left- and right-justified. There was a somewhat related conversation in comp.text.tex recently ("spring margin", Jun 8) in which someone suggested the memoir class with \leftspringright, but at a quick read that didn't seem to actually do what I'd like. Any suggestions? Here is an example. The following tex:               $\,$\newline       \begin{tabular}{m{2.8in}m{3.2in}}       The point on the unit circle associated with $-13\pi/3$ is       $(1/2,-\sqrt{3}/2)$, so       \[         \cot (-13\pi/3) = -1/\sqrt{3}=-\sqrt{3}/3.       \]       &       \begin{center}       \includegraphics[scale=0.75]{1_3_13.pdf}       \end{center}       \end{tabular}        generates the following pdf snippet: ![alt text](http://i.stack.imgur.com/ndbcW.png) The document has several hundred such images, and different spacing is required in general depending on the size of the image so as not to exceed the right margin. My preamble looks like this:               \documentclass[twoside]{book}      \usepackage[margin=1in,twoside]{geometry}     \usepackage{fancyhdr}      \usepackage{amstext}     \usepackage{amsthm}     \usepackage{amsmath}     \usepackage{amssymb}     \usepackage{graphicx}     \usepackage{array}     \usepackage{multicol}      so I'm not using anything particularly unusual.


title: Force KOMA-Script title to fill whole page

text: I’m using KOMA-Script (`scrreprt`) and its excellent set of macros to define a rich title page:               \documentclass{scrreprt}          \usepackage[showframe,pass]{geometry}          \subject{Subject}     \title{Title}     \author{Author}     \publishers{Publishers}          \begin{document}     \maketitle     \end{document}      Unfortunately, this leaves rather large vertical spaces above and below the actual content (made visible by the `showframe` option of the `geometry` package). ![screenshot](http://i.stack.imgur.com/unGWV.png) (Image cropped and rescaled) This is very annoying, since now the content doesn’t align with the previous and next page. Is there a way to prevent that, i.e. stretch the title page’s content so that it touches the frame above and below? I tried introducing a vertical space above the publishers:               \publishers{       \vspace{\stretch{10000}}       Publishers}      This does indeed produce the desired stretch, but no matter how large I set the stretch factor, a too large space still remains. How can I change that, and _still_ use the KOMA title page macros, _without_ major rewrite? ### What’s a “major rewrite”?! Consider this: `\maketitle` in KOMA-Script produces up to six pages (half- title, title, title back, dedication …). I’m not opposed to rewrite the `\maketitle` macro, as long as the rewrite is along the following lines:               \edef\maketitle{       \do\some\adjustments%       \maketitle}      That is, re-use the existing `\maketitle` and just tweak it. I don’t want to have to produce the aforementioned six pages manually.


title: TikZ: Using already defined \node label with decimal precision in \draw

text: I have labelled all my nodes in my code and some have decimal numbers in their labels. I want to use these labels as arguments in the `\draw` command but I keep getting this error               ! Missing \endcsname inserted.      Below is a minimum working example.               \documentclass[12pt,a4paper]{article}     \usepackage{tikz}     \begin{document}     \begin{tikzpicture}     %Putting node and clipping them to their respective positions     \foreach \x in {1/2,1,10/3,37/3,15.5}         \foreach \y in {1,1.25,1.5,3,3.5,,4.5}         {             \node [circle,draw=white,fill=white,inner sep=0pt,minimum size=1.5mm] (u\x\y) at (\x,\y)  {};         }     %Drawing arrows     \foreach \y in {1.5,3.5}         {             \draw[semithick,->] (u1/2\y) -- (u1\number\numexpr\y-0.5\relax) ;         }     \end{tikzpicture}     \end{document}


title: How to generate a graphcis like a flowchart but with function plot?

text: I know that latex plot is really powerful. I think it can also work out for the attached figure as follows. Can I anyone help me out? Similar plot demonstration is also greatly helpful. Thanks in advance! ![enter image description here](http://i.stack.imgur.com/nZ4AK.jpg)


title: Reftex: Problem with uppercase label environment type specification

text: I am using emacs 24.3.1 with auctex and reftex. Right now, I am trying to get reftex's label insertion mechanism to work with a custom environment "satz" that I defined via \newtheorem with the ntheorem-package. For this, I inserted the following entry in the reftex-label-alist (I am not familiar with lisp):               Package or Detailed   : Value Menu Detailed Entry:             Environment or \macro : Value Menu String: satz             Type specification    : Value Menu Char  : S             Label prefix string   : Value Menu String: satz:             Label reference format: Value Menu String: ~\thref{%s}             Context method        : Value Menu After label      Now I wanted to alter reftex's behavior on "satz" label insertion by changing reftex-insert-label-flags (default is (s, sft)), but this has no effect; reftex always generates a label from context and prompts me to confirm it. The problem goes away if I change the type specification to, for example, F, so maybe reftex is using the label flags for the "s" label type for my environment of type "S". But the docstring for reftex-insert-label-flags mentions types "n" and "N", so it seems that the the types are case sensitive. Am I getting something wrong with case sensitivity here?


title: Sorting bibliography cannot be turned off in Biblatex when writing in Arabic

text: I want the citations to appear in the bibliography in the order of their appearance in the text and _not_ according to their alphabet. I know there is an argument for that which is `sorting=none`. However, that didn't work when I was writing a document mainly in Arabic as in the MWE below, which is related to this post. **MWE Code**               \documentclass[oneside,16pt]{scrartcl}      \usepackage{fontspec}     \usepackage{csquotes}     \usepackage{polyglossia}     \setmainlanguage{arabic}     \setotherlanguage{english}     \setmainfont{Arial}     \newfontfamily\arabicfont[Script=Arabic,Mapping=arabicdigits]{USAMA NASKH}     \newfontfamily\arabicfontsf[Script=Arabic,Mapping=arabicdigits]{USAMA NASKH}     \newfontfamily\arabicfonttt[Script=Arabic,Mapping=arabicdigits]{USAMA NASKH}     %\usepackage[style=numeric,backend=biber]{biblatex}     \usepackage[style=numeric,sorting=none,backend=biber]{biblatex} % both citations and bibliography list won't show up in the pdf          \DefineBibliographyStrings{english}{%       references = {المراجع},     }     \makeatletter     \def\abx@comma{\ifdim\lastkern>\z@\unkern\fi\abx@puncthook{،}}% \makeatother          \usepackage{filecontents}     \begin{filecontents}{jobname.bib}     @book{ref1,         author = {{ابن سينا}},         year = {1417},         title = {السماع الطبيعى من كتاب الشفاء},         publisher = {دار المناهل},         location = {بيروت},     }     @book{ref2,         author = {الجواهري},         year = {1418},         title = {اسم مستعار للكتاب},         publisher = {دار المناهل},         location = {بيروت},     }          @book{ref3,         author = {يزيد بن معاوية},         year = {1419},         title = {اسم غير حقيقي للكتاب},         publisher = {دار المناهل},         location = {بيروت},     }          \end{filecontents}     \addbibresource{jobname.bib}               \begin{document}          هنا كتابة ألنص باللغة العربية، نلاحظ عند إدخال احد المراجع \parencite{ref3} يظهر في باب المراجع بشكل طبيعي، لكن عند إضافة مرجع آخر مثلا \parencite{ref1} فإننا نلاحظ عدم ظهوره بالتسلسل الصحيح في باب المراجع حسب ظهوره. هذا مرجع ثالث للتأكد \parencite{ref2}.               \printbibliography     \end{document}      **MWE Output** ![enter image description here](http://i.stack.imgur.com/pFIzN.png) **Output post-update** ![enter image description here](http://i.stack.imgur.com/D1lSQ.png)


title: use footnotesize when it's redefined by some template

text: I am submitting a paper to a conference proceeding. The proceeding's template redefines `\footnotesize` to `\small` as               \let\footnotesize\small      Is there a way to use the actual footnote size in the paper? I have a big table and I want to reduce the space it consumes.               \begin{table*}[tb]     {\centering\footnotesize     \begin{tabular}{|c|c|c|c|c|c|c|}     ...      I tried `\tiny`, which works for both text and inline math. But `\fontsize{6pt}{8pt}` does not. The font size of inline math is changed but the text stays at `\small` size. Perhaps the text font size is locked somewhere in the template?


title: Why are the tables in minipages left out of the list of tables?

text: I have some tables inside of `minipage` enviroment but they don't appear listed like the others in my `\listoftables`; see the code below.               \listoftables     .     .     .     \begin{table}        \begin{tabular}{c|c|c}    %This one is classify     ...     \end{tabular}     \end{table}          \begin{minipage}     \begin{tabular}{c|c|c}    %This one isn't classify     ...     \end{tabular}     \end{minipage}


title: Why does mhchem complain about this?

text: Alright, I'm trying to make a command to insert a proton. This code works fine:               \documentclass[12pt,letterpaper]{article}     \usepackage{amssymb,mathtools}     \usepackage[version=3]{mhchem}          \newcommand{\tphoton}{$\gamma$}          \begin{document}     \tphoton     \end{document}      and this code works fine:               \documentclass[12pt,letterpaper]{article}     \usepackage{amssymb,mathtools}     \usepackage[version=3]{mhchem}          \begin{document}     \ce{$\gamma$}     \end{document}      Why doesn't this code work?               \documentclass[12pt,letterpaper]{article}     \usepackage{amssymb,mathtools}     \usepackage[version=3]{mhchem}          \newcommand{\tphoton}{$\gamma$}          \begin{document}     \ce{\tphoton}     \end{document}      It gives a "! Missing $ inserted.", 3 "! Extra }, or forgotten $."


title: Big asterisk "\bigast" symbol

text: How do I make a math-mode asterisk that works like sum or product operator? (To represent the convolution.)


title: What's the difference between \strut, \mathstrut and \vphantom?

text: What's the difference between `\strut`, `\mathstrut` and `\vphantom`? When would I prefer one of them to the others, and why?


title: Centering vertically in table cell

text: I'm new with LaTeX and I'm trying to make a table with the elements centered vertically and horizontally. I've searched for this question, it seems like most people were trying to do things a little more complicated than this, resulting in complicated answers I couldn't understand. The table below is already centered horizontally, but the elements are aligned to the top of the cells instead of the center. How do I fix this?                   \begin{tabular}{*{5}{|c}|}             \hline             $p$ & $q$ & $p \land q$ & $p \lor q$ & $p \to q$\\             \hline             T & T & T & T & T\\             \hline             T & F & F & T & F\\             \hline             F & T & F & T & T\\             \hline             F & F & F & F & T\\             \hline         \end{tabular}


title: Installing/downloading packages

text: I am an absolute beginner to LaTeX. And I'm following the Wikibooks tutorial. I am at the part where it talks about packages. It doesn't really explain where to download and install them. So where do I? In the tutorial, they're using the _mathptmx_ and _pifont_. I am using ShareLaTeX, if that matters.


title: Can one change the math font?

text: In the question Different Font in a Math Environment, the answer does not explain how to change the math font, but how to change the text font (leaving the math the same). Is there a way to change the math font, keeping the text as is?


title: line-breaking inside multirow environment in a pgfplotstable

text: I want to combine two string columns into one column. The contents of the columns should be in two lines, i.e., first column's content must be in the first row of the combined column and second column's content must be in the second row of the combined column. I have to use `multirow` environment since the number of rows belonging to a `ColA` and `ColB` pair is variable. For example, it is 3 in the following sample table, `table.txt`.               \documentclass{article}     \usepackage{pgfplotstable}     \usepackage{multirow}     \begin{filecontents}{table.txt}     ColA    ColB ColX     A   C   1     A   C   2     A   C   3     B   D   4     B   D   5     B   D   6     \end{filecontents}     \begin{document}     \def\numps{3}     \def\numpsMONE{2}     \pgfplotstableread{table.txt}\table     \pgfplotstabletypeset[columns={Combined, ColX}, columns/ColA/.style={string type},columns/ColB/.style={string type},create on use/Combined/.style={string type, column name={Combined}, column type=l, create col/assign/.code={         \xdef\entry{\thisrow{ColA} \thisrow{ColB}}              % I cannot put \\ between thisrow{ColA} and thisrow{ColB}          \edef\empty{}         \pgfmathparse{Mod(\pgfplotstablerow,\numps) == 0 ? 1 : 0}         \ifnum\pgfmathresult=1     %       \pgfkeyslet{/pgfplots/table/create col/next content}\entry                 % If I use \pgfkeyslet, A C is printed, however I cannot use multirow             \pgfkeyssetvalue{/pgfplots/table/create col/next content}{\multirow{\numpsMONE}{*}{\entry}}                 % If I use \pgfkeyssetvalue,B D is printed but A C is not printed         \else             \pgfkeyslet{/pgfplots/table/create col/next content}\empty         \fi     }},columns/Combined/.style={string type},]\table      \end{document}      This code prints:               Combined ColX              1     B D      2              3              4     B D      5              6      What I need is:               Combined ColX              1     A        2     C        3              4     B        5     D        6      Thanks in advance!


title: How to align an equation reference (1) to the right

text: I have a centred equation and I'd like to place a (1) on the same line as the equation, but aligned to the right, so that I can refer back to the equation in future. What I have at the moment is:               \center  $ \begin{pmatrix} e & \frac{f}{2} \\ \frac{f}{5} & g \end{pmatrix} = L^T %       \begin{pmatrix} a & b \\ c & d \end{pmatrix} L $ \flushright' (1)


title: Set enumeration level explicitly

text: I have the need for a custom list environment at the outermost level, defined as follows:               \newboolean{odd}     \setboolean{odd}{true}     \usepackage{environ}     \newcounter{exnum}[section]% Exercise counter (within section)     \NewEnviron{solution}{% Solution        \stepcounter{exnum}%        \ifthenelse{\isodd{\theexnum}}% Condition on oddness           {\item \BODY}% Print odd answer           {\ifthenelse{\boolean{odd}}{}{\item \BODY}}% Print odd     }     \newenvironment{outerlist}%         {\begin{list}%             {{\bfseries\arabic{exnum}.}}{}}%         {\end{list}}%      The point of all of this is to be able to set the `odd` boolean and change whether all items, or just the odd-numbered items, are output. This all works fine, except that this list environment, `outerlist`, does not increment the enumeration level. As a result, inner enumerations start at level 1. This is not consistent with the visual appearance (`outerlist` obviously looks like an outer enumeration in the output), and is confusing to the maintainer (I confused myself a couple of times :) Can I tell LaTeX to start with enumeration level 2? Or is there a better way to write the above so as to get the behavior I want? Edit: Per request, here is an MWE:               \documentclass{article}     \usepackage{environ}          \newcounter{itemnum}     \NewEnviron{outeritem}{% Solution        \stepcounter{itemnum}%        {\item \BODY}%     }          \newenvironment{outerlist}%         {\begin{list}%             {{\bfseries\arabic{itemnum}.}}{}}%         {\end{list}}%          \renewcommand{\labelenumi}{{\bfseries(\alph{enumi})}}     \renewcommand{\labelenumii}{{\bfseries(\roman{enumii})}}          \begin{document}          \begin{outerlist}     \begin{outeritem}       This level is numbered with arabic numerals, but is not really an enumerate list.     \end{outeritem}     \begin{outeritem}       This is outer list item 2.       \begin{enumerate}         \item This looks visually to be at level 2, but LaTeX thinks of it as a level 1 enum,              and it is governed by $\backslash$labelenumi. I would like it to be governed by             $\backslash$labelenumii, so that the TeX file can use level 2 definitions for              this list level format.       \end{enumerate}     \end{outeritem}     \end{outerlist}     \end{document}


title: How do I increase the spacing between header text and the 'headrule' line with fancyhdr?

text: This is going to be something so obvious that I'm almost embarrassed to ask! I've been using `fancyhdr` to put some fancy headers and footers in my thesis template – in fact, doing what it says on the tin! A sample from the code is as follows:               \documentclass[chapterprefix=false]{scrreprt}     \usepackage{fancyhdr}     \usepackage[textheight=1.618\textwidth,     lmargin=37mm, rmargin=22mm, driver=pdftex,     heightrounded, headsep=7mm,     footskip=11mm, vmarginratio=1:1]{geometry}          \fancypagestyle{plain}{     \lhead{\small{Thesis Title}}     \chead{}     \rhead{\small{My Name}}     \lfoot{\small{Project Name}}     \cfoot{$-$~\thepage~$-$}     \rfoot{\small{Submission Date}}     \renewcommand{\headrulewidth}{0.5pt}     \renewcommand{\footrulewidth}{0.5pt}}     \pagestyle{plain}      I hope that's enough code for a diagnosis. Everything works fine, except that the header text is sitting immediately on top of the 'headrule' line with virtually no space between them – and I would like a little white space between the text and the line. Curiously all the examples in the `fancyhdr` documentation show space between the header text and the line, but I can't fathom how to achieve this! It's straightforward enough with a footer, because there's an extra parameter `\footruleskip`, but there doesn't seem to be an equivalent for the header. If anyone can help, it would be much appreciated.


title: Fixing a messed table

text: I am trying to make a table in Latex. Now I have combined most of my Latex experience in making this (I am still new) and I thought I was making good progress until I saw the end result. The problem is that the text is all messed, and it makes the table too long. I honestly have no idea on how this can be fixed and I would appreciate any possible help. Here is the MWE:               \documentclass[a4paper,10pt]{article}          \usepackage[table]{xcolor}     \usepackage[utf8]{inputenc}     \usepackage{tabularx}     \usepackage{array}          %define some nice colors     \definecolor{middleware_green}{RGB}{82, 119, 17}     \definecolor{middleware_white}{RGB}{255, 255, 255}     \definecolor{middleware_light_gray}{RGB}{239, 239, 239}     \definecolor{middleware_dark_gray}{RGB}{153, 153, 153}          %renewing commands for tabularx     \renewcommand{\tabularxcolumn}[1]{>{\small}m{#1}}          %new column type for test tables      \newcolumntype{L}{>{\leavevmode\ignorespaces\raggedleft\arraybackslash\sffamily}X}%     \newcolumntype{C}{>{\leavevmode\ignorespaces\centering\arraybackslash\sffamily}X}%          \newcolumntype{R}{|>{\leavevmode\ignorespaces\color{magenta!70!black}\raggedright\sffamily\bfseries\footnotesize}p{2.5cm}}%     \newcolumntype{H}{|>{\leavevmode\ignorespaces\color{orange!30!black}\centering\arraybackslash\sffamily\footnotesize}X}%     \newcolumntype{J}{|>{\leavevmode\ignorespaces\color{green!30!black}\centering\sffamily\footnotesize}X}%     \newcolumntype{W}{|>{\leavevmode\ignorespaces\color{blue!30!black}\centering\arraybackslash\sffamily\footnotesize}X|}%               \begin{document}          \begin{table}[ph!]     \footnotesize\centering     \rowcolors{2}{middleware_white}{middleware_light_gray}          \begin{tabularx}{\textwidth}{|L|L|L|L|L|L|}     \hline\rowcolor{middleware_green}     \multicolumn{ 6}{|c|}{\small\textcolor{white}{\textbf{Cloud Types}}} \\ \hline     \rowcolor{middleware_dark_gray}     &   \multicolumn{1}{|C}{\textcolor{white}{\textbf{Pu\-blic cloud}}}             &          \multicolumn{1}{|C}{\centering\textcolor{white}{\textbf{Pri\-va\-te cloud}}}    &          \multicolumn{1}{|C}{\centering\textcolor{white}{\textbf{Hy\-brid cloud}}}       &          \multicolumn{1}{|C|}{\textcolor{white}{\textbf{Vir\-tu\-al pri\-va\-te cloud}}}     &         \multicolumn{1}{|C|}{\textcolor{white}{\textbf{Com\-mu\-ni\-ty cloud}}}         \\ \hline     Definition  &   Focuses on sharing or renting services and infrastructures from external entities with several clients. In this type of cloud the resources are usually allocated dynamically during an undetermined amount of time.    &   Also known as internal clouds, these are designed for the exclusive use of a company. Depending on the contract, it may be maintained by the company itself, or by an external company. These clouds usually exist when the client has specific needs or when it wants a long term contract.    &   This is a combination of the public cloud with the private cloud, trying to overcome the limitations of both types while gaining the benefits from them. As the name suggest, in this type of cloud, part of the system is external to the client, while the other part is internally managed by him.   &   This is an alternative to attack the problems present in both private and public clouds. In this approach, the supplier of a public cloud has a has system of virtual private networks (VPNs) that allow him to define management and security protocols, thus effectively simulate a network of virtual servers and their connections. This is sometimes mistaken as a hybrid cloud, however the main difference is that in such a cloud, both public and private clouds are real, while in the one the private cloud is merely virtualized on the top of the public cloud.    &   This type of cloud is a shared cloud between several entities that share a common interest, such as politics, security or other.    \\ \hline     Advantages  &   \begin{itemize}                      \item The client does not need initialization money to build the cloud because this money has already been invested by the supplier.                      \item Migrates the responsibility and management of risks to the supplier.                      \item Are usually a lot bigger than the private clouds.                     \end{itemize}             &   \begin{itemize}                  \item The client has more control over the infrastructures, and can therefore have its own security and failure protocols.                  \item Easier and cheaper than buying a database.                 \end{itemize}             &   \begin{itemize}                  \item More flexible than a private cloud or a public cloud.                  \item Provide more control than public clouds have easier scalability when compared to private clouds.                  \item Helps isolate and delegate the computational resources used, thus increasing the availability of the company's own resources.                 \end{itemize}             &   \begin{itemize}                  \item Allows the client to use the provider's infrastructures as part of his own cloud.                  \item Allows the dynamic manipulation of the protocols defined.                  \item Easier to scale because the created servers are virtual.                 \end{itemize}             &   \begin{itemize}                  \item Because it shares the costs, this option is the cheapest one.                 \end{itemize}             \\  \hline     Disadvantages   &   \begin{itemize}                          \item The client has no control over the data, security and network.                          \end{itemize}             &   \begin{itemize}                  \item Criticized by being similar to private server farms, thus sharing all their problems including maintenance.                  \item Requires an initial investment to buy the necessary infrastructures.                 \end{itemize}             &   \begin{itemize}                  \item Requires a careful analysis of what should go to the private cloud and what should go to the public one.                  \item Moving big amounts of data between the two clouds results in additional costs and stateful applications are harder to maintain.                 \end{itemize}             &   \begin{itemize}                  \item Adds the complexity of migrating workload from the client to the supplier's cloud.                 \end{itemize}             &   \begin{itemize}                  \item Because each company has specific security restrictions, this type of cloud has to manage them all at he same time, consequently not being very effective at doing it.                  \item There is little control over the resources because the environment in which they are is shared.                 \end{itemize}             \\  \hline     \end{tabularx}     \caption{Cloud Types\label{tab:cloud_types}}     \end{table}                    \end{document}


title: Allow macro to end without new line

text: The following macro, which a full MWE can be found at Unmodified Source Code ,               \def\SourceCode{%       \begingroup%       \endlinechar`\^^J%       \catcode`\\=12\catcode`\^^M=12\catcode`\#=12\catcode`\~=12\catcode`\%=12\catcode`\^=12\catcode`\_=12\catcode`\@=12\catcode`\ =12\catcode`\|=12%             \SourceCodeAux}%     \def\SourceCodeAux#1#2{\endgroup\directlua{print("\luaescapestring{#1}")}}%      has the issue that the last terminating `}` cannot have anything else after it, on it's line:               \begin{itemize}     \item 2     \SourceCode{     {this     is     a     test}     }\end{itemize} % < This line is the problem, } \end{itemize} works but produces protected space in pdf.      will not work _unless_ `\end{itemize}` is moved to the next line or a space is put between the `} \end{itemize}` (which then puts a protected space in the pdf) The issue seems to be how the macro handles the last character but I don't quite understand what is going on. Is there any way to get the `}\end{itemize}` case to work? > I'm a bit confused on what the second argument for \def\SourceCodeAux#1#2 is > doing. It is required but I'm not sure how it actually works. I've replaced > it with other stuff and can get `}\end{itemize}` to work but end up with > protected spaces or other characters showing up in the pdf. My thinking is > if I can insert a new-line into the stream right after the final `}` then > TeX will see `}\^^M\end{itemize}` and allow it to work. Anyways, maybe > someone can enlighten me on what exactly is going on. here is how I see the macro:   1. Start new group to locally define catcodes(so the catcode modifications do not effect anything but what is in the macro)   2. Modify endlinechar and catcodes so that tokens after the macro call are not "Special"   3. Call an auxiliary macro that accepts two arguments. The first being will end up being the token stream(the source code argument "passed" to the original macro call). The second argument is then going to be the last token in the source code. (In the problem case happens to be a `\` which gets picked up "accidently" and breaks the `\end{itemize}` (tex see's it as `end{itemize}`)   4. endgroup is called to return the catcodes back to normal then processing is done on the first "argument". (I'm not quite sure how the macro knows when to stop processing tokens though but I guess it has something to do with some trick using the #2 which is also what is causing the problem) Here is a full MWE:                   \documentclass{book}         \usepackage{luatex}         \directlua{tex.enableprimitives('',tex.extraprimitives())}         \begin{document}                  \def\SourceCode{%               \begingroup%               \endlinechar`\^^J%               \catcode`\\=12\catcode`\^^M=12\catcode`\#=12\catcode`\~=12\catcode`\%=12\catcode`\^=12\catcode`\_=12\catcode`\@=12\catcode`\ =12\catcode`\|=12%               \SourceCodeAux}%             \def\SourceCodeAux#1#2{\endgroup\directlua{print("\luaescapestring{#1}")}}%                   \begin{itemize}         \item 1         \SourceCode{         {this         is         a sucessful         test}         }         \end{itemize}          \iftrue         \begin{itemize}         \item 2         \SourceCode{         {this         is         a failed         test}         }\end{itemize}     \fi         \end{document}


title: How to set the page layout dimensions in ConTeXt?

text: Using the instructions found in the page design chapter of the ConTeXt user manual, I have attempted to set my own page dimensions, but have not been able to understand the instructions. For e.g., there are options for `leftmargin`, `leftedge`, `leftmargindistance`, `leftedgedistance`, but I do not understand how these translate to the page. To further complicate matters, when I compiled any documents, with `showframe`, `\showstruts`, and `\showgrid` options on, lots of red lines appeared in my document, suggesting there were many complex dimensions to set, as illustrated here:                _____________________ _____________________     |  _   _________   _  |  _   _________   _  |                            | |_| |         | |_| | |_| |         | |_| |     | |_| |         | |_| | |_| |         | |_| |                          | | | |         | | | | | | |         | | | |                          | | | |         | | | | | | |         | | | |                          | | | |         | | | | | | |         | | | |                          | | | |         | | | | | | |         | | | |                          | | | |         | | | | | | |         | | | |                          | | | |         | | | | | | |         | | | |                          | | | |         | | | | | | |         | | | |     | |_| |_________| |_| | |_| |_________| |_| |     | |_| |_________| |_| | |_| |_________| |_| |     | |_| |_________| |_| | |_| |_________| |_| |     |_____________________|_____________________|            (verso)                 (recto)      Generally, my page dimension needs are quite basic. Here is an illustration:                _____________________ _____________________     |       ^             |             ^       |     |       a             |             a       |     |      _v_____        |        _____v_      |     |     |   ^   |       |       |       |     |     |     |   |   |       |       |       |     |     |<-b->|   c   |<--d-->|<--d-->|<--e-->|<-b->|     |     |   |   |       |       |       |     |     |     |___v___|       |       |_______|     |     |       ^ ^           |           ^ ^       |     |       | f           |           f |       |     |       | v           |           v |       |     |       g #           |           # g       |     |       |             |             |       |     |       |             |             |       |     |_______v_____________|_____________v_______|            (verso)                 (recto)      a - length of top margin b - width of outer margin c - height of text area d - width of gutter e - width of text area f - length of space between text area and page number g - length of bottom margin   * The dimensions of the verso pages and recto pages are identical, but mirrored at the gutter.   * Any footnote text should appear within the text area.   * Margin notes are not used.   * The dimensions of `c` and `e` need not be set, these can fill the available dimensions left on the page. How can I set the page layout dimensions in my document in ConTeXt?


title: Fill color of a text that fits the background with Tikz

text: I would like to fill the texts' background in the shaded rectangle to overlay the dashed arrows, with a color that fits the figure's background. ![enter image description here](http://i.stack.imgur.com/05Bty.png) I guess I should use the `fill` option with my background gradient color but how to choose the right values ? Is there an option of filling with a transparent color ?               \documentclass{article}     \usepackage{tikz}     \usetikzlibrary{arrows}          \begin{document}         \begin{tikzpicture}               \shade[bottom color=gray!10, top color=gray!80] (0,0) --++ (5,0) --++ (0,4) --++ (-5,0) -- cycle;         \draw (0,0) --++ (5,0) --++ (0,4) --++ (-5,0) -- cycle;              \foreach \y [count =\c] in {0.5,1.5,2.5,3.5}{             \draw [-open triangle 60 reversed,thick](5,\y) --++ (1,0) --++ (0,0.5) node[below right]{$s_\c(\theta_0, t)$};             \draw [dashed] (5,\y) -- (0,2) node[midway, sloped] {$h_\c(t)$};         }              \foreach \y/\couleur [count = \c] in {0.5/red,1.5/purple,2.5/violet,3.5/blue}{             \pgfmathsetseed{\y+11}             \draw[\couleur] plot[domain=0:1.5, samples = 500] (\x-5,{rand*0.5*sin(\x*2000)*exp(-3.5*(-\x+1.5))+\y});             \draw (-6,\y) node {$h_{\c}^*(-t)$};             \draw [->, shorten >=1cm](-3,\y) -- (0,2);         }              \draw (-0.5,2) circle (0.4) node {\Large $\Sigma$};              \end{tikzpicture}     \end{document}


title: Item in PaloAlto theme Beamer

text: > **Possible Duplicate:**   >  beamer: change individual bullet color for pros and cons list I would like to change the color of bullets in the `PaloAlto` Theme. I tried :               \setbeamercolor{itemize item}{bg=my_color,fg=black}     \setbeamercolor{enumerate item}{bg=my_color,fg=black}      but then I still have a blue item... (`my_color` is almost orange)