title: Can't add \raisebox to ToC in XeTeX

text: In XeLaTeX I've defined the following command:               \newcommand*{\PoETeX}{P\kern -.15em\raisebox{-0.21em}{O}\kern -.05em E\TeX}      as a simple (non-robust) way to create a silly logo styled after `\LaTeX`. It works fine until I try to insert it into the table of contents with something like:               \addcontentsline{toc}{section}{\PoETeX}      at which point I get the following from `xelatex`: > ! Argument of \reserved@a has an extra }. \par l.11 > \addcontentsline{toc}{section}{\PoETeX} The problem seems to be caused by`\raisebox` — taking out raisebox, or using `\addcontentsline*` gets rid of the error. A minimal example can be found below:               \documentclass[a4paper,11pt]{article}          \begin{document}     \thispagestyle{empty}          \newcommand*{\PoETeX}{P\kern -.15em\raisebox{-0.21em}{O}\kern -.05em E\TeX}          \addcontentsline{toc}{section}{\PoETeX}     \section*{\PoETeX}          \begin{verse}          There once was a poem called \PoETeX\\     That's name sounded somewhat /pəˈθɛtɛk/.\\     \hspace*{2em}It was really quite sad,\\     \hspace*{2em}to see pronunciation so bad,\\     And to read such a terrible /ˈlɪme(ə)rɛk/!          \end{verse}     \end{document}


title: Referencing a figure, table or citation

text: I want to refer to any figure, table or citations in my text so that if I click on the reference (or link) it will take me to the actual figure, table or citation. Currently, it is not happening for me in the pdf I generate with LaTeX. Should I have to add any package for that?


title: Remove chapter number from bibliography in memoir

text: For my PhD thesis, I'm using `memoir` class. I have some chapters, each one ending with a bibliography. I wish, both in the chapter and in the table of contents, the references title were not numbered. Can I do that? **EDIT** : As rightly suggested by @Werner, I provide an example. This is my main .tex file.               \documentclass[a4paper,twoside,italian,12pt,openright]{memoir}     \usepackage{tocloft}     \aliaspagestyle{part}{empty}     \usepackage[font=small]{quoting}     \usepackage[utf8]{inputenc}     \usepackage[italian]{babel}     \usepackage[T1]{fontenc}     %\usepackage{fancyhdr}     \usepackage{indentfirst}     \usepackage[sectionbib]{chapterbib}     \usepackage[usenames]{color}     \definecolor{citations}{rgb}{0,.5,.5} % color for in text citations     \usepackage{doi}     \usepackage{hyperref}     \hypersetup{        colorlinks,breaklinks,        linkcolor = {black},        urlcolor = {blue},        anchorcolor = {blue},        citecolor = {citations}}     \usepackage{microtype}     \usepackage{mathptmx}     \usepackage{rotating}      \usepackage{multirow}     \usepackage{amsmath}      \usepackage{url}     %\usepackage[singlespacing]{setspace}      %\usepackage[top=3cm,bottom=3cm,right=3cm,left=3.5cm]{geometry}      \usepackage{graphicx}          \usepackage[font=footnotesize,labelfont=bf,labelsep=space]{caption}      \DeclareCaptionFormat{myformat}{#1#2#3\hrulefill}     \captionsetup[figure]{format=myformat}          \usepackage{textcomp}      \usepackage[natbibapa]{apacite}          \pagestyle{ruled}          \raggedbottom               \settocdepth{subsection}     \setsecnumdepth{subsection}          \renewcommand*\rmdefault{ppl}           \graphicspath{{Figures/}}          \title{Title}     \date{}     \author{Author}          \begin{document}         \chapterstyle{veelo}         \frontmatter         \begin{KeepFromToc}             \tableofcontents         \end{KeepFromToc}         \mainmatter         \cftaddtitleline{toc}{part}{Introduzione teorica}{}         \part*{Introduzione teorica}             \include{Chapters/Chapter1}             \include{Chapters/Chapter2}             \include{Chapters/Chapter3}         \cftaddtitleline{toc}{part}{Lavori di ricerca}{}         \part*{Lavori di ricerca}             \include{Chapters/Chapter4}             \include{Chapters/Chapter5}         \cftaddtitleline{toc}{part}{Conclusioni generali}{}         \part*{Conclusioni generali}             \include{Chapters/Conclusions}         \backmatter         \cftaddtitleline{toc}{part}{Appendice}{}         \chapter*{Appendice}         \listoffigures         \listoftables     \end{document}      Each chapter file end with:               \bibliographystyle{apacite}     \bibliography{D:/Documents/library}      This produce a ToC like this: > 1 **Chapter title** > > 1.1 Section name > > 1.2 Section name > > ... > > 1.6 Bibliography I want that it appears like this: > 1 **Chapter title** > > 1.1 Section name > > 1.2 Section name > > ... > > Bibliography Moreover, I also want that the bibliography title is not numbered inside each chapter.


title: Supertabular leaves header in next column

text: I'm using supertabular in multicols enviroment based on this thread's accepted answer multicolumn long table or enumeration. But there is sometimes header and empty table body left in new column/page (eg. when i change counter "n" to 19 - first column is full and only header is in second column). I've also tried this solution How to disable pagebreak on \hline in supertabular? but it doensn't help. Number of rows I create is arbitrary. Is there a way to remove these headers with no body (without removing all headers)? EDIT: example                   \documentclass{article}         \usepackage[margin=1in]{geometry}         \usepackage{xcolor,supertabular,multicol}         \newcount\n         \n=0         \def\tablebody{}         \makeatletter         \loop\ifnum\n<19                 \advance\n by1                 \protected@edef\tablebody{\tablebody                         \textbf{\number\n.}&                         \hfill T\hfill\hfill F\hfill\hskip0pt\endgraf                         \vskip.5\baselineskip                         \color@begingroup                         \color{black!20}                         \hrule height3ex                         \color@endgroup                         \tabularnewline                 }         \repeat         \makeatother         \pagestyle{empty}         \begin{document}         \begin{multicols*}{2}         \let\mcnewpage=\newpage         \makeatletter         \renewcommand\newpage{%                 \if@firstcolumn                         \hrule width\linewidth height0pt                         \columnbreak                 \else                         \mcnewpage                 \fi         }         \makeatother         \tablehead{Item \#&\\}         \begin{supertabular}{lp{1.5in}}         \tablebody         \end{supertabular}         \end{multicols*}          \end{document}


title: package keyval error: bibtex8 undefined

text: I'm using this CV template and it was working fine in the past. But now the same file gives the following error: > package keyval error: bibtex8 undefined I tried the following two different codes:               \usepackage[             sorting=ynt         , bibstyle=authoryear-comp         , labelyear=false         , defernumbers=true         , maxnames=20         , firstinits=true         , uniquename=init         , dashed=false          ]{biblatex}      and               \usepackage[         sorting=ynt     , bibstyle=authoryear-comp     , labelyear=false     , defernumbers=true     , maxnames=20     , firstinits=true     , uniquename=init     , dashed=false     , backend = bibtex8      ]{biblatex}      Any help in this regard will be highly appreciated.


title: How to produce 5-up 3by5 index cards

text: I want to produce instructional 3by5 index cards. It's easy enough to produce the cards one per page, but I want to print five copies of the same car on a single sheet of 8.5by11 card stock, where it is possible to produce five cards per page, two in portrait orientation on the left margin and three in landscape orientation on the right margin, at the top. Note that the back of the page has things reversed, with two cards in portrait orientation on the right margin and three cards in landscape orientation on the left margin, at the bottom. The orientation needs to be rotated for the landscape cards (the text should always appear in portrait mode) and small, very light cut marks should appear at the corners of the cards. A sample card is appended to this message. The logo at the top of the front of the card, and the copyright notice at the bottom of the front of the card, must always appear in the same place. The text will usually include some program code, as the sample card shows, and possibly some math, a tabular environment, or even a small line-drawing of a data structure. I am not particularly knowledgeable of LaTeX, using it mostly for simple things similar to what is shown below. I don't know where to start writing a macro to produce 5-up 3by5 cards. Can anybody help? Many thanks, Phil               % peasant multiplication          \documentclass{article}     \usepackage[pdftex]{graphicx}     \usepackage{wrapfig}          \setlength{\textheight}{4.75in}     \setlength{\textwidth}{2.75in}     \pagestyle{empty}     \addtolength{\parskip}{+0.3\baselineskip}          \begin{document} \begin{small}          \null \kern -\headheight \kern -\headsep \kern -\topskip \noindent       \includegraphics[width=2.75in]{ProgrammingPraxis.png}          \begin{figure}[b]\begin{minipage}{\textwidth}\tiny     Copyright \copyright 2012 by Programming Praxis.     All rights reserved.     See http://programmingpraxis.com for more information.     \end{minipage}\end{figure}          \begin{center}     \textbf{Peasant Multiplication}     \end{center}          When the Egyptians built the pyramids, they invented a method for multiplying two numbers using only halving, doubling, and addition. As an example, consider the product $83 \times 97 = 8051$:          \begin{center}     \begin{tabular}{rrr}     83 &   97 &   97 \\     41 &  194 &  194 \\     20 &  388        \\     10 &  776        \\      5 & 1552 & 1552 \\      2 & 3104        \\      1 & 6208 & 6208 \\ \cline{3-3}        &      & 8051     \end{tabular}     \end{center}          The algorithm starts by writing the two numbers to be multiplied at the head of two columns. Then repeatedly halve the number in the left column, ignoring any remainder, and double the number in the right column, writing the new numbers below their predecessors, until the left column reaches one. Finally, in a third column, the number in the second column is copied whenever the number in the first column of the same row is odd, and the numbers in the third column are summed, giving the product. The algorithm works using binary arithmetic: $97 \times 1 + 97 \times 2 + 97 \times 16 + 97 \times 64 = 8051$, where $1 + 2 + 16 + 64 = 83$ correspond to the positions of the odd numbers in the first column.          It is easy to operate the algorithm by hand using piles of pebbles in pairs. It is also easy to program the algorithm in a binary computer, where halving and doubling are trivial. In fact, in their internal microcode, most modern computers use exactly this algorithm to multiply two numbers.          A program to implement peasant multiplication performs the addition as it goes instead of waiting until the end:          \begin{footnotesize}\begin{verbatim}     function peasant(left, right)       prod := 0       while (left > 0)         if (left is odd)           prod := prod + right         left := halve(left)         right := double(right)       return prod     \end{verbatim}\end{footnotesize}          It is amazing, and humbling, to think that modern computers owe a four-thousand year old debt to those ancient mathematicians.          \end {small} \end{document}      EDIT: Thanks for the reference to flashcards, but it doesn't do what I want. I want continuous formatting, not a separate front and back. And I want five cards, not four, because I expect to make lots of cards, which means I have to rotate the text. I'm thinking about somehow formatting a single card, front and back, using a 3by5 page size, capturing the output in PostScript, and using PostScript to print the 5-up cards. But I don't know enough about PostScript, either. Any suggestions are welcome.


title: Multilingual text with if statement

text: I'm working on a document in LaTeX and I would like to have multiple language versions. I could just copy everything and translate, but this would lead to multiple versions that I would have to update individually every single time. What I want is that I specify which language I want to compile (or perhaps it always compiles all the languages, so every time I run it saves for instance an english, dutch and german version). And then it only prints that language. I was thinking of something along the lines of:               \languageversion{english} %this could be changed for language specification          \begin{document}     ...     \dutch{some dutch text here}     \english{some english text here}     \german{some german text here}      So when I select english, only the english part would be printed. This way, if I would change the layout I don't have to do this for multiple versions, but only in one. Is this possible?


title: Texstudio: Autocompletion of xparse commands

text: I have defined a new command using xparse, but the command doesn't show up in the autocomplete. Furthermore the definition of the command is in red: ![1](http://i.imgur.com/SdHf2Nc.png) The command is working, but it just doesn't show up in autocomplete. I am using TexStudio.


title: How can I change fonts within the sciposter class?

text: It seems like the font choice is somehow embedded in the document class itself; I've tried choosing fonts the usual way, but with no effect.


title: eqref in reftex

text: I'm using Emacs + AUCTeX + refTeX. I've added `(setq reftex-plug-into-AUCTeX t)` to my `init.el`file and everything seems to work fine except for one thing. When I choose to reference a label using `C-c )` it doesn't offer me `\eqref`as reference style which I understand it should given that I'm using AUCTeX and having enabled the plugging-in functionality. Thanks!


title: Updating tlmgr 2011 to 2012

text: When I run               # tlmgr update --self      This is the reply I get:               tlmgr: package repository ftp://ftp.riken.go.jp/pub/tex-archive/systems/texlive/tlnet     /usr/local/texlive/2011/bin/x86_64-linux/tlmgr: The TeX Live versions supported by the repository     (2012--2012)     do not include the version of the local installation     (2011).  Goodbye.      Could anyone guide me on how to update tlmgr to 2012? Do I have to uninstall and install TeX Live all over again? Thanks in advance Update: I use Scientific Linux


title: CJK and code highlighting

text: I need to add a JSON snippet that contains a few Japanese characters to my document. I'm able to use Japanese characters using CJK package and highlight my code using minted or lstlistings, but is there any way to use Japanese characters inside the highlighted code?


title: any nice book templates for math-based topics?

text: I am looking around for nice book templates, and I am quite disappointed. I found similar questions on tex.stackexchange (e.g. Good LaTeX template for book about maths), but the book templates usually offered are either "book", "amsbook" or springers book template. All of them I find rather disappointing, I am looking for something slightly more colorful or more polished. I guess publishers don't publish latex templates for their book style, but is there anyone who is aware of a book template which is more polished/professional-looking/colorful than the amsbook template?


title: Vertical alignment in tabular cells with variable height

text: I have the code:               \documentclass{article}     \usepackage[a4paper]{geometry}     \usepackage{tabularx}     \usepackage{lipsum}     \begin{document}     \begin{tabularx}{\textwidth}{ | X | c | }       \hline       \lipsum[1] & top\\       \hline       \lipsum[1] & center\\       \hline       \lipsum[1] & bottom\\       \hline     \end{tabularx}     \end{document}      Gives this: ![enter image description here](http://i.stack.imgur.com/YNGB5.png) The top column is already aligned top. How can I vertically align the center column at the center? And the bottom column at the bottom?


title: Vertically center text in tabularx table

text: How to center text vertically in this table?               \begin{center}       \begin{tabularx}{\linewidth}{ | c | X | X | }         \hline           \textbf{Date} & \textbf{Name} & \textbf{Sign} \\         \hline           31.03.2013 & & \\         \hline       \end{tabularx}     \end{center}      Changing package is not a solution for me. How to do it in tabularx?


title: some PostScript specials could not be rendered (tcolorbox+DVI)

text: I can't see `tcolorbox` in DVI file after running LaTeX. The error is               "MiKTeX Problem Report Message: Some PostScript specials could not be     rendered. Data: Error: /undefined in pgfo Operand stack:        --nostringval--   PermitFileReading   --nostringval--   PermitFileWriting   --" ...      The same problems occurs when drawing something with the TikZ package. Since `tcolorbox` is related with TikZ, this error happens. My setup:   * MiKTeX 2.9 (it's required to run LaTeX, not PDFLaTeX or TeXify)   * WinEdt 2.9   * Yet Another Previewer 2.9.4206


title: Link to equation and change text?

text: I am interested in linking to an equation - but being able to change the text. I had thought I could combine this answer and this answer, but I cannot seem to get it to work. I have attempted a variety of syntaxes similar to               \hyperref[eq:name]{my text describing the equation here}      but I cannot seem to get it to work. * * * This is the code I am currently using (well my equation is considerably more complicated but I have the same problem here)               \begin{align*}       y = x\label{testp}     \end{align*}     \hyperref[testp]{generalized form}      I get the following warning               LaTeX Warning: Hyper reference `testp' on page 4 undefined on input line 108.


title: assistance on good handling of text on TikZ paths

text: I am putting together an ornate logo using TikZ. The logo as it is currently is as follows: ![example of ornate logo using TikZ](http://i.imgur.com/RgjCx.png) I request assistance on handling the lowermost outer text (which reads "UNIVERSITY OF GLASGOW"). For the purposes of easy legibility, I would like the text to be inverted with respect to what it is now. I'm relatively new to TikZ and I'm not sure how to approach the problem. Comments on improving the code generally also are welcome. The code is as follows:               \documentclass[11pt]{scrartcl}     % TikZ         \usepackage{tikz, pgfornament, tikzrput}         \usetikzlibrary{decorations, decorations.text}      % font size         \usepackage{fix-cm}     % cryillic font         \usepackage[OT2, OT1]{fontenc}         \newcommand\cyr{%             \renewcommand\rmdefault{wncyr}%             \renewcommand\sfdefault{wncyss}%             \renewcommand\encodingdefault{OT2}%             \normalfont             \selectfont         }         \DeclareTextFontCommand{\textcyr}{\cyr}         \def\Eoborotnoye{\char3}         \def\eoborotnoye{\char11}         \def\cprime{\char126}         \def\cdprime{\char127}     \begin{document}         \begin{tikzpicture}             % outer circle                 \draw[line width=2 mm] circle[radius=7.4 cm];             % inner circles                 \draw[ultra thick] circle[radius=6 cm] circle[radius=7 cm]  ;             % outer text                 \path[                     rotate=-15.2,                     postaction={                         decoration={                             text along path,                             text format delimiters={|}{|},                             text={                                 |\Huge|                                 {\pgfornament[scale=.4, ydelta=-9 pt]{15}}                                 UNIVERSITY OF GLASGOW                                 {\pgfornament[scale=.4, ydelta=-9 pt]{15}}                                 OFFICIAL DRINK PARTICLE PHYSICS EXPERIMENT                             },                             text align=fit to path,                             reverse path                         },                         decorate                     }                 ]                 circle[radius=6.2 cm];             % top ornamentation                 \rput{-30}(2.5, 4.2){\pgfornament[scale=.4]{87}}                 \rput{30}(-2.5, 4.2){\pgfornament[scale=.4]{87}}              % bottom ornamentation                 \rput(0, -2.5){\pgfornament[scale=.7]{75}}             % right ornamentation                 \rput{-90}(5, 0){\pgfornament[scale=.6]{72}}             % left ornamentation                       \rput{90}(-5, 0){\pgfornament[scale=.6, symmetry=v]{72}}               % central text                 \node[font=\fontsize{35}{60}\selectfont] at (0, 2.5){P.P.E.};                 \node[font=\fontsize{60}{60}\selectfont] at (0, 0.5){{\cyr k v a s}};                     \node[font=\huge] at (0, -5){MMXII};         \end{tikzpicture}     \end{document}      many thanks for your assistance


title: Defining a new binary operator

text: I am trying to find a way to define the `%` symbol as a binary operator that behaves essentially like the `+` symbol. I have heard of the command `DeclareMathOperator`, but I was under the impression that this was for operators like the logarithm and sine functions. What is an appropriate command? An an example, I would like the following to lines to have similar spacing.               \begin{equation*}     a % b % c     \end{equation*}     \begin{equation*}     a + b + c     \end{equation*}


title: How to ask hyperref works only with href

text: How to ask `hyperref` works ONLY with `\url` and `\href` commands?


title: Use courier font inline on text

text: If I want to apply the courier font to a small piece of text in my file, how can I do that? I have searched around but can't seem to find information for the courier font.


title: How to replace (unicode) characters by ü,ğ,ş etc.?

text: \documentclass[11pt,a4paper]{article}     \usepackage[utf8x]{inputenc}     \usepackage{ucs}     \usepackage{amsmath}     \usepackage{amsfonts}     \usepackage{amssymb}     \usepackage{graphicx}     \usepackage[T1]{fontenc}     \usepackage{listings}          \lstset{ literate={â}{{\^{a}}}1 {Â}{{\^{A}}}1 {ç}{{\c{c}}}1 {Ç}{{\c{C}}}1 {ğ}{{\u{g}}}1 {Ğ}{{\u{G}}}1 {ı}{{\i}}1 {İ}{{\.{I}}}1 {ö}{{\"o}}1 {Ö}{{\"O}}1 {ş}{{\c{s}}}1 {Ş}{{\c{S}}}1 {ü}{{\"u}}1 {Ü}{{\"U}}1}               \begin{document}     %Normal environment:          %ğ instead of \U{11f}      %ı instead of \U{131}      %ş instead of \U{15f}      %Ğ instead of \U{11e}     %İ instead of \U{130}     %Ş instead of \U{15e}          %Listing environment:     \begin{lstlisting}     ğ instead of \U{11f}      ı instead of \U{131}      ş instead of \U{15f}      Ğ instead of \U{11e}     İ instead of \U{130}     Ş instead of \U{15e}     \end{lstlisting}          \end{document}      the command \U{} comes automatically and i need to convert them to "ğışİç" characters. I can use ğ,ü,ş,... characters in listing environment using \lstset. I need a command to replace `\U{11f}` by ğ, `\U{131}` by ı etc... this should be in both normal environment and lstlisting environment given above. Thanks in advance.


title: Are \end.... macro names reserved in LaTeX2e?

text: Perhaps this question has been asked before, but I could not track the correct question down. I stumbled accidentally over this _feature_ : Say, I want to make a `\newcommand{\supersophisticatedmacroname}{Hello}` definition and then something like an end-of-environment command `\endsupersophisticatedmacroname` but this fails:               ! LaTeX Error: Command \endsupersophisticatedmacroname already     defined.                    Or name \end... illegal, see p.192 of the manual.      I could understand the error message, if I would say `\newcommand{\endtable}` etc, as those names are defined of course, marking the end of environments. But I am pretty sure, that there is no such command (think of the macro name ;-)) in any sensible class. Does LaTeX prevent definition of commands beginning with `\end...`? Why? Just to make the conceptual implementation of environments easier? ## Here is a non-MWE               \documentclass{book}          \newcommand{\supersophisticatedmacroname}{Hello}%          \newcommand{\endsupersophisticatedmacroname}{World}% fails     \newcommand{\endandnowforsomethingcompletelydifferent}{World}% fails too.               \begin{document}%     Hello World          \supersophisticatedmacroname               \end{document}      Plain TeX does not complain:               \def\supersophisticatedmacroname{Hello}%     \def\endsupersophisticatedmacroname{World}%                    \supersophisticatedmacroname          \bye      **Edit** As Manuel states in his comment,               \def\endsupersophisticatedmacroname{...}      will even work in LaTeX. **Edit** There are four (!!) good answers to my question -- I have thought about accepting one and I know, this means, I must 'disappoint' three other, equally highly qualified users here.


title: Enumerate and itemize undefined + captions not working

text: I am trying to recompile a document in kwrite; I previously compiled it all OK under debian squeeze about 6 months ago, but I now have an opensuse 11.2 (kwrite-4.3.5-0.1.1.x86_64). A few problems have cropped up in the recompile 1) \begin{enumerate}...\end{enumerate} are undefined 2) \begin{itemize}...\end{itemize} are also undefined 3) all my captions now lead to undefined control errors Example output:               1)          ! Undefined control sequence.     \enit@endenumerate ->\enit@after                                       \endlist \enit@toks \expandafter {\enit@sav...     l.163 \end{enumerate}          2)     [9]     ! Undefined control sequence.     \enit@enditemize ->\enit@after                                     \endlist \enit@toks \expandafter {\enit@savek...          3)     ! Undefined control sequence.     \captiontextfont@default ->\cpb@font           l.144 ...d compositions as estimated by weighing.}      Any advice? Also, the captcha on this site is really broken. disabling javascript just throws a (framed) content-length required error and shows a google page (WTF?) Secondly, I had to enter it in 4 times (after enabling javascript) because (I didn't have tags, I had invalid tags, I had a bad captcha (unreadable) and then I got a good one); Is there somewhere I can report this? Edit:   * Could not report bug. Would not let me post my question "your openID (?) is incorrect", but there was no field (even with javascript) to enter this. ???   * Here is the minimal example that was asked for in the discussion (Am I meant to just keep editing my posts??)               \documentclass[a4paper,12pt,openright,twoside]{thesis}               \usepackage{enumitem}     \usepackage{paralist} %fancy list of figures          \title{A b C d e f g}          \author{me}\vspace{4ex}     \date{2010}          \begin{document}          \pagestyle{empty} \hspace{1pt} \pagebreak               \pagestyle{plain}          \begin{abstract}     \addcontentsline{toc}{chapter}{Abstract}     \vspace{1ex}     Stuff.          \end{abstract}          \cleardoublepage          {          \cleardoublepage     \mbox{}     \cleardoublepage          %back to 1,2,3 style numbering     \pagenumbering{arabic}          \begin{itemize}      \item One     \end{itemize}          \end{document}      Caption minimal example:                    \documentclass[a4paper,12pt,openright,twoside]{thesis}     \usepackage[pdftex]{graphicx}     \usepackage{caption}     \title{asdf}     \author{me}\vspace{4ex}          \date{2010}          \begin{document}          \begin{abstract}     Lalalla     \end{abstract}          \begin{figure}     \includegraphics[width=0.95 \textwidth]{test.png}     \caption{Caption test}     \label{fig:test}     \end{figure}          \pagestyle{empty}     \thispagestyle{plain}               \end{document}                This results in:                 ! Undefined control sequence. \captionlabelfont@default ->\cph@font l.19 \caption{Caption test} ! Undefined control sequence. \captionlabelfont@default ->\cph@font l.19 \caption{Caption test} ! Undefined control sequence. \captiontextfont@default ->\cpb@font l.19 \caption{Caption test} ! Undefined control sequence. \captionlabelfont@default ->\cph@font l.19 \caption{Caption test} ! Undefined control sequence. \captionlabelfont@default ->\cph@font l.19 \caption{Caption test} ! Undefined control sequence. \captiontextfont@default ->\cpb@font l.19 \caption{Caption test}      [2 ] (./test.aux) ) (see the transcript file for additional information) Output written on test.pdf (2 pages, 471338 bytes). Transcript written on test.log.


title: Citation in plain text

text: I need to cite a paper at the end of a quotation right after the end of the text in beamer. In my example the reference appears after the text, _but_ in italics. How can I change it to the normal font? ![enter image description here](http://i.stack.imgur.com/hn7nI.png)


title: How to place an image at the right top of a document?

text: I've been learning LaTeX and this community has been very helpful. Currently, I'm trying to set up corporate letters but as a newbie I'm encountering a variety of challenges, so I'm posting them one by one instead of putting it in the comments... maybe this helps others as well. Anyway, I am trying to implement this answer that indicates that I can use `vbox` to float an image to the right of my header. I almost have this working, but I now try to adjust this to get my logo to stick to the top of the page. So I want to have this at the **right top** of my document. This is quite difficult! When I place the `vbox`, it creates unwanted spacing, for some odd reason. So I can not get the logo to be at the right top, even though I 'reset' every possible margin to 0 (in my opinion). Here is my distilled code:               \documentclass[a4paper]{article}     \usepackage{graphicx}     \graphicspath{{./img/}}     \usepackage{color}     \usepackage{xcolor}     \definecolor{orange}{HTML}{DD4616}     \definecolor{white}{HTML}{FFFFFF}     \usepackage{fullpage}     \usepackage[margin=0cm, paperwidth=215.9mm, paperheight=30mm,top=0cm]{geometry}     \parindent=0pt          \begin{document}     \fboxsep0pt          \pagecolor{orange}               \fbox{\vbox to 0pt{\hfill\fbox{\includegraphics[height=3cm]{logo}}}}          \end{document}      I've used a full black logo for illustrative purposes. Here you can see this: ![enter image description here](http://i.stack.imgur.com/3ZPkn.png) The black line is the `vbox` border. For some reason, it jumps down. The only way to get rid of this that I found out about is this: Make an invisible vbox Which means that I need to add:               \edef\theprevdepth{\the\prevdepth}\nointerlineskip     \vbox to 0pt{...}\prevdepth=\theprevdepth      But there are two problems with this:   * I get an error with I try this (Improper `\prevdepth`.)   * More importantly, I really want to understand my code at this point, and get to master the basics of positioning elements. This feels overcomplicated and I do not understand it at all.  Is there any easy way to position an image at the right top of a document?


title: Vertical alignment in tabular with fbox

text: I have problems with vertically aligning content in my single row header table for an invoice template. Currently it looks like this: ![example](http://i.stack.imgur.com/LCJCO.png) What do I have to do to   1. align the top fbox to the top of the right cell?   2. align the bottom fbox to the bottom of the right cell?              \documentclass[10pt,a4paper]{article}     \usepackage[MeX]{polski}     \usepackage[utf8]{inputenc}          \setlength{\marginparwidth}{0pt}     \setlength{\parindent}{0pt}          \usepackage[     top    = 1.50cm,     bottom = 1.50cm,     left   = 1.50cm,     right  = 1.50cm]{geometry}          \usepackage{tabularx}          \pagestyle{empty}          \renewcommand{\familydefault}{\sfdefault}          \newcommand{\datasprzedazy}{3.03.2006}     \newcommand{\terminplatnosci}{17.03.2006}     \newcommand{\nrfaktury}{3/2006}      \newcommand{\netto}{1000.00}      \newcommand{\vat}{220.00}     \newcommand{\brutto}{1220.00}     \newcommand{\slownie}{jeden tysiąc dwieście dwadzieścia złotych}          \begin{document}          \renewcommand\arraystretch{1.3}     \renewcommand\tabcolsep{0pt}          \begin{tabularx}{\linewidth}{ X X }         \begin{minipage}[t]{0.47\textwidth}             \fbox             {                 \parbox[t]{\textwidth}                 {                     \begin{minipage}[t]{0.5\textwidth}                         \begin{tabular}[t]{l l }                         Company Name & Logo\\                         Address & \\                         Street & \\                         Tax ID &\\                         Other Info                         \end{tabular}\par\medskip                     \end{minipage}                   }             }         \end{minipage}     &         \begin{minipage}[t]{0.47\textwidth}             \framebox[\textwidth]{\textbf{Faktura VAT nr \nrfaktury}} \par             \begin{tabular}{lr}             Data sprzedaży: & \datasprzedazy \\             Data wystawienia: & \datasprzedazy             \end{tabular}             \framebox[\textwidth]{\textbf{ORYGINAŁ}} \par          \end{minipage}     \end{tabularx}     \end{document}


title: Specify directories to check by the PGFplots addplot command

text: When I produce a graph with `PGFplots`, I first test it, before importing it in my main document `tex` file. I have the file `tikzpicture.tikz` in which the tikzpicture environment data is included, and I have the file `tikzpicture_standalone.tex` with the minimal content               \documentclass{article}     \usepackage{pgfplots}     \pagestyle{empty}     \begin{document}         \input{tikzpicture.tikz}     \end{document}      to 'test' the picture. In `tikzpicture.tikz` I use the command `\addplot{table.txt}`, where `table.txt` is in the same directory. The testing goes fine. When I then use the \input command to call `tikzpicture.tikz` in my main `tex` file, which is in another directory, it obviously does not work as `table.txt` is not in the same directory anymore. I have to use `path/table.txt` instead. Changing this for all table data every time is annoying and inefficient, so I was wondering if there is a way to let the `\addplot` command check the local directory too, for the file `table.txt`. Then, I would not need to add the file paths all the time.


title: How to compile dvisvgm with texlive 2009?

text: I am rolling out my own `mathview.el` (similar to `preview.el` but aim to be more efficient) package for editing LaTeX in emacs. Currently it uses `dvipng` but I would like to use `dvisvgm` as an alternative. Could someone share how they compile `dvisvgm` with TeX live 2009 installed to `/usr/local/texlive/2009`? The reason I am considering using `dvisvgm` is that text in pngs doesn't look as thick as normal text in emacs buffer. See this image ![mathview](http://i.stack.imgur.com/M6Z99.png). I am using Snow Leopard 10.6.4. Thanks. **Update:** I don't mind if this question is deleted. Basically the header files of kpathsea must be available. But my tl2009 installation is incomplete so I stopped trying. Also `dvipng` has a --gamma option to change the darkness of the font, which can be adjusted to make images blend better with text in emacs.


title: cannot determine size of graphic in (no boundingbox) pdf images

text: I know that this may seem duplicated. But the problem is my code is running perfectly on my laptop. I just got this new PC in my office. Installed MiKTeX and then TeXmaker. And now that I'm running the same code, I got this error: > cannot determine size of graphic in (no boundingbox) I'm using PDF files for my graphics. Here is an example of my code:               \begin{figure}         \begin{center}             \includegraphics[width=1\textwidth]{testsys_8.pdf}         \end{center}         \caption{Single line diagram of the study system}             \label{testsys}     \end{figure}


title: Distinguishing between comma in list of numbers and in text

text: I am writing the following mathematical definition:               ... where for $i=1,\dotsc,n$, $Ag_i=(AS_i,\mathscr{K}_i)$, ...      which produces: ![enter image description here](http://i.stack.imgur.com/z0IVt.png) There are two kind of commas, one in `1, …, n` and the other after `n` which is in text. How is it possible to make the two kinds of commas distinguishable so then it does not appear as though there is a missing formula after `n`.


title: How do I get Texmaker to use the central bibliography?

text: Like many others I wish to place my bibliography (`.bib`) file in a central location so that all my disparate writings do not need a .bib rider with them (and so all are updated automatically when I update the central .bib file). Unlike many others the following thread did not help: Creating a central bibliography It did not help because the location specified to locate the file does not exist on my machine. I am running OSX and (I believe) MacTex with TexLive. Many different sources agree that the central .bib file should live in the Tex tree. Most further agree that it should sit in the following file: > ~/Library/texmf/bibtex/bib/local However the closest equivalent file I can find is: > /usr/local/texlive/texmf-local/bibtex/bib/local Placing the `.bib` file in this folder yields a 'cannot find' error from Bibtex when run in TexMaker. Taking the same file and placing it in the folder of the `.tex` yields a perfect bibliography. I conclude that the location of the `.bib` is the problem (not naming or reference in the `.tex` or any other failure with the setup of the `.tex` and `.bib` respectively). There seems to be something idiosyncratic about the location of my `TeX` tree and I know TexMaker can have specific problems but 2+ hours of reading `TeX` forums (which largely go over my head) has not solved the problem. Please help.


title: TikZ newbie issues when drawing a somewhat complex diagram

text: I need a whole bunch of images and someone advised me to use Tikz and it seems like it can probably do exactly what I want, however I haven't been able to find some things and I feel like I've been hacking code together in a poor way. I made an example of what I want in paint: ![](http://imgur.com/nlyJxOq.png) It's basically a diagram with different types of nodes, text on the ends of edges, different types of arrows, including some with a box in the middle that may or may not have text in them, and text labels near the nodes. What I have so far is:               \documentclass{article}     \usepackage{tikz}          \usetikzlibrary{arrows,automata}          \begin{document}     \begin{tikzpicture}[narray/.style={circle,fill=white,draw},node distance=3cm,                     norm/.style={circle,fill=black,draw,minimum size=0.2cm}]            \node[narray] (q1) {\tikz\draw[black, fill=black] (0,0) circle (.7ex);} ;       \node[norm] (p1) [right of=q1] {};            \path         (q1) edge [->,>=latex',thick] node[above] {A} (p1);     \end{tikzpicture}     \end{document}      which makes ![](http://i.imgur.com/HjlgWKG.png) I feel like using the label to draw the inner circle is the wrong way to do it and I don't know how to get the text there and make the other kinds of arrows that I need. Can someone point me in the right direction?


title: How do I make placements within my resume?

text: I'm currently writing a resume. Consider the below LaTeX bit of code:               \documentclass[10pt]{article}          \usepackage[scaled]{helvet}     \renewcommand*\familydefault{\sfdefault} %% Only if the base font of the document is to be sans serif     \usepackage[T1]{fontenc}     \usepackage[none]{hyphenat}          \usepackage[margin=2cm]{geometry}     \title{\bfseries\Huge Jo Bloggs}     \author{1 Blogg Road, London, London, WC1 1AA \\ bloggs@bloggs.com}     \date{}          \usepackage{array, xcolor}     \usepackage{lipsum}     \definecolor{lightgray}{gray}{0.8}     \newcolumntype{L}{>{\raggedleft}p{0.14\textwidth}}     \newcolumntype{R}{p{0.8\textwidth}}     \newcommand\VRule{\color{lightgray}\vrule width 0.5pt}          \begin{document}     \maketitle     \pagenumbering{gobble}     section*{Experience}     \begin{tabular}{L!{\VRule}R}     July '13--Present&{\bf Intern and Intern UK, United Kingdom}\\     &Doing interny stuff on two different placements\\[2.5pt]\end{tabular}     \end{document}      It's great and what I require for my needs bar one crucial element. However, I want to be able to create a sub-section within this experience for me two write separately about two different placements. So I want it to read:               July '13 - Present Intern at Intern UK, United Kindom Doing interny stuff on three different placements           Placement 1: Coffee holder and maker                        I made the coffee whilst pretending to like my colleagues.                Placement 2: Photocopier master                        Can do single/double-sided photocopying at graduate level.      Any advice?


title: Matrix with outer elements keep visual consistency

text: I am tying to figure out what is the best method to write a matrix with outer elements in the first row and column. Below is the code using `array` `blkarray` and `kbordermatrix` packages. As it can be seen, the `[]` in `blkarray` does not expand as in `\left[ \right]` when using `array`. Also the visual appearance of `kbordermatrix` is somehow different from the `array`. On the other hand, with `array` I am not able to get the outer indexes. I would prefer to use something based on `array` to keep the visual consistency throughout the document or change `blkarray` / `kbordermatrix` so that a similar result can be achieved.               \documentclass{article}          \usepackage{mathtools}     \usepackage{array}     \usepackage{blkarray}     \usepackage{kbordermatrix}          \begin{document}          \begin{equation}         P =         \begin{blockarray}{ccccc}                    & BS_1    & BS_2    & \ldots & BS_B    \\          \begin{block}{c[cccc]}             UE_1   & P_{1,1} & P_{1,2} & \ldots & P_{1,B} \\             UE_2   & P_{2,1} & P_{2,2} & \ldots & P_{1,B} \\             \vdots & \vdots  & \vdots  & \ddots & \vdots  \\             UE_U   & P_{U,1} & P_{U,2} & \ldots & P_{U,B} \\         \end{block}         \end{blockarray}     \end{equation}          \begin{equation}         P = \left[         \begin{array}{c|cccc}                    & BS_1    & BS_2    & \ldots & BS_B    \\ \hline             UE_1   & P_{1,1} & P_{1,2} & \ldots & P_{1,B} \\             UE_2   & P_{2,1} & P_{2,2} & \ldots & P_{1,B} \\             \vdots & \vdots  & \vdots  & \ddots & \vdots  \\             UE_U   & P_{U,1} & P_{U,2} & \ldots & P_{U,B} \\     \end{array} \right]     \end{equation}          \begin{equation}         P =         \kbordermatrix{%                & BS_1    & BS_2    & \ldots & BS_B    \\         UE_1   & P_{1,1} & P_{1,2} & \ldots & P_{1,B} \\         UE_2   & P_{2,1} & P_{2,2} & \ldots & P_{1,B} \\         \vdots & \vdots  & \vdots  & \ddots & \vdots  \\         UE_U   & P_{U,1} & P_{U,2} & \ldots & P_{U,B}       }     \end{equation}          \end{document}      ![enter image description here](http://i.stack.imgur.com/8P6cP.png)


title: Getting error using \MakeUppercase with tocloft

text: Trying to use `tocloft` package to customize a table of contents, but I am running into errors using `\MakeUppercase` or `\uppercase` with certain commands, namely `\cftsecfont`. When I run the following code I get errors suggesting there are missing or extra `}`s. Similar errors when I replace `\MakeUppercase` with `\uppercase`. If I delete that command entirely it runs with no errors.               \documentclass{article}     \usepackage{tocloft}     \begin{document}     \renewcommand{\cftsecfont}{\bfseries\MakeUppercase}     \tableofcontents     \section{Section One}     \subsection{Subsection}     \section{Section Two}     \end{document}      Similar errors using `\cftsubsecfont`, etc. What am I doing wrong?


title: Delayed expression evaluation giving wrong result

text: I have made my own lists. I want to refer to them outside the lists. If I do a calculation using counters at a certain point in my list hierarchy, say `\alph{listcounter}`, how do I freeze that result at the point I'm calculating it so that when I refer to it later it has the original calculated value. LaTeX delays the calculation of `\alph{listcounter}` until I eventually put it onto a page at which point the `listcounter` value is inappropriate. I am determined not to use a readymade list package and really need a solution to this problem for general use. What I'm after is a way to freeze the result into a variable, and not the calculation that produces it. I can freeze strings like this in a file and that's overkill I think, but it shows the string can be frozen. The string I'm using has no formatting as that was creating all kinds of bother as well. I realise that generalising this routine for multiple references is going to be a nightmare all its own but the following code is deliberately trivial to demonstrate the problem. What is the usual way of saving a snapshot of the value of an expression? I'm a newbie here but only a seminewbie with LaTeX. I've had a great deal of help from this site in the past. Much appreciated.               \documentclass[12pt]{article}          \usepackage{amsmath}          \newcommand{\makeref}{Q\arabic{numqpoints}(\alph{numapoints})}          \def\qmg{1.4em}\def\amg{1.4em}          \newcounter{listnest}\setcounter{listnest}{1}     \newcounter{reftype}          \newcommand{\setlistbody}[1]     {     \setlength\parsep{3pt}     \setlength\labelsep{3pt}     \setlength\labelwidth{1.6em}     \ifnum\value{listnest}=1         \setlength\leftmargin{0pt}     \else         \setlength\leftmargin{\ifcase#1\or\qmg\or\amg\fi}     \fi     \setcounter{reftype}{#1}     \stepcounter{listnest}     }          \newcounter{numqpoints}     \newenvironment{qpoints}     %     {\begin{list}     {{\bf Q}\,\arabic{numqpoints}}     {\usecounter{numqpoints}\setlistbody1}     }     {\end{list}         \addtocounter{listnest}{-1}         \setcounter{numqpoints}{0}     }          \newcounter{numapoints}     \newenvironment{apoints}     %     {\begin{list}         {(\alph{numapoints})}         {\usecounter{numapoints}\setlistbody2}     }     {\end{list}         \addtocounter{listnest}{-1}         \setcounter{numapoints}{0}     }          \newwrite\tempfile     \newcommand{\freezestring}[1]     {     \immediate\openout\tempfile=lists.tex     \immediate\write\tempfile{#1}     \immediate\closeout\tempfile     \global\def\savestring{\input{lists}}     }          \begin{document}     %     \begin{qpoints}     \item One     \item Two         \begin{apoints}         \item AAA         \item \freezestring{\makeref} \global\def\varstring{\makeref}         BBB Here is what I want: \savestring         \end{apoints}     \end{qpoints}     %     \par Here is what I get with a variable: \varstring     %     \par Here is what I get with a file: \savestring     %     \end{document}      Addendum 1: Okay, now that seems to be solved in a basic way, I'll move this to the next level of complication. I need flexibility in putting these strings together as I want the list levels used in various combinations. I know how to keep track of which level is which so I'll just focus on the next reference string problem. Using loops to construct a string breaks the `\xdef` solutions as provided. The following loop works on its own but crashes inside the `\xdef`. My loop code follows. Am I asking too much now?               \newcounter{nexttype}     \newcommand{\printref}     {     \setcounter{nexttype}{1}%     \loop%     \ifcase\value{nexttype}%     \or Q\arabic{numqpoints}%     \or (\alph{numapoints})%     \fi%     \ifnum\value{listnest}>\value{nexttype}%     \stepcounter{nexttype}%     \repeat%     }      Addendum2: Okay, I'm clearly not asking too much because I solved this myself. It dawned on me that I could just append stuff to the original on the fly variable so nothing nasty had to be passed to it directly.               \newcommand{\makerefvar}[2]{\expandafter\xdef\csname Wiz#1\endcsname{#2}}     \newcommand{\getref}[1]{\csname Wiz#1\endcsname}          \newcounter{thistype}     \newcommand{\makeref}[1]     {     \makerefvar{#1}{}\getref{#1}     \setcounter{thistype}{1}%     \loop%     \ifcase\value{thistype}%     \or \makerefvar{#1}{{\getref{#1}Q\arabic{numqpoints}}}%     \or \makerefvar{#1}{\getref{#1}(\alph{numapoints})}%     \or \makerefvar{#1}{\getref{#1}\roman{numrpoints}}%     \fi%     \ifnum\value{listnest}>\value{thistype}%     \stepcounter{thistype}%     \repeat%     }


title: Mathtools: Automatic italic corrections before math not working when combined with ~

text: In `mathtools`, I've noticed that the automatic italic correction before math doesn't work when combined with `~`. For instance, in               \documentclass{article}          \usepackage{mathtools}          \begin{document}          \begin{quote}\itshape     Compare these lines: \par     \mathtoolsset{mathic} % or \mathtoolsset{mathic=true}     Subset of \(V\) and subset of \(A\). \par     Subset of~\(V\) and subset of~\(A\). \par     \mathtoolsset{mathic=false}     Subset of \(V\) and subset of \(A\).     \par     \end{quote}          \end{document}      you can see that the line with the `~`'s has no italic corrections before the math italic letters: ![A snapshot of the result](http://i.stack.imgur.com/0XRmz.png) I emailed the `mathtools` team about this, and they said they'd put it on their to-do list, but in the meantime I thought I'd see if anyone here knows to fix it. Maybe the redefinition of `\\(` in `mathtools` needs to use `\sw@slant`?


## Constraints: I have to use top aligned `aligned` to let the baseline of the top equation be aligned with the enumerate label. ## Issues: The curly brace goes beyond the top equation so it does not look good. ## Questions: How to prevent the opening curly brace from going out over the top equation?               \documentclass[preview,border=12pt,12pt,varwidth]{standalone}     \usepackage{mathtools,enumitem}          \begin{document}     Find the solution of     \begin{enumerate}[label=\alph*.]         \item          $\!         \left\{         \begin{aligned}[t]             2x +5y &=12\\             3x -8y &=11         \end{aligned}         \right.         $         \item          $\!         \left\{         \begin{aligned}[t]             -2x -3y &=7\\             x -2y &=1         \end{aligned}         \right.         $     \end{enumerate}     \end{document}      ![enter image description here](http://i.stack.imgur.com/zxUVD.png)


title: Are there any commands for extracting pictures (not only bitmap graphics but also line drawings) from a pdf file?

text: I know that `pdfimages` can extract bitmap graphics from a pdf file. But what if the embedded image is some line drawings, e.g., an image generated by some TikZ code in LaTeX? Assumption: the pdf file is a certain scientific paper. It could contain multi figures on one page. (Sorry that I did not mention this.) **EDIT** I just need the high quality picture. It seems the picture is generated by some tikz commands (it's a vector picture for sure). Well, it's nice to know the commands for generating that picture, but I did not expect that would be possible. **EDIT2** I'm using the `trim` & `clip`, options of `\includegraphics` now, but still looking forward to some automatic extraction commands.               \documentclass{standalone}     \usepackage{graphicx}          \begin{document}         \includegraphics[trim = 15mm 113mm 110mm 130mm, clip]{a-single-page-pdf-file}     \end{document}      **EDIT3** Add a ruler, just to make it easier               \documentclass{standalone}     \usepackage{graphicx}     \usepackage{tikz}          \begin{document}         %\includegraphics[trim = 1.5cm 11.3cm 11cm 13cm, clip]{single-page-pdf}              \begin{tikzpicture}             \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics{single-page-pdf}};             % A4 paper size: 21.0 × 29.7             \draw[help lines,xstep=1,ystep=1] (0,0) grid (21,29.7);             \foreach \x in {0,1,...,21} { \node [anchor=north] at (\x,0) {\x}; }             \foreach \y in {0,1,...,29.7} { \node [anchor=east] at (0,\y) {\y}; }         \end{tikzpicture}          \end{document}


title: Equation - Defining boundaries

text: What is a better way or method to define region boundaries. For example, the following piece of code.               \begin{align}     &2 \pi  R\left[q_x-p_x,q_y-p_y\right].&\text{  for,  } \left[p\leq Q_0\right]\\     &0.\text{ }&\text{  for,  } \left[p>Q_0\right]     \end{align}      That gives an output of : ![Out](http://i.stack.imgur.com/7y8yt.png) Is there a better way to represent such boundary equations or this is the right way to do it. Thanks.


title: Add symbol field to \newglossaryentry in \newcommand

text: This is a continuation of my question question. For a given code I would like to add symbol. For example: `\mathgloss{m}{mass}{kg}` MWE:               \documentclass{report}     \usepackage{enumitem}          \usepackage[colorlinks]{hyperref}     \usepackage{glossaries}     \makeglossaries          \newcommand{\mathgloss}[2]{%         \newglossaryentry{#1}{name={#1},description={#2}}%         \begin{description}[labelwidth=3em]%           \item[\gls{#1}]#2%         \end{description}%     }          \begin{document}          Consider the equation     \begin{equation}     e = m * c^2     \end{equation}     in which     \mathgloss{e}{energy}     \mathgloss{m}{mass}     \mathgloss{c}{speed of light}          \printglossaries          \end{document}       I tried writing ("a blind shot"):               \newcommand{\mathgloss}[3]{%         \newglossaryentry{#1}{name={#1},description={#2},symbol={#3}}%         \begin{description}[labelwidth=3em]%           \item[\gls{#1}]#2 #3%         \end{description}%     }      ...but I missed the target.


title: envlab and datatool for labels

text: I'm trying to use `datatool` and `envlab` to print to and from addresses on a biglabel. Currently my code is close, but not quite there. It will print one combination of to/from on a page and with drastically incorrect margins etc. The MW code is,               \documentclass[12pt]{letter}          % Generates the correct label sheet size     \usepackage[paperwidth=5in, paperheight=7in]{geometry}          \usepackage{datatool}     % loads the csv addr.csv, one row per dest     \DTLloaddb{mailing-list}{addr.csv}          \usepackage[nocapaddress,printbarcodes]{envlab}     %\SetBigLabel{W}{H}{t}{l}{r}{Nc}{Nr}     \SetBigLabel{5in}{7in}{0.25in}{0.25in}{0.25in}{1}{3}     \makelabels          \begin{document}     \startlabels          \DTLforeach{mailing-list}{%       \name=Name,%       \street=Street,%       \suite=Suite,%       \town=City,%       \state=State,%       \zip=Zip,%       \country=Country%,     }{%     \mlabel{%     Joe Casanova\\1 Lambda Street\\Anyplace, NY 12345}{%     \name\\\street\\\town, \state, \zip}}     \end{document}      As I understand it, `envlab` and `datatool` are at odds in this example but I don't understand how to make each aware of the other. If I make three `\mlabel` environments it will print the same information from `datatool`. Tricking `datatool` by trying to increment it will work but is a dirty patch b/c I would need the same number of `\mlabel` environments defined in the code as there are labels on one individual sheet which is kludgy. Can anyone provide insight? The setup I would like is a 5in x 7in label sheet consisting of 3 vertical labels with 0.25in separation and margins. On each label should be the return address in the upper left and the destination address in the lower right.


title: setcounter command doesn't seem to work with question command in the exam class

text: I read threw the manual for exam class at mit. I also did some searches, and found one that stated to use the `\setcounter{question}{WANTED NUMBER}` I want to be able to change the number of the question ie {3,5,10,20343} This is the error from texsudio               -> Something's wrong--perhaps a missing \item. \question $      Here is my code:                 \documentclass[10pt]{exam}       \usepackage[a4paper]{geometry}       \usepackage{graphicx}       \usepackage{amssymb}       \usepackage{epstopdf}      \usepackage{amsmath}      \usepackage{paralist}      \usepackage{enumerate}      \usepackage{wrapfig}      \usepackage{xcolor}      \usepackage{graphicx}      \usepackage{tikz}                     \newcommand\dx[1]{\,\textrm{d}#1}      \newcommand{\Lim}[1]{\raisebox{0.5ex}{\scalebox{0.8}{$\displaystyle \lim_{#1}\;$}}}      \begin{document}            \begin{questions}          In Exercises 1-6, find the equation of the tangent line $T$ to the graph of $f$ at the given point. Use this linear approximation to complete the table.           \begin{tabular}{|c|c|c|c|c|c|}     \hline      $x$ & 1.9 & 1.99 & 2 & 2.01 & 2.1 \\      \hline      $f\left(x\right)$ &  &  &  &  &  \\      \hline      $T\left(x\right)$ &  &  &  &  &  \\      \hline      \end{tabular}           \setcounter{question}{2}          \question $f\left(x\right) = x^5, \; \left(2,\sqrt{2}\right)$ <<<<Here it states and error with \item or \question>>>>>>          \begin{solution}          $f\left(x\right) = x^5$      $f^{\prime}\left(x\right) = 5x^4$     Tangent line at $\left(2,32\right)$     $\begin{array}{ccc}     y-f\left(2\right) & = & f^{\prime}\left(x-2\right) \\                     y-32& = & 80\left(x-2\right) \\                       y & = & 80x-128     \end{array} $     \begin{tabular}{|c|c|c|c|c|c|}     \hline      $x$ & 1.9 & 1.99 & 2 & 2.01 & 2.1 \\      \hline      $f\left(x\right)= x^5 $ &24.761 & 31.208 & 32 & 32.808 & 40.841  \\      \hline      $T\left(x\right)= 80x -128$ & 24 & 31.200 & 32 & 32.800 & 40.000 \\      \hline      \end{tabular}          \end{solution}          \question $f\left(x\right)=\sqrt{x}, \; \left(2,\sqrt{2}\right)$     \begin{solution}     $f\left(x\right) = \sqrt{x}$      $f^{\prime}\left(x\right) = \frac{1}{2\sqrt{x}} = \frac{\sqrt{2}{4}$     Tangent line at $\left(2,\sqrt{2}\right)$     \begin{array}{ccc}     $y-f\left(2\right) & = & f^{\prime}\left(x-2\right) \\                     y-\sqrt{2}& = & \frac{\sqrt{2}{4}\left(x-2\right) \\                       y & = & \frac{x\sqrt{2}}{4}+\frac{\sqrt{2}}{2}$     \end{array}      \begin{tabular}{|c|c|c|c|c|c|}     \hline      $x$ & 1.9 & 1.99 & 2 & 2.01 & 2.1 \\      \hline      $f\left(x\right)= x^5 $ & 1.378 & 1.411 & 1.414 & 1.418 & 1.449  \\      \hline      $T\left(x\right)= 80x -128$ & 1.379 & 1.411 & 1.414 & 1.418 & 1.450 \\      \hline      \end{tabular}     \end{solution}     \end{questions}     \end{document}       What am I doing incorrect?


title: ERROR After Updated Modules at ConTeXt?

text: I have problem after update modules at ConTeXt and I can’t use module at my document before I can. My MWE from this link : http://downloads.ziddu.com/download/23836664/Vektor.rar.html You can see my screenshoot : ![Error](http://i.stack.imgur.com/T4HZR.png) This below my screenshoot from processing update at Command Prompt ![Processing Update](http://i.stack.imgur.com/UZycC.png) And Error                   Command Line:   C:\context\tex\texmf-mswin\bin\context.exe "vektor.tex"     Startup Folder: D:\skripsi!\Vektor               mtx-context     | run 1: luatex --fmt="C:/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en" --jobname="vektor" --lua="C:/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en.lui" --no-parse-first-line --c:currentrun=1 --c:fulljobname="./vektor.tex" --c:input="./vektor.tex" --c:kindofrun=1 --c:maxnofruns=8 "cont-yes.mkiv"     This is LuaTeX, Version beta-0.79.1 (TeX Live 2014/W32TeX) (rev 5019)       \write18 enabled.     open source     > 1 > 1 > C:/context/tex/texmf-context/tex/context/base/cont-yes.mkiv          ConTeXt  ver: 2014.06.13 01:11 MKIV beta  fmt: 2014.6.13  int: english/english          system          > 'cont-new.mkiv' loaded     open source     > 2 > 2 > C:/context/tex/texmf-context/tex/context/base/cont-new.mkiv     close source    > 2 > 2 > C:/context/tex/texmf-context/tex/context/base/cont-new.mkiv     system          > files > jobname 'vektor', input './vektor', result 'vektor'     fonts           > latin modern fonts are not preloaded     languages       > language 'en' is active     open source     > 2 > 3 > D:/skripsi!/Vektor/vektor.tex     resolvers       > modules > 'art-01' is loaded     open source     > 3 > 4 > C:/context/tex/texmf-context/tex/context/base/s-art-01.mkiv     open source     > 4 > 5 > C:/context/tex/texmf-context/tex/context/base/type-imp-dejavu.mkiv     close source    > 4 > 5 > C:/context/tex/texmf-context/tex/context/base/type-imp-dejavu.mkiv     open source     > 4 > 6 > C:/context/tex/texmf-context/tex/context/base/type-imp-xits.mkiv     open source     > 5 > 7 > C:/context/tex/texmf-context/tex/context/base/type-imp-texgyre.mkiv     close source    > 5 > 7 > C:/context/tex/texmf-context/tex/context/base/type-imp-texgyre.mkiv     close source    > 4 > 7 > C:/context/tex/texmf-context/tex/context/base/type-imp-xits.mkiv     close source    > 3 > 7 > C:/context/tex/texmf-context/tex/context/base/s-art-01.mkiv     resolvers       > modules > 'abr-02' is loaded     open source     > 3 > 8 > C:/context/tex/texmf-context/tex/context/base/s-abr-02.tex     resolvers       > modules > 'abr-01' is loaded     open source     > 4 > 9 > C:/context/tex/texmf-context/tex/context/base/s-abr-01.tex     close source    > 4 > 9 > C:/context/tex/texmf-context/tex/context/base/s-abr-01.tex     close source    > 3 > 9 > C:/context/tex/texmf-context/tex/context/base/s-abr-02.tex     open source     > 3 > 10 > C:/context/tex/texmf-context/tex/context/base/symb-imp-cc.mkiv     close source    > 3 > 10 > C:/context/tex/texmf-context/tex/context/base/symb-imp-cc.mkiv     fonts           > symbols > library 'cc' loaded     resolvers       > modules > 'oldbibtex' is loaded     open source     > 3 > 11 > C:/context/tex/texmf-context/tex/context/base/m-oldbibtex.mkiv     open source     > 4 > 12 > C:/context/tex/texmf-context/tex/context/base/bibl-bib.mkiv     loading         > ConTeXt Bibliography Support / Experimental BibTeX     resolvers       > lua > loading file 'C:/context/tex/texmf-context/tex/context/base/bibl-bib.lua' succeeded     publications    > loading formatting style from 'bxml-apa'     open source     > 5 > 13 > C:/context/tex/texmf-context/tex/context/base/bxml-apa.mkiv     close source    > 5 > 13 > C:/context/tex/texmf-context/tex/context/base/bxml-apa.mkiv     close source    > 4 > 13 > C:/context/tex/texmf-context/tex/context/base/bibl-bib.mkiv     open source     > 4 > 14 > C:/context/tex/texmf-context/tex/context/base/bibl-tra.mkiv     loading         > ConTeXt Bibliography Support / BibTeX     resolvers       > lua > loading file 'C:/context/tex/texmf-context/tex/context/base/bibl-tra.lua' succeeded     publications    > loading formatting style from 'bibl-apa'     open source     > 5 > 15 > C:/context/tex/texmf-context/tex/context/bib/bibl-apa.tex     close source    > 5 > 15 > C:/context/tex/texmf-context/tex/context/bib/bibl-apa.tex     close source    > 4 > 15 > C:/context/tex/texmf-context/tex/context/base/bibl-tra.mkiv     close source    > 3 > 15 > C:/context/tex/texmf-context/tex/context/base/m-oldbibtex.mkiv     publications    > wrote a new auxiliary file 'vektor.aux'     This is BibTeX, Version 0.99d (TeX Live 2014/W32TeX)     The top-level auxiliary file: vektor.aux     The style file: cont-no.bst     I couldn't open database file xampl.bib     ---line 3 of file vektor.aux      : \bibdata{xampl      :               }     I'm skipping whatever remains of this command     I found no database files---while reading file vektor.aux     (There were 2 error messages)     metapost        > initializing instance 'metafun' using format 'metafun'     metapost        > loading 'metafun' as 'C:/context/tex/texmf-context/metapost/context/base/metafun.mpiv' using method 'default'     metapost        > initializing number mode 'scaled'     backend         > xmp > using file 'C:/context/tex/texmf-context/tex/context/base/lpdf-pdx.xml'     pages           > flushing realpage 1, userpage 1     structures      > begin of sectionblock 'frontpart'     structure       > sectioning > chapter @ level 2 : 0.1 -> Kata Pengantar     structures      > end of sectionblock 'frontpart'     pages           > flushing realpage 2, userpage 1     structure       > sectioning > subject @ level 3 : 0.0.0 -> Daftar Isi     pages           > flushing realpage 3, userpage 2     structure       > sectioning > chapter @ level 2 : 0.1 -> Pendahuluan     structure       > sectioning > section @ level 3 : 0.1.1 -> Instalasi \LATEX \ \index {LATEX} pada Windows \index {Windows} 7          Overfull \hbox (52.10847pt too wide) in paragraph at lines 242--243      [][][][][] \3>dejavu-10pt-rm-tf-0--0 T[]X Ed-i-tor. Un-duh WinEdt yang berguna dalam pengetikan doku-men da-pat di-un-duh di http://winedt.com     structure       > sectioning > section @ level 3 : 0.1.2 -> Instalasi \CONTEXT \ pada WinEdt 8     pages           > flushing realpage 4, userpage 3          Overfull \hbox (0.95139pt too wide) in paragraph at lines 259--262      [][][][][] \3>dejavu-10pt-rm-tf-0--0 Tahap UnIn-sta-lasi Jika kamu berkeing-i-nan un-tuk meng-ha-pus add ons Con-TeXt pada WinEdt          Overfull \hbox (104.07617pt too wide) in paragraph at lines 264--265      \3>dejavu-10pt-rm-tf-0--0 men-cari file con-text.exe dan se-harus-nya file be-rada pada \3>dejavu-10pt-tt-tf-0--0 C:\context\tex\textmf-mswin\bin\context.exe     pages           > flushing realpage 5, userpage 4     structure       > sectioning > section @ level 3 : 0.1.3 -> Memulai dokumen baru     structure       > sectioning > section @ level 3 : 0.1.4 -> Menambah Module dalam \CONTEXT      pages           > flushing realpage 6, userpage 5     structure       > sectioning > section @ level 3 : 0.1.5 -> Memulai Dokumen Baru dengan Module     pages           > flushing realpage 7, userpage 6     structure       > sectioning > chapter @ level 2 : 0.2 -> Catatan Kaki          Overfull \hbox (5.01855pt too wide) in paragraph at lines 297--298     \3>dejavu-10pt-rm-tf-0--0 bisa menam-bahkan-nya pada catatan kaki(\3>dejavu-10pt-rm-sl-0--0 foot-notes\3>dejavu-10pt-rm-tf-0--0 ) den-gan melakukan su-atu per-in-tah \3>dejavu-10pt-tt-tf-0--0 \footnote     pages           > flushing realpage 8, userpage 7     structure       > sectioning > chapter @ level 2 : 0.3 -> Perataan Rumus Matematika          mtx-context     | fatal error: return code: -1073741819          _____________________________________________________________________           ConTeXt Compilation Report (Pages: 0)           Errors: 0   Warnings: 0   Bad Boxes: 0      * * * I don’t understand **How to fix my problem at Context** ?


title: Step-by-step revealing of tikz-tree using opacity trick and overlays in beamer

text: I am using the very elegant method from user Daniel described here to try and reveal my tikz-tree gradually. The brief idea is that the tree is always fully drawn to avoid "jumpy" nodes and make their coordinates available even if they are "invisible", but that the opacity is set to 0 on those nodes that are not supposed to be seen yet. This is how my complete tree should look like after the reveal (I apologize in advance for the miserable quality of my phone's camera): ![Complete tree should look like this](http://i.imgur.com/BHloFSG.jpg) Here is my code:               \documentclass{beamer}     \usepackage{tikz}     \usepackage[utf8]{inputenc}     \usetikzlibrary{trees}          % Daniel's proposal for "uncovering" parts of a tikz-tree %     \tikzset{       invisible/.style={opacity=0},       visible on/.style={alt=#1{}{invisible}},       alt/.code args={<#1>#2#3}{%         \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path       },     }              \begin{document}     \begin{frame}     \begin{tikzpicture}[     nor/.style={circle,thick,solid,draw=black,fill=none,inner sep=0.5mm, minimum size=5mm},     acc/.style={circle,thick,solid,draw=green!50!black,fill=green!20,inner sep=0.5mm, minimum size=5mm},     rej/.style={circle,thick,solid,draw=red!50,fill=red!20,inner sep=0.5mm, minimum size=5mm},     level 1/.style={every child/.style={edge from parent/.style={dashed,draw,nearly opaque}} },     level 2/.style={sibling distance=19mm,every child/.style={edge from parent/.style={solid,draw}}},     level 3/.style={sibling distance=8mm,every child/.style={edge from parent/.style={dashed,draw,nearly opaque}} },     semithick]          \node[draw=none] (root) {}       child[level distance=12mm,visible on=<1->] { node[nor] {$x$}         child[visible on=<2->] {node[acc] {$e_1(x)$} }         child[visible on=<2->] {node[nor] {$e_2(x)$}           child[visible on=<6->] child[visible on=<6->] }         child[visible on=<2->] {node[rej] {$e_3(x)$} }         child[visible on=<2->] {node[nor] {$e_4(x)$}           child[visible on=<6->] child[visible on=<6->] child[visible on=<6->] }       };     \end{tikzpicture}     \end{frame}     \end{document}      The 4 sibling nodes on level 2 are correctly hidden, including their solid edges to/from the (x) node. As expected, they show up in the second slide and then stay visible. But the dashed edges at the bottom of the tree are shown since the very first slide - even though the leaf nodes are set to be visible from slide 6 onwards. Why is this happening? This way of doing things was accepted as an answer and received a lot of praise in the original question, so it certainly works. It's just partially working for me, since I seem to have a wrong understanding of how `child` inherits its style to all of the nodes underneath it... or perhaps it's a problem of the levels being styled manually as well (even though this doesn't seem to affect level 2). Ideas on how to fix this?


title: Alignment for equations with numbering in enumeration environment and in environment of cases

text: I have problem of alignment in the following, please check and suggest solution:               \begin{enumerate}     \item     \begin{equation}         \kappa_{a,b}(t)=\begin{cases}                  e^{at}, & 0\leq t<\infty,\\                 e^{bt}, & -\infty<t<0.                                               \end{cases}     \label{eq:kappa-ab-t}     \end{equation}     \item     \begin{equation}             \beta(x)=\frac{x^m}{\mu_n^{2k'-1}}             \label{eq:beta-x}     \end{equation}         for m=1, 2, 3, \ldots, n=1, 2, 3, \ldots, k'=0, 1, 2, \ldots.     \end{enumerate}      In output equations doesn't appear in the same line as of item number, appears at center of second line. I want it to appear in the same line with left alignment and corresponding equation numbers to right of page.


title: How can I force the captions to always have the same margin?

text: I'd like all captions to have the same margins on the left and right side. How can I achieve that? ## Picture ![enter image description here](http://i.stack.imgur.com/Hg8IZ.png) ## MWE               \documentclass[     12pt,     a4paper     ]{scrartcl}          \usepackage[T1]{fontenc}     \usepackage[utf8]{inputenc}     \usepackage{lmodern}               \usepackage[     labelfont=sf,     hypcap=false,     format=hang,     margin={2cm,2cm},     %also not working for forcing all captions:     %minmargin={2cm,2cm},     %maxmargin={2cm,2cm},     %justification=raggedright,     %width=0.9\columnwidth,     ]{caption}          \begin{document}     \begin{table}     \centering     AAA     \caption{Test.}     \end{table}     \begin{center}     BBB     \captionof{table}{Some more words 12. Some more words 12. Some more words 12. Some more words 12. Some more words 12. Some more words 12.}     \end{center}     \end{document}


title: What is the use of percent signs (%) at the end of lines?

text: I see that the code in many packages and examples contains percent signs `%` at the end of (many) lines. What are they used for? Do they affect the parsing of those lines?


title: Natbib with numbering: citeauthor, citeyear, horizontal white space

text: I am quite a new user of Natlib package with some basic knowledge of Latex. I have defined a custom new function \Mycite to obtain an hybrid citation with Authors (Year) [Number]. The rest of my paper use only numbered citation. I can't find out how to remove the white space after the function \Mycite. This produces also some trouble if citation is placed at the end of a line, causing hence a line break between the citation and punctuation. **Could someone explain me how to remove the white space after the right bracket?** \@ seems not working and with penalty option I am not very confident. Thanks in advance Chris ![Screenshot of output pdf](http://i.stack.imgur.com/puXIt.png) Here a minimal example of code               \documentclass{article}          \usepackage{lipsum}     \usepackage[%     square,      numbers,      comma,      sort,      sort&compress     ]{natbib} % enable use of two citation mode(both author–year and numerical citations)          \usepackage{hyperref}          % enable to cite the author and year between brackets     \newcommand\Mycite[1]{%     \citeauthor{#1}~(\citeyear{#1})~\citep{#1}\@     }          \newcommand\MycitewN[1]{% with Numbers      \citeauthor{#1}~(\citeyear{#1})\@     }          \begin{document}     \citep{doe-1999}. \lipsum[23] \Mycite{doe-1999}. \lipsum[23] \MycitewN{doe-1999}. \lipsum[23]     \citep{thul-2010}. \lipsum[23] \Mycite{thul-2010}. \lipsum[23] \MycitewN{thul-2010}. \lipsum[23]      \bibliographystyle{unsrtnat}     \bibliography{mybib}     \end{document}      and the code for mybib.bib               @article{doe-1999,     author="John Doe",     title="Some Paper",     journal="Some Journal",     volume=1, number=1, pages={1--10}, year=1999}          @article{thul-2010,     author="Thul, Patrick and House, K. and Tuttle, C.",     title="Some other Paper",     journal="Some Journal",     volume=1, number=1, pages={1--10}, year=2010}


title: What is the space around a parbox?

text: I write a short macro which put a picture on the left and a text on the right:               \newlength\largeur          \newcommand{\uneQuestion}[1]{         \setlength{\largeur}{\columnwidth}         \addtolength{\largeur}{-16mm}         \noindent         \hspace*{2mm}         \parbox{12mm}{\iconequestion}         \hspace*{2mm}         \parbox{\largeur}{\color{CouleurQuestion!95} #1}     }      As you can see `largeur` will be the width of the text and in order to compute it, I substract to the column width the two `\hspace`s and the `\parbox` space. But If I did that, the text is slightly larger than the `\columnwidth`. I guess that there is a short space around a `\parbox`?


title: Why is space inserted at beginning of table or figure caption when using macros to define caption label?

text: Here is my MWE. As you can see, the problem only happens when we use the macro \suppOrApp.               \documentclass{article}          \usepackage[english]{babel}     \usepackage{blindtext}          \usepackage{caption}     \usepackage{float}     \usepackage{ifthen}          \title{A caption test}     \author{Some one}     \date{\today}               \begin{document}          \newcommand{\suppOrApp}{       \ifthenelse{\boolean{thesisStyle}}         {Appendix}         {Supplementary}     }     \newboolean{thesisStyle}     \setboolean{thesisStyle}{false} % Might want to reconsider this here.               % This has additional space:     \renewcommand{\tablename}{\textbf{\suppOrApp Table}}     % But this would work fine.     %\renewcommand{\tablename}{\textbf{Supporting Table}}               \begin{table}     \begin{tabular}{cc}     1 & 2 \\     3 & 4 \\     \end{tabular}     \caption{\blindtext}     \label{mytable}     \end{table}          \blindtext          Please refer to Supporting Table~\ref{mytable}.          \end{document}


title: When to use % after a command

text: I am writing my own class file and when I am browsing through code developed by others I see % sign popping up at the end of command lines while other authors do not use it. Consider the following example from `biblatex`:               \DeclareCiteCommand{\citeauthor}       {\boolfalse{citetracker}%        \boolfalse{pagetracker}%        \usebibmacro{prenote}}       {\ifciteindex          {\indexnames{labelname}}          {}%        \printnames{labelname}}       {\multicitedelim}       {\usebibmacro{postnote}}      Here the % sign is used after the second and third line. Other others only use it in constructs like               \newcommand*{\bla}{%       \a       \b}      where % is only present at the first line. Finally there are authors that use it almost everywhere (after every line). As a class/package writer what should I do?


title: The meaning of the percent sign in LaTeX coding

text: > **Possible Duplicate:**   >  What is the use of percent signs (%) at the end of lines? I know that `%` is commonly used to uncomment parts of the code, but recently I read that there is another use for the percentage sign but I don't remember what it was neither where I read it. For example in the following code `%` was placed at the end of several lines. What does `%` do in this case? (If required, I will provide a MWE.)               \newif\ifintoc     \def\@schapter#1{%       \if@twocolumn         \if@at@twocolumn           \@makeschapterhead{#1}%         \else           \@topnewpage[\@makeschapterhead{#1}]%         \fi       \else         \@makeschapterhead{#1}\@afterheading       \fi       \ifintoc         \stepcounter{specialchapter}%         \addcontentsline{toc}{chapter}{\protect\numberline{\thespecialchapter}#1}%       \fi     }


title: How to have only 1 space between a word and a counter

text: I am using the following counter:               \newcounter{foo}       \newcommand\num{         \refstepcounter{foo}           \thefoo.}      Two (2) spaces are automatically inserted between the preceding word and the counter -- e.g., `word \num` shows up in the pdf file as `word 1.` Is there a way to have just one space between a word and a counter? If possible, I'd like to avoid writing `word\num` and would prefer to write it like `word \num`


title: Using '%' at end of line

text: When browsing though LaTeX source code, I have noticed that many people put `%` at the end of a line or after closing brackets. I would like to know if there is any benefit in this practice. Moreover, I find difficulty in finding advice on LaTeX coding style. When I say style I mean LaTeX source and not the compiled document. For me the code it self is kind of an art as well so if there are any tips are welcome.


title: Elsevier format 2 columns in Lyx

text: I would like to use Elsevier class to create paper in 2 column format as shown in authors guide: http://cdn.elsevier.com/assets/pdf_file/0011/109388/elsdoc.pdf (last page). I am using Lyx and kept the settings as follows: Document Settings->Document Class-> article(Elsevier).      I understand that there are various formats and it is easy for LaTex users as everything is explained in detail. It would be really helpful if someone could please guide on 'how can I get the above mentioned format in Lyx'. I have tried Text Layout->'Two-column Document' but everything gets jumbled up.


title: how can I predefine the color of multicolumns?

text: I'm trying to use multicolum. In my table all the columns have a predefined color which will be overwritten by multicolum. So my question is how can I define own or some more custom multicolumn commands which will make it able to set the color of the column faster than writing:               \multicolumn{3}{|>{\columncolor[gray]{.8}} c|}{myText}       I tried something like this:               \renewcommand{\multicolumn}[3]{%     \oldmc{##1}{| {\columncolor[gray]{.8}[.5\tabcolsep] } c |  ##2}{ ##3 }% }}      But I think there are some problems with the syntax, as I don't get it working.


title: How to set manually the number of an item in embedded list

text: In a simple list in order to set the number of an item the following code is enough :               \begin{enumerate}       \setcounter{enumi}{4}       \item fifth element     \end{enumerate}      It displays `5\. fifth element` However I want to display `2a. This element` How can I do that ?


title: longtable multirow problem with cmidrule and nopagebreak

text: I'm trying to reimplement the David Carlisle solution given here for breaking long tables over certain rows (breaking in `\hline` commnands instead `\cline` ones). This solution is complemented with the use of `\\\\*` command (another example here), and works perfectly with `longtable`and `longtabu` environments. Now, I would like do it work with the `booktabs` package, which uses a different mechanism to draw lines, especially in `\hline\hline` cases. Following the procedure given by David, I rewrote the `\@cmidrulea` and `\@cmidruleb` commands, which, according booktabs documentation, actually draw the rules. This is a 'minimal' example:               \documentclass[oneside,a4paper]{article}     \usepackage[T1]{fontenc}     \usepackage[utf8]{inputenc}     \usepackage{lipsum}     \usepackage[left=1in,right=1in]{geometry}     \usepackage{tabu}     \usepackage{booktabs}     \usepackage{longtable}     \usepackage{multirow}   % Para las tablas (varias filas)     \usepackage[table]{xcolor}  % Colores. Tambien en tablas          \newcommand{\OG}{\cellcolor{orange}}          %%%% Tomado de http://tex.stackexchange.com/questions/52100/longtable-multirow-problem-with-cline-and-nopagebreak     \makeatletter          \def\@cmidrulea{%       \multispan\@cmidla&\multispan\@cmidlb       \unskip\hskip\cmrkern@l%       {\CT@arc@\leaders\hrule \@height\@thisrulewidth\hfill}%       \hskip\cmrkern@r\cr       \noalign{\nobreak\vskip-\@thisrulewidth} %% Inserted \nobreak here     }%          \def\@cmidruleb{% This remains unchanged       \multispan\@cmidlb       \unskip\hskip \cmrkern@l%       {\CT@arc@\leaders\hrule \@height\@thisrulewidth\hfill}%       \hskip\cmrkern@r\cr       % \noalign{\nobreak\vskip-\@thisrulewidth} %% With this, "almost" works...     }%          \makeatother          \begin{document}          \lipsum[1-3]          \begin{longtabu} to \textwidth {|X[3,lm]|X[1,cm]|X[1,cm]|X[1,cm]|X[1,cm]|X[1,cm]|X[1,cm]|}       \toprule       \rowfont\bfseries       Lorem ipsum dolor sit amet, consectetuer adipiscing       elit.       & Curabitur       & Nam       & Pellentesque       & Donec       & Curabitur       & Cras\\*       \midrule       \endhead            \multicolumn{7}{r}{\small \it Continued on next page} \\* \endfoot            \endlastfoot            \multicolumn{7}{c}{\OG\textbf{First group heading}}\\*       \midrule            Lorem ipsum dolor sit amet & Terra & Integer & & Mauris & Mauris &  MC \\       \midrule            Pellentesque habitant morbi tristique senectus& Terra & Integer &       & Orci & Mauris & DB \\       \midrule            Pellentesque habitant morbi tristique senectus& Terra & Integer &       & Orci & Mauris & DB \\       \midrule            Pellentesque habitant morbi tristique senectus& Terra & Integer &       & Orci & Mauris & DB \\       \midrule            \multirow{2}{\linewidth}{Pellentesque habitant morbi tristique         senectus} &       Phasellus (vehicula augue eu neque) & Integer & \textbf{         \parbox{\linewidth}{           Curabitur\\           Phasellus         }       } & Mauris & \textbf{Magna} &  DB \\*            \cmidrule{2-7}            & Donec (vehicula augue eu neque) & Puella &       \textbf{Curabitur Phasellus Magna} & Mauris & \textbf{Magna} &  DB \\            \midrule            \multirow{2}{\linewidth}{Pellentesque habitant morbi tristique         senectus} &       Phasellus (vehicula augue eu neque) & Integer & \textbf{         \parbox{\linewidth}{           Curabitur\\           Phasellus         }       } & Mauris & \textbf{Magna} &  DB \\*            \cmidrule{2-7}            & Donec (vehicula augue eu neque) & Puella &       \textbf{Curabitur Phasellus Magna} & Mauris & \textbf{Magna} &  DB \\            \midrule            \multirow{2}{\linewidth}{Pellentesque habitant morbi tristique         senectus} &       Phasellus (vehicula augue eu neque) & Integer & \textbf{         \parbox{\linewidth}{           Curabitur\\           Phasellus         }       } & Mauris & \textbf{Magna} &  DB \\*            \cmidrule{2-7}            & Donec (vehicula augue eu neque) & Puella &       \textbf{Curabitur Phasellus Magna} & Mauris & \textbf{Magna} &  DB \\            \midrule       \multicolumn{7}{c}{\OG\textbf{Second group heading}}\\*       \midrule            Lorem ipsum dolor sit amet & Terra & Integer & & Mauris & Mauris &  MC \\       \midrule            Pellentesque habitant morbi tristique senectus& Terra & Integer &       & Orci & Mauris & DB \\       \midrule            \multirow{2}{\linewidth}{Pellentesque habitant morbi tristique         senectus} &       Phasellus (vehicula augue eu neque) & Integer & \textbf{         \parbox{\linewidth}{           Curabitur\\           Phasellus         }       } & Mauris & \textbf{Magna} &  DB \\*            \cmidrule{2-7}            & Donec (vehicula augue eu neque) & Puella &       \textbf{Curabitur Phasellus Magna} & Mauris & \textbf{Magna} &  DB \\            \midrule            \multirow{2}{\linewidth}{Pellentesque habitant morbi tristique         senectus} &       Phasellus (vehicula augue eu neque) & Integer & \textbf{         \parbox{\linewidth}{           Curabitur\\           Phasellus         }       } & Mauris & \textbf{Magna} &  DB \\*            \cmidrule{2-7}            & Donec (vehicula augue eu neque) & Puella &       \textbf{Curabitur Phasellus Magna} & Mauris & \textbf{Magna} &  DB \\            \midrule       \multicolumn{7}{c}{\OG\textbf{Third group heading}}\\*       \midrule       %\cmidrule{1-7} %% Ouch!            \multirow{2}{\linewidth}{Pellentesque habitant morbi tristique         senectus} &       Phasellus (vehicula augue eu neque) & Integer & \textbf{         \parbox{\linewidth}{           Curabitur\\           Phasellus         }       } & Mauris & \textbf{Magna} &  DB \\*            \cmidrule{2-7}            & Donec (vehicula augue eu neque) & Puella &       \textbf{Curabitur Phasellus Magna} & Mauris & \textbf{Magna} &  DB \\                 \bottomrule             \caption{Fiat iustitia, ne pereat mundus.}           \label{tab:fiat-iustitia}       \tabuphantomline     \end{longtabu}          \end{document}      As you can see if you process the document, there is a page breaking in the third heading group, even with a explicit no break `\\\\*` command. As desperate solution, I've tried replace the `\midrule` command by a less elegant `\cmidrule{1-7}` but this only almost work if I uncomment the `\nobreak` line in `\@cmidruleb` (re)definition. If I do this, the page breaks correctly, but last line is drawn in the next page. I'm also interested in this last case because I'll probably need it with multirow cells in the right side of the table, with `\cmidrule{1-n}` commands. Can anyone help me? Thanks in advance.


title: rframe is not working in showexpl

text: the option `rframe=empty` has not effect in showexpl. Here is a WME               \documentclass{article}     \usepackage{showexpl}          \begin{document}          Here is:     \begin{LTXexample}[rframe=empty]     \begin{center}      Hello world!     \end{center}          \end{LTXexample}          \begin{LTXexample}[rframe=single]     \begin{center}     Good Bye!     \end{center}     \end{LTXexample}          \end{document}      Does anybody know how to delete the frame in the formatted text?


title: biblatex: multiple bibliographies categorised by different .bib files

text: `biblatex` supports multiple bibliographies by looking up the 1) entry type, 2) keyword, or 3) category. This is all fine, but in the use case of primary sources and secondary sources: 1) the 'type' method doesn't work, 2) it is quite tedious to key in the 'primary' and 'secondary' keywords for each `.bib` entry, and 3) declaring the sorting by category would entail typing all the primary keys in the document. So, if I'm storing all my primary bib entries in one `.bib` file, and secondary one in another, is there a bit to tell `biblatex` to assign a keyword or category automatically to all the entries from that bib file as it imports them? Done this way, entries can be easily swapped to and from the primary and secondary `.bib` files without fiddling individual keywords, and I don't have to type out all the primary and/or secondary entries into categories in each document.


title: Biblatex and multiple bibliographies

text: i got convinced to use `biblatex` and already have the first problem. I have several `.bib`-files and one of them contains only entries which shall be listed in a second bibliography (or even better: a subcategory of the bibliography). It shall look as shown here: > BIBLIOGRAPHY > > entries from bib-files 1,2,3 alphabetically ordered > > BIBLIOGRAPHY 2 > > entries from bib-file 3 The entries do not have any special `types` or `keywords`, I don't want to add them manually to categories and i don't want to split the bibliography by chapters/sections/segments/whatever.


title: Subsections in bibliography, with a unified \cite command, sort & compress

text: I would like to produce a bibliography that looks like the "plain" bibtex style, but is divided in subsections:               References          Subsection 1          [1] A     [2] B          Subsection 2          [3] C     [4] D     [5] E      However, I would like to use a single `\cite` command (preferably with sorting & compression) so that e.g.               \cite{A,B,C,E}      produces               [1–3, 5]      This is something that I cannot do easily with `multibib`. Ideally, I would like to use different `*.bib` files for sectioning. That is, I would be able to write code along these lines:               \cite{A} \cite{C} \cite{A,B,C,E}          \subsection{Subsection 1}     \bibliography{part1}          \subsection{Subsection 2}     \bibliography{part2}      And the system would automatically put the references that can be found in `part1.bib` in the first subsection and the references that are defined in `part2.bib` in the second subsection.


title: Merging rows with tabularx

text: This seems to be quite a common question with ordinary tabular environments, but I have not been able to find an answer for this problem, or any like it, using the tabularx environment. My code is as follows:               \begin{tabularx}{\textwidth}{|p{3cm}|X|}     \hline     \textbf{Symbol (Name)}                              & \textbf{Example of Use}\\     \hline     \multirow{2}{*}{symbol\newline (Full name))}        & $x=\hdots$\\     \hline                                                         & Description     \end{tabularx}      which produces: ![tableoutput](http://mti20.user.srcf.net/latex_table.png) I am trying to make (Full name)) appear on the line below symbol without the horizontal line extending all the way to the left. I only want to third horizontal line to separate the column on the right. How do I achieve this with the tabularx environment? With many thanks, Froskoy.


title: Create subsection in enumerate environment

text: Currently I am using enumerate to create numbering. I want to include subsection within the enumerate environment with the numbers continue as they are. Well, some suggest me to use new enumerate but I want to remain the numbering. The subsection aligns with the content in the enumerate environment, which is not what I want. I want the subsection appears like normal (not the one shows in the code).               \begin{document}                \begin{enumerate}                 \subsection*{blah blah blah}                \end{enumerate}          \end{document}      I want to create subsection looks like this.                 \begin{document}            \subsection*{blah blah blah}            \end{document}


title: how to create a tikzset style for a rectangle?

text: I want to create a rectangle of width 0.2 and height 0.3 cm. I also want it to be filled with blue color. How can I do such a style so that I can specify just the name of style, position and label for every rectangle? for a circle I m using -               \tikzset{user/.style={circle, inner sep=0pt, minimum size=0.6cm, fill=red!60, draw=none}}     \node[user] at (2,6) {$A$};      Also How can I do it for other shapes? I mean can somebody point me to a resource so that I can find all the the options for various shapes?


title: How to convert math formulae in spectacular fonts into MS Word easily?

text: I wrote an article in LaTeX, but have to convert it to Word. It is not hard to copy text into Word, but for formulae, it is another story since they are in source codes mode in TeX files whereas in display mode in Word files. Laeqed has solved some problems, but there is one remains: I have used some packages such as MnSymbol, yfonts. However fonts of these do not be contained in Windows... * * * Update: I have solved the problem above, but need a better methodology that need not to regenerate all formulae involved one by one once change a font.


title: how to draw the same type of circle at different positions using tikz?

text: \draw [fill=black] (4,6) circle (0.3cm);     \draw [fill=black] (3,4.5) circle (0.3cm);      How can I define a circle called **user** with **radius 0.3cm and fill black** and **just specify the position** every time i draw it?


title: Notes in Beamer document class: lonely \item

text: I am having a problem with preparing my Bachelor Thesis presentation. Whenever I try to add notes with the `enumerate` or `itemize`option the compiler returns the following error error: > ! LaTeX Error: Lonely \item--perhaps a missing list environment. > > See the LaTeX manual or LaTeX Companion for explanation. > > Type H for immediate help. > > ... > > l.14 \end{frame} Here's an MWE:               \title{Test Title}     \author{Test Author}          \documentclass[8pt, notes]{beamer}     \usepackage{lipsum}          \begin{document}     \begin{frame}         \frametitle{Test Frame}              \lipsum*[10]              \note[itemize]{\item Test note 1 \item Test note 2}     \end{frame}     \end{document}


title: Strange disappearing colored rules in beamer

text: I have received a `booktabs` bug report of `\cmidrule`s that disappear when coloured rules are used inside `beamer` (together with `colortbl`). The problem can be illustrated with the following simple code and looks like an interaction between the `beamer` colour setup and `\leaders`. In the normal Latex classes the code is fine. I know to little about the inner workings of `beamer` and hope there is someone here who can help or that can give a workaround. Note that the colour need to be grouped inside `booktabs` to prevent leaking. **EDIT:** In an e-mail Michael Palmer suggested the addition of a `\kern` at the end of the grouping. This seems to work but the question is WHY? > **Note:** The standard tabular `\cline` also disappears inside `beamer` when > the line color is set with the `\arrayrulecolor` of the `colortbl` package. > So this is now also David Carlisle's problem :-) **Beamer class**               \documentclass{beamer}     \newcommand\tfillA[3]{\makebox[#1]{#2\leaders\hrule\hfill#3}}     \newcommand\tfillB[3]{\makebox[#1]{\color{red}#2\leaders\hrule\hfill#3}}     \newcommand\tfillC[3]{\makebox[#1]{#2{\color{red}\leaders\hrule\hfill}#3}}     \newcommand\tfillD[3]{\makebox[#1]{#2{\color{red}\leaders\hrule\hfill\kern0pt}#3}}%<--Edit          \begin{document}     \begin{frame}         INSIDE BEAMER CLASS\par\smallskip         \tfillA{2cm}{A}{B}: Works fine without colour\par         \tfillB{2cm}{A}{B}: Works fine with ungrouped colour\par         \tfillC{2cm}{A}{B}: Rule disappears with grouped colour\par         \tfillD{2cm}{A}{B}: Rule reappears with kern at end ?????     \end{frame}     \end{document}      ![enter image description here](http://i.stack.imgur.com/sboUQ.png) **Article class**               \documentclass{article}     \usepackage{xcolor}     \newcommand\tfillA[3]{\makebox[#1]{#2\leaders\hrule\hfill#3}}     \newcommand\tfillB[3]{\makebox[#1]{\color{red}#2\leaders\hrule\hfill#3}}     \newcommand\tfillC[3]{\makebox[#1]{#2{\color{red}\leaders\hrule\hfill}#3}}          \begin{document}         INSIDE ARTICLE CLASS\par\smallskip         \tfillA{2cm}{A}{B}: Works fine without colour\par         \tfillB{2cm}{A}{B}: Works fine with colour  everywhere\par         \tfillC{2cm}{A}{B}: Works fine with grouped colour     \end{document}      ![enter image description here](http://i.stack.imgur.com/jmIFh.png)


title: Texlua not be recognized

text: I have the exactly same problem like in the question Font installation woes - TeXShop on a Mac: I'd like to install the `nonfreefonts` package, but I can not do the command `texlua`. My terminal says "command not found". I have also MacTeX 2012 installed and I really need Arial for my Bachelor Thesis.


title: Can I write $\log^2{x}$ in skmath?

text: Standard LaTeX has the opportunity to write things like `$\log^2{x}$`. This is however no longer possible when loading the `skmath` package, because `skmath` expects the logarithm to be entered `$\log[<base>]{<expression>}$`. Did I miss something or is it only possible to achieve this by re-redfining `\log`. PS: I am aware that `$\log{<expression>}^2` is mathematically the same and have set it thus for now, but the above method seems more reader-friendly to me.


title: Texstudio and subfiles package

text: I am using TexStudio and am very happy with it. Now I have discovered the subfiles package to be able to compile only the part of my document I am working on. But TexStudio detects that the document is inputted into my main document and compiles the main document instead. My current workaround is to set the subfile as current master document, but that is quite clumsy. I have not found any option to turn off the automatic master mode in TexStudio, did I overlook something?