title: Shrinking large matrices by preventing column alignment

text: I have a relatively large but sparse matrix (say 20x20). Maple has no problem displaying it on a screen because maple does not force the columns to be aligned when the matrix is large enough : element 6,3 might not be directly underneath element 5,3. In LaTeX, on the other hand, the width of a matrix is at least the sum of the widths of the widest elements in each column. This does not fit on a paper at all. So, is there a way to make "maple-style" matrices in LaTeX? this               |1 0 0 0 (very wide element) |     |(very wide element) 0 0 0 0 |      instead of               |1                   0 0 0 (very wide element) |     |(very wide element) 0 0 0         0           |


title: How to refer theorem of different directory?

text: My thesis contains several chapters, which I have named like `Chapter1`, `Chapter2` etc. Each of these chapters have a separate folder which contains its files. All these chapters are contained in a main folder (`Thesis`), which also contains a preamble (executable) file. Now, I want to refer theorems across the Chapters (like theorem from `Chapter1` needs reference from lemma of `Chapter2`) using labeling techniques.


title: Xelatex convert PNG image to Bitmap

text: \documentclass{article}     \usepackage{fontspec}     \usepackage{lipsum}     \setmainfont{Palatino Linotype}     \begin{document}          \lipsum[1]     \includegraphics[scale=0.7]{EIGHT}     \end{document}      I'm using xelatex (cf. my minimal code example) I would like to know how to convert my image in bitmap rather than having a lot of gradation? Is it possible to do so with xelatex? ![enter image description here](http://i.stack.imgur.com/dz0kd.png) ![enter image description here](http://i.stack.imgur.com/twkTS.png) I would like to convert the image like something close to the second part part of the image (like some uniform pixels) : ![enter image description here](http://i.stack.imgur.com/LffI6.png)


title: floatrow: Changing the formatting of table footnotes

text: The `floatrow` package, which is useful for customizing the layout of floats, also allows to add footnotes as well as additional explanations (besides the caption) to tables. (The main commands are `\mpfootnotemark`, `\footnotetext` and `\floatfoot`, see p. 25--26 of the manual.) One may also configure the formatting of the actual table content (to, say, `\sffamily\small`) and the explanations (to say, `\sffamily\scriptsize`). However, I have not found a way to change the formatting of footnote marks and footnote texts with `floatrow`. Any ideas? (Notes: The `\ttabbox` command in my example, while not strictly necessary, will adapt the width of footnotes/explanations to the width of the actual table material and will also place the caption above instead of below the table. The `caption` package, which cooperates with `floatrow`, is used to change the formatting of captions.)               \documentclass[12pt]{article}          \usepackage[font={sf,small}]{floatrow}     \floatsetup[table]{footnoterule=none,footskip=0.5\skip\footins}          \usepackage[font=sf]{caption}     \captionsetup{footfont=scriptsize}% "footfont" defined by floatrow package          \begin{document}          \begin{table}     \ttabbox{%       % \centering% Default for floatrow package       \begin{tabular}{cc} \hline       Author & Title \\ \hline       Knuth & The \TeX book\mpfootnotemark[1] \\       Lamport & \LaTeX \\ \hline       \end{tabular}%       \footnotetext[1]{\TeX\ only}%       \floatfoot{All books listed are indispensable reading.}%     }{%       \caption{\TeX/\LaTeX\ books}%     }     \end{table}          \end{document}      ![enter image description here](http://i.stack.imgur.com/pIUNw.jpg)


title: Suppressing page numbering for table which spans over the entire page

text: I want to suppress page numbering on pages with tables which span over the entire page. I tried to do so by putting a `\thispagestyle{empty}` before the table but occasionally the command is applied to the previous page. When I put it after the table, the command is applied to the subsequent page. With some tables this seems to work while with others I encounter this problem. Is there any better way to surpress page numbering on exactly the page where the table is located. I assume that this has to do with the float. The code goes like this:               \thispagestyle{empty}     \begin{table}[htp]     \centering     \footnotesize       \scalebox{0.8}{     \centering\makebox[0pt][c]{%     \begin{tabular}{lrrrrrrrrrrrr}     r&r&r&r&r&r&r&r&r&r&r&r&r\\     \end{tabular}     }     }     \caption{Descriptive Statistics}     \label{tab_desc_stat01}     \end{table}


title: Verbatim in Marginnote doesn't work

text: I have a really sort quastion. The following Code is not working:               \documentclass{memoir}     \usepackage{verbatim}     \usepackage{marginnote}          \begin{document}          Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam     nonumy eirmod tempor invidunt ut labore et     dolore gubergren. \marginnote{\verb?\documentclass{memoir}?}%%% --- does not work!!!          \verb?\documentclass{memoir}?%%% it is working, looks pretty          \end{document}      I would like to write something like a package description, a manual that's why I would like to create marginnotes. The Problem what I get is the following:               ! LaTeX Error: Can be used only in preamble.          See the LaTeX manual or LaTeX Companion for explanation.     Type  H <return>  for immediate help.      ...                                                        l.8           Your command was ignored.     Type  I <command> <return>  to replace it with another command,     or  <return>  to continue without it.          ! LaTeX Error: \verb illegal in command argument.          See the LaTeX manual or LaTeX Companion for explanation.     Type  H <return>  for immediate help.      ...                                                        l.8       * * * ### UPDATE First of all, Thanks for the quick answers ;) I tested both packages. I find really good the fancyvbr package, it can give me much more as I taught. The cprotect package works also good, BUT If I leave a bracket in the Verbatim text -- like here:               Lorem ipsum dolor sit amet \cprotect\marginnote{\verb?}?}      -- then it does not work, I get the message too many {'... Otherwise it's working in the normal text, but not with marginnote SaveVerb can be a solution, it's working, but I don't want 300 saved Verbatims :-) So I don't really know what to do... Some idea?


title: How to set lengths only for a specific environment (parindent for paracol in this case)?

text: Is it possible to set a length specifically for an environment? I know it is possible to change lengths for parts of the document only, by placing the `\setlength` command between `{}`, but when using an environment many times in a document, it would be quite cumbersome to set the length as many times as the environment is used. In my specific case I would like to change `\parindent` only for the `paracol` environment, but not for the rest of the document. An MWE of my problem is this.               \documentclass[a4paper]{article}     \usepackage{paracol,lipsum,microtype}     \usepackage[norsk,british]{babel}     \usepackage[utf8]{inputenc}     \begin{document}     \lipsum[1]     \begin{paracol}{2}         \newlength{\LeftHeader}         \switchcolumn[0]*[\subsection*{Norwegian\settowidth{\LeftHeader}{Norwegian}\hspace{0.5\textwidth}\hspace{-\LeftHeader} English}]             \selectlanguage{norsk} Universitetet i Oslo ble opprettet 2. september 1811, eller det vil si: Den gangen het det Det kongelige Frederiks Universitet, og det gjorde det helt frem til 1939.         \switchcolumn             \selectlanguage{british} The University of Oslo was founded the second of september 1811, or actually: then it was called The royal Frederiks University, and it did so until 1939.         \switchcolumn*             \selectlanguage{norsk} Påls mor ble født syv år senere, unnfanget i de elleville fredsdager, født en kald februarlørdag i 1946.         \switchcolumn             \selectlanguage{british} Paul's mother was born seven years earlier, conceived during those wild days of peace, born on a cold february saturday in 1946.     \end{paracol}     \end{document}      ![enter image description here](http://i.stack.imgur.com/ZEmJK.png) The `\parindent` should be maintained at the green block, but be removed at the red blocks. How does one change this length only for the `paracol` environment, and for _all_ `paracol` environments that are used throughout the document?


title: Parsing optional macro arguments

text: I am trying to define a macro with flexible arguments: 3 mandatory and 2 optional ones - like this:               \macro{<enter code here>}[arg2] arg3 = arg4 | arg5;      So args 2 and 5 are optional, as is the `|`. I got quiet close to solving this with ideas found here and here. Now I am stuck somewhere in TeX's stomach. Maybe someone can shed some light on the problem - I am a total newbie and I think, there must be plenty of possibilities. I have tried a lot but am not familiar enough with `\expandafter`, `\futurelet`, `\xdef` & friends. I am stuck here:               \makeatother     \def\@pop#1{}     \def\@split#1;{\def\@@tmp{#1|}\expandafter\@@split\@@tmp\@end@token}     \def\@@split#1|{\@ifnextchar\@end@token{{#1}{}\@pop}{\@@@split{#1}}}     \def\@@@split#1#2|{{#1}{#2}\@pop}          \def\display#1{\@ifnextchar[{\@display{#1}}{\@display{#1}[1]}}     \def\@display#1[#2]#3={\def\@tmp{\@@display{#1}{#2}{#3}}\expandafter\@tmp\@split}          \def\@@display#1#2#3#4#5{*#1*#2*#3*#4*#5*}     \makeatletter          \display{aaa}[bbb] AAA = BBB | CCC;      the output is supposed to look like this:               *aaa*bbb*AAA*BBB*CCC*      but instead I get               /tmp/problem.tex:56: Missing control sequence inserted.     <inserted text>                     \inaccessible      l.42 \display{aaa} AAA = BBB;      ...am using a href="http://gummi.midnightcoding.org/"gummi/a ...good stuff IMHO!


title: Put points of question into brackets in exsheets

text: I want align the points value of questions to margin and put inside brackets with exsheets package. MWE:               \documentclass[a4paper]{article}     \usepackage[load-headings,load-tasks,]{exsheets}     \usepackage{lipsum}     \SetupExSheets{         points/name = pont,         points/number-format=\textit,         headings = margin-nr,         headings-format = \normalfont,         counter-within=section,         solution/name = Megoldás     }     \DeclareInstance{exsheets-heading}{my-no-nr}{default}{         toc-reversed = true,         indent-first = true,         vscale = 2,         post-code = \rule{\linewidth}{1pt},         title-format = \Large\scshape,         join = {             main[l,vc]title[l,B](0pt,0pt) ;         },     }     \RenewQuSolPair       {question}[headings=margin-nr]       {solution}[headings=my-no-nr]     %     \begin{document}     \begin{question}{10}         \lipsum[1]     \end{question}     \begin{question}{10}         \lipsum[2]     \end{question}     \end{document}      So I want replace "10 pont" to "(10 pont)". How can I do this?


title: Making a nice table

text: I have made following table which is not looking elegant. Could anybody help me in making it more better. Following is the tex code that I have used.               \documentclass[12pt]{article}     \usepackage{latexsym}     \usepackage{amsmath, times, amsfonts, mathrsfs, amssymb}     \usepackage{amsmath, times, amsfonts, mathrsfs, amssymb}     \begin{document}     \begin{table}[htbp]     \small \caption{\small Computation of number of iterations and error norms for Example 4.2:}     \centering     \begin{tabular}{c c c c c c c}     \hline      Value of $\beta$ &  $k$  & $\|A^{-1} - X_{k}\|_2$ & $\|X_k  - X_{k-1}\|_2$   \\ [0.3ex] % inserts table      &  & & &   &  & \\      %     \hline      0.9  & 0  &  0.489897948556636  & 0.462668212869655  \\      & 1 &   0.044911860348910 & 0.044385148438250 \\      & 2 &  6.418447480230614e-004 & 6.417891668548070e-004  \\      & 3 &   5.683044758299918e-008 &   5.683044739894235e-008  \\       & 4 &   1.861900614935455e-016 &   1.861900614935455e-016  \\        & 5 &   0 &   0 \\  [1ex]     \hline     \end{tabular}     \label{table:nonlin}     \end{table}     \end{document}      ![After running it looks like this ](http://i.stack.imgur.com/d7Igq.jpg)


title: Using position arguments with starred tcolorbox environment

text: The `{tcolorbox}*` environment is interpreting position arguments in a way I would not anticipate. When I include the `*`, the placement is unexpected--`\begin{VocabBox}*[b]...` does not get placed at the nearest reasonable bottom position, but rather, awkwardly at the end of the document. If I exclude the `*`, the placement for `\begin{VocabBox}[b]...` is as expected. These two MWEs should demonstrate my meaning (I could not recreate the behavior I was seeing with `\documentclass[]{article}` and had to use the document class I'm actually working in, `\documentclass[]{svmono}`): [ Example 1 ]               \documentclass[]{svmono}     %%%%%% personally included packages %%%%%%%     \usepackage{paracol}     \usepackage[many]{tcolorbox}     \usepackage[bottom]{footmisc}% places footnotes at page bottom     \usepackage{lipsum}          %%%%%% definitions %%%%%%%%%%%%%%%%%%%%%%%%     \NewTColorBox{VocabBox}{ s O{!htbp} }{%       floatplacement={#2},       IfBooleanTF={#1}{float*,width=\textwidth}{float},       colframe=blue!50!black,colback=blue!10!white,% any tcolorbox options here       }          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%          \begin{document}          \begin{paracol}{2}     \begin{leftcolumn}%     \begin{VocabBox}*[b]     \lipsum[2]     \end{VocabBox}     \lipsum[1]     \lipsum[1]     \lipsum[1]     \lipsum[1]     \lipsum[1]     \end{leftcolumn}     \begin{rightcolumn}     \lipsum[1]     \lipsum[1]     \lipsum[1]     \lipsum[1]     \lipsum[1]     \end{rightcolumn}     \end{paracol}          \end{document}      [ Example 2]               \documentclass[]{svmono}     %%%%%% personally included packages %%%%%%%     \usepackage{paracol}     \usepackage[many]{tcolorbox}     \usepackage[bottom]{footmisc}% places footnotes at page bottom     \usepackage{lipsum}          %%%%%% definitions %%%%%%%%%%%%%%%%%%%%%%%%     \NewTColorBox{VocabBox}{ s O{!htbp} }{%       floatplacement={#2},       IfBooleanTF={#1}{float*,width=\textwidth}{float},       colframe=blue!50!black,colback=blue!10!white,% any tcolorbox options here       }          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%          \begin{document}          \begin{paracol}{2}     \begin{leftcolumn}%     \begin{VocabBox}[b]     \lipsum[2]     \end{VocabBox}     \lipsum[1]     \lipsum[1]     \lipsum[1]     \lipsum[1]     \lipsum[1]     \end{leftcolumn}     \begin{rightcolumn}     \lipsum[1]     \lipsum[1]     \lipsum[1]     \lipsum[1]     \lipsum[1]     \end{rightcolumn}     \end{paracol}          \end{document}      ## Question: Why does the position algorithm give bizarre results for `\begin{VocabBox}*[b]`, and can it be remedied without sidestepping the package? ## Package info: tcolorbox: CTAN Page   svmono: Download svmono.zip (*S*pringer *V*erlag *Mono*graph class)


title: Proper way to typset minimum value of variable in formula?

text: To typeset a value with a subscript I use this:               $U_{\text{res}}$      Which results in: ![Ures](http://i.stack.imgur.com/3mNF0.png) Now I'd like to write "the minimum value of Ures", how would I correctly typeset that? The first thing I tried was               $U_{\text{res}_{\text{min}}}$      ![Uresmin](http://i.stack.imgur.com/Q7x5m.png) but that doesn't really look good. A coworker suggested               $U_{\text{res,min}}}$      ![Ures,min](http://i.stack.imgur.com/vyiI3.png) but I'm also not sure if it's correct, and as part of a larger formula it seems to take up too much horizontal space: ![formula](http://i.stack.imgur.com/klbs2.png)


title: How to customize Latexian to use other TeX engines or biber?

text: The Mac editor Latexian has built in methods for compiling using `latex+dvips`, `pdflatex` and `xelatex`. Furthermore, it assumes `bibtex` and `makeindex` to deal with bibliographies and indexes, respectively. How do I customize Latexian to use, e.g. LuaTeX for compiling or Biber for bibliographies?


title: Run biber from inside LaTeXian

text: I often use LaTeXian on Mac OSX 10.9 to edit and display documents. Occasionally, I want to use the live preview option with bibliography content. The program allows you to enable a run of `bibtex`, `makeindex`, or `makeglossaries`, followed by 1, 2 or 3 extra runs of `latex` at the end. This process is great, so long as you are using `bibtex` for the backend of the bibliography. Is there any good way to get LaTeXian to run `biber` instead of `bibtex`? I'm happy to entertain command-line hacks as well any more clean methods.


title: Allowing first undelimited argument to be empty

text: Consider the following macro definitions:               \def\mymacro#1{\mymacroii#1\nil}     \def\mymacroii#1#2\nil{%       \ifx\\#1\\%         empty%       \else         #1%       \fi     }%     \mymacro{foo}% -> f     \mymacro{}     \bye      This is supposed to extract the first character of the parameter to `\mymacro`. This works, but only if the argument is not empty. How must I change my macros, so that the call `\mymacro{}` works as expected, i.e. outputs "empty"? Note, that is is only a simplified version. In reality I have several checks in `\mymacroii` for the first character, if it is a number, an opening brace, and so on. This question is for sure related to Why does TeX remove braces around delimited arguments?, but I couldn't apply those informations to my case.


title: How to force text down in table-header?

text: I would like to have my table-headers in the bottom of the cell, instead of in the top, as they are in this piece of code. Can anybody help me?               \documentclass{articel}     \begin{document}     enter\begin{table}[h]     \renewcommand{\baselinestretch}{1}\normalsize     \centering     \begin{threeparttable}            \captionsetup{justification=raggedright,singlelinecheck=false}         \setlength{\abovecaptionskip}{2pt plus 5pt minus 1pt}          \caption{Fertilitetsmål og antal kvinder i den fødedygtige alder (15-49 år)}       \begin{tabular}{p{2cm} p{3cm} p{3cm} p{3cm} p{3cm}}       \toprule[1.5pt]          & Levendefødte & Summarisk fertilitetskvotient & Generel fertilitetskvotient & Kvinder i fødedygtig alder (15-49 år) \\     \midrule     1994 & 69666 & 13,4 & 53,4 & 1.305.101 \\     1995 & 69771 & 13,4 & 53,8 & 1.297.730 \\       \bottomrule     \end{tabular}     \caption*{Kilde: NAT03}     \label{tab:Disponibel indkomst}     \end{threeparttable}     \renewcommand{\baselinestretch}{1.50}\normalsize     \end{table}     \end{document}


title: Vertical spacing problem related to the mdframed environment

text: I use the `mdframed` package with option `style=1,` which means that `TikZ` is responsible for drawing frames:               \documentclass{article}          \usepackage[style=1]{mdframed}          \begin{document}          \noindent     Text     \begin{mdframed}       Framed     \end{mdframed}     Text          \end{document}      When I compile this minimal example I observe redundant vertical white space below the framed region. It seems that the baseline is not optimally chosen. Does anybody know how to solve this spacing problem? * * * **Addendum:** The vertical spacing problem outlined above is no longer present with version 0.9a of the `mdframed` package.


title: Background images for code listings in beamer

text: I asked this question originally in attempt to get background images behind my code listings. Background images for code listings What I did not mention is that I am using the beamer package for slides. This technique does not seem to work with beamer. I get a gray box behind the code listing. How do I get background images behind code listings in beamer? `               \documentclass{beamer}     \usepackage{listings}     \usepackage{graphicx}     \usepackage{tikz}     \usetikzlibrary{calc}     \usetikzlibrary{decorations.pathreplacing}          \newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}          \newcommand*{\AddBackgroundImage}[4][]{%     %\pgfmathsetmacrp{\height}{}%         \begin{tikzpicture}[overlay,remember picture]         \coordinate (VCenter) at ($(#2)!0.5!(#3)$);         \coordinate (Fudge) at (-\pgflinewidth,0);         \coordinate (VFudge) at (0,\baselineskip);         %\draw [red, thick,fill=yellow, fill opacity=0.2]% for debugging         \clip                 ($(#2)+ (Fudge) - 0.50*(VFudge)$) --                  ($(#2) + (\linewidth,0) - 0.50*(VFudge)$) --                  ($(#3) + (\linewidth,0) + 1.25*(VFudge)$) --                 ($(#3)+ (Fudge) + 1.25*(VFudge)$) -- cycle;         \path (VCenter) -- ++($(0.5*\linewidth,0)$)          node [opacity=0.3, #1] {\includegraphics[width=\linewidth]{#4}};         \end{tikzpicture}%     }%          \usetheme {default}     \lstset{ language=Haskell             , basicstyle=\small\sffamily            , numbers=left             , numberstyle=\tiny\color{gray}              }               \begin{document}          \begin{frame}[fragile]            \noindent% Line above MUST be blank     \tikzmark{Start}%     \begin{lstlisting}     data PersonRecord =        PersonRecord { firstname      :: FirstName,                      lastname       :: LastName,                      middleinitial  :: Maybe MiddleInitial,                      gender         :: Gender,                      favoritecolor  :: FavoriteColor,                      dateofbirth    :: CalendarTime                     } deriving (Show)          \end{lstlisting}     \end{frame}     \tikzmark{End}     \AddBackgroundImage{Start}{End}{images/black-screen}%     %     \noindent     Some text afterwards.     \end{document}


title: Help me create my out patient documentation template

text: \documentclass[a5paper]{article}     \usepackage{eso-pic}     \usepackage{fancyhdr}     \usepackage[pdfauthor={VB},%     pdftitle={Consultation},%     pagebackref=true,%     ]{hyperref}     \usepackage[headsep=3cm,top=4cm, bottom=4cm]{geometry}     %\usepackage{bookman}     \AddToShipoutPicture{%       \AtTextUpperLeft{%         \makebox(420,75)[lt]{%           \small%           \begin{tabular}{@{}*{3}{p{3.5cm}}@{}}%           \textbf{Name}\newline\myauthor&%           \textbf{Date of birth}\newline\mydate&%           \textbf{Address}\newline\myaddress%           \end{tabular}%     }}}     \pagestyle{fancy}     \fancyhf{}     \fancyhead[LO]{{\Large \scshape d} \\ My degree\\My reg no}         \fancyhead[RO]{{\Large \scshape other dr }\\ MBBS,  \\reg no }     \renewcommand{\footrulewidth}{0.4pt}%     \fancyfoot[CO]{{\scshape my  clinics}\\ My road,\\ city  \\ Phone: 000000000}          \usepackage{titling}     \posttitle{\par\end{center}}     \setlength{\droptitle}{-80pt}     \title{}     \author{}                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     \newcommand{\myauthor}{user34083}     \newcommand{\mydate}{December 26, 1997}     \newcommand{\myaddress}{26 Washington Ave., Manhattan, New York.\newline United States of America}     \begin{document}     \maketitle      \thispagestyle{fancy}     \subsection*{History}     \subsection*{Examination}     \subsection*{Investigations}     \subsection*{Diagnosis}     \clearpage     \date{\today}     \subsection*{Rx}     \clearpage     \date     \subsection*{Follow up/History}          \end{document}      * * * This is the template I use to generate my patient's medical record using lyx. There are few problems. If you help me solve, I would be obliged.   1. When I use `\date{\today}` , today's date is generated. I can use `\date {ddMMYYYY}` to have fixed date. When I use `\today`, can the date of printing the document be fixed; so that next time when I follow up a patient, the previous visit date is not changed.   2. As you can see, I create single file per patient. So that when follow up occurs, I can continue on the same file and print only the recent observations. Is there a possibility of exporting a pdf file which has "name-datetime stamp" pattern, so that 1 pdf is generated every visit. This will help me save visit vise, but incremental notes (First pdf file will have first vist note, but subsequent files will have current visits notes in addition to previous visit). As I use lyx, I would like to change the preamble only.   3. How can I vertically center every page generated? Most visits are short, and require 1 (max 2) page documentation only (majority).


title: Result from summary in xtable

text: I have a vector of values, and I want to use the output of "summary" in LaTeX. I understand that `xtable` is designed for exactly that purpose. However ...               > values <- c(1,2,3)     > summary(values)     Min. 1st Qu.  Median    Mean 3rd Qu.    Max.      1.0     1.5     2.0     2.0     2.5     3.0      > xtable(summary(values))     Error in xtable.table(summary(values)) :        xtable.table is not implemented for tables of > 2 dimensions      What am I doing wrong here?


title: Centering figure caption does not work

text: I have a few narrow figures for which I want to center the caption. I have to use a LaTeX template from Springer (`svmult.cls`). This makes captions left- aligned by default. I took a look at this question which suggest to add the `captions` package and then locally use               \captionsetup{justification=centering}      But this has no effect in this case. The relevant part from the class file looks like this:               \usepackage{subfig}     % redefininition of the captions for "figure" and "table" environments     %     \@ifundefined{floatlegendstyle}{\def\floatlegendstyle{\bfseries}}{}     \def\floatcounterend{\enspace}     \def\capstrut{\vrule\@width\z@\@height\topskip}     \@ifundefined{captionstyle}{\def\captionstyle{\normalfont\small}}{}     \@ifundefined{instindent}{\newdimen\instindent}{}          \long\def\@caption#1[#2]#3{\par\addcontentsline{\csname       ext@#1\endcsname}{#1}{\protect\numberline{\csname       the#1\endcsname}{\ignorespaces #2}}\begingroup         \@parboxrestore\if@minipage\@setminipage\fi         \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par       \endgroup}          \def\twocaptionwidth#1#2{\def\first@capwidth{#1}\def\second@capwidth{#2}}     % Default: .46\textwidth     \twocaptionwidth{.46\textwidth}{.46\textwidth}          \def\leftcaption{\refstepcounter\@captype\@dblarg%                 {\@leftcaption\@captype}}          \def\rightcaption{\refstepcounter\@captype\@dblarg%                 {\@rightcaption\@captype}}          \long\def\@leftcaption#1[#2]#3{\addcontentsline{\csname       ext@#1\endcsname}{#1}{\protect\numberline{\csname       the#1\endcsname}{\ignorespaces #2}}\begingroup         \@parboxrestore         \vskip\figcapgap         \@maketwocaptions{\csname fnum@#1\endcsname}{\ignorespaces #3}%         {\first@capwidth}\ignorespaces\hspace{.073\textwidth}\hfill%       \endgroup}          \long\def\@rightcaption#1[#2]#3{\addcontentsline{\csname       ext@#1\endcsname}{#1}{\protect\numberline{\csname       the#1\endcsname}{\ignorespaces #2}}\begingroup         \@parboxrestore         \@maketwocaptions{\csname fnum@#1\endcsname}{\ignorespaces #3}%         {\second@capwidth}\par       \endgroup}          \long\def\@maketwocaptions#1#2#3{%        \parbox[t]{#3}{{\floatlegendstyle #1\floatcounterend}#2}}          \def\fig@pos{l}     \newcommand{\leftfigure}[2][\fig@pos]{\makebox[.4635\textwidth][#1]{#2}}     \let\rightfigure\leftfigure          \newdimen\figgap\figgap=0.5cm  % hgap between figure and sidecaption     %     \long\def\@makesidecaption#1#2{\@tempdimb=3.6cm        \setbox0=\vbox{\hsize=\@tempdimb                       \captionstyle{\floatlegendstyle                                              #1\floatcounterend}#2}%        \ifdim\instindent<\z@           \ifdim\ht0>-\instindent              \advance\instindent by\ht0              \typeout{^^JClass-Warning: Legend of \string\sidecaption\space for                          \@captype\space\csname the\@captype\endcsname                       ^^Jis \the\instindent\space taller than the corresponding float -                       ^^Jyou'd better switch the environment. }%              \instindent\z@           \fi        \else           \ifdim\ht0<\instindent              \advance\instindent by-\ht0              \advance\instindent by-\dp0\relax              \advance\instindent by\topskip              \advance\instindent by-11\p@           \else              \advance\instindent by-\ht0              \instindent=-\instindent              \typeout{^^JClass-Warning: Legend of \string\sidecaption\space for                          \@captype\space\csname the\@captype\endcsname                       ^^Jis \the\instindent\space taller than the corresponding float -                       ^^Jyou'd better switch the environment. }%              \instindent\z@           \fi        \fi        \parbox[b]{\@tempdimb}{\captionstyle{\floatlegendstyle                                             #1\floatcounterend}#2%                               \ifdim\instindent>\z@ \\                                    \vrule\@width\z@\@height\instindent                                          \@depth\z@                               \fi}}     \def\sidecaption{\@ifnextchar[\sidec@ption{\sidec@ption[b]}}     %     \newbox\bildb@x     %     \def\sidec@ption[#1]#2\caption{%     \setbox\bildb@x=\hbox{\ignorespaces#2\unskip}%     \if@twocolumn      \ifdim\hsize<\textwidth\else        \ifdim\wd\bildb@x<\columnwidth           \typeout{Double column float fits into single column -                 ^^Jyou'd better switch the environment. }%        \fi      \fi     \fi       \instindent=\ht\bildb@x       \advance\instindent by\dp\bildb@x     \if t#1     \else       \instindent=-\instindent     \fi     \@tempdimb=\hsize     \advance\@tempdimb by-\figgap     \advance\@tempdimb by-\wd\bildb@x     \ifdim\@tempdimb<3.6cm        \ClassWarning{SVMult}{\string\sidecaption: No sufficient room for the legend;                  ^^Jusing normal \string\caption}%        \unhbox\bildb@x        \let\@capcommand=\@caption     \else     %  \ifdim\@tempdimb<4.5cm     %     \ClassWarning{SVMono}{\string\sidecaption: Room for the legend very narrow;     %              ^^Jusing \string\raggedright}%           \toks@\expandafter{\captionstyle\sloppy                              \rightskip=\z@\@plus6mm\relax}%           \def\captionstyle{\the\toks@}%     %  \fi        \let\@capcommand=\@sidecaption     %  \leavevmode     %  \unhbox\bildb@x     %  \hfill     \fi     \refstepcounter\@captype     \@dblarg{\@capcommand\@captype}}     \long\def\@sidecaption#1[#2]#3{\addcontentsline{\csname       ext@#1\endcsname}{#1}{\protect\numberline{\csname       the#1\endcsname}{\ignorespaces #2}}\begingroup         \@parboxrestore         \@makesidecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}%         \hfill         \unhbox\bildb@x         \par       \endgroup}     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%      As far as I understand, it merely defines extra captions for figures composed of two horizontal sub figures? Any idea why the `captionsetup` doesn't work in this case, and if there is a work around (perhaps using something in `subfig` as that package is already included). * * * **EDIT:** Here is a minimal example:               \documentclass[graybox]{svmult}     \begin{document}     \begin{figure}     \centering     My graphics     \captionsetup{justification=centering}     \caption{My caption}     \end{figure}     \end{document}      Where `svmult.cls` is available from Springer.


title: nocite{*} exclude

text: I have to put the report of a research trainig group together, where each former PhD student has to write a report with a list of her/his publications. The publications are contained in seperate `.bib` files and I am also using `bibunits`. The `.bib` files, however, contain their PhD theses (included as an `@phdthesis` entry) which schould not occour in their publications. How can I still use `\nocite{*}` to list their publications and exclude the PhD theses?


title: How to divide frame by two parts in LyX?

text: I have a long experience with LaTeX. However, I am beginner with LyX and there is some things that differ. I start to make presentation and I can not do such very simple thing as dividing frame into two or more columns. I understand that I should do as follows:   1. Click to columns   2. Then click to column   3. Defined width   4. Than do something about paragraph. This part I do not understand


title: Content summaries - sections

text: I'm currently writing up my thesis and I have a section "content summary" in my introduction section. This gives an indication to what each section contains and is about. At the minute, each chapter / section is in text files, "introduction.tex", "background.tex" etc.. My question is whether or not, in each of the chapter ".tex" files - Can I add a tag like "\contentsummary" for each chapter which then get's inserted to the "content summary" section within the introduction file? Sorry if this does not make sense.


title: TikZ circuits: Resistor is rotated by 90 degrees

text: I have a problem with TikZ circuit library. The following code produces a circuit, but the resistor is rotated by 90 degrees:               \documentclass{article}          \usepackage{tikz}     \usetikzlibrary{circuits.ee.IEC}          \begin{document}       \begin{tikzpicture} [circuit ee IEC]         \node (pow) [battery]   at (0,0)  {};         \node (res) [resistor]  at (-1,1) {};         \draw (pow) -| (res) -- (-1,2);       \end{tikzpicture}     \end{document}      The resistors long side is orthorgonal to the line. How do I change this so that the long side is along the wire?


title: TikZ circuits: symbol for gas discharge tube?

text: In the TikZ circuit library, is there a symbol for a gas discharge tube? In the manual I could not find anything regarding this (and the whole symbol list in there seems rather short, anyways).


title: pdfpage error with url outside margin

text: A colleague of mine has to merge multiple PDF papers for conference proceedings. We tried to use `pdfpage` with the `includepdf` command that works great. Unfortunately there is a specific PDF that produce an important error in `pdflatex` that stop working during compilation. We manage to identify that there is one specific page within the PDF that produces the error (using multiple `includepdf` command with the `page` option) and we observe that this page was containing a url that goes beyond the margin of the document. Do you think that this might produce the error? How to solve it? any strategy is welcome EDIT: Sorry, did not post the code used, thought it was not that useful, but here it is, with the log file (the pdf to include is called 30.pdf):               \documentclass[12pt]{article}          \usepackage{pdfpages}     \usepackage{tikz}          \definecolor{bar}{gray}{0.9}     \definecolor{between}{gray}{0.7}     \definecolor{bg}{gray}{0.4}          \newcommand{\overlay}[2]{%     \begin{tikzpicture}[remember picture,overlay]     \node[yshift=-1cm] at (current page.north west)       {\begin{tikzpicture}[remember picture, overlay]         \fill[fill=bar] (0,0) rectangle           (\paperwidth,1cm);         \draw[black] (0,0) -- (\paperwidth,0);         \node[anchor=base west,minimum size=1cm,inner sep=5pt,               font=\sffamily\Large\bfseries]                (numb) at (0,0.2) {No. #1};         \node[anchor=base west, minimum height=1cm,               font=\sffamily]               (title) at (4,0.2) {#2};         \node[anchor=base east, minimum height=1cm,               font=\sffamily]               (title) at (\paperwidth,0.2) {..};        \end{tikzpicture}       };     \end{tikzpicture}     }     \setkeys{pdfpages}{pages=-,}          \begin{document}          \includepdf[pagecommand={\overlay{30}{epidemics}}]{30}          \end{document}      Log file available here http://perso.uclouvain.be/arnaud.browet/small.log I tried to modify the command to                   \includepdf[pages={1-6,8-},pagecommand={\overlay{30}{epidemics}}]{30}      which works, so that's why i'm sure that the problem comes from 1 specific page (the 7th) I don't get an actual result, just a warning box indicating `pdflatex.exe has stopped working` and there is not output produce (PDF file created but "empty") Thank you for your help


title: Option clash for package color. \RequirePackage

text: I'm very new to LaTeX, and I'm having a problem which seems to originate from the following lines of code.               \RequirePackage[usenames]{color}     \RequirePackage{fancyhdr}     \RequirePackage{nomencl}     \RequirePackage{titlesec}     \RequirePackage{titletoc}     \RequirePackage{url}     \urlstyle{tt}      Option clash for package color. `\RequirePackage` error ocurred at line `\RequirePackage{fancyhdr}`. Any idea? **Corresponding log output is this** :               l.73 \RequirePackage                         {fancyhdr}     The package color has already been loaded with options:       []     There has now been an attempt to load it with options       [usenames]     Adding the global options:       ,usenames     to your \documentclass declaration may fix this.     Try typing  <return>  to proceed.


title: Problems with bibliography filecontents

text: I am working on a group project, and writing this in latex. Because of sending files forth and back this is easier with a single file. Therefore we want to include the bibliography directly into the file. Alas this proves some problems. For one the citatitions does not show up properly, we need them to be of the form "(author,year)" and secondly the bibliography does not show up? We tried compiling it first using the quickbuild in texmaker, then run bibtex, then run quickbuild again but nothing helped If someone would look at the file we would be extremely grateful               \documentclass[a4paper,12pt,round]{article}     \usepackage{filecontents}     \begin{filecontents}{\jobname.bib}     @Book{test1,       author    = {Goossens, Michel and Mittelbach,                    Frank and Samarin, Alexander},       title     = {The LaTeX Companion},       publisher = {Addison-Wesley},       location  = {Reading, Mass.},       year      = {1994},     }     \end{filecontents}     \usepackage[T1]{fontenc}                             % Vise norske tegn.     \usepackage[norsk]{babel}                            % Tilpasning til norsk.     \usepackage[utf8]{inputenc}                          % For å kunne skrive norske tegn.     \usepackage{lipsum}     \usepackage[style=authortitle-dw]{biblatex}     \addbibresource{\jobname.bib}     \usepackage{hyperref}     \author{Øistein Søvik, Silje, Magnus , Maja}     \title{PPU4000 \\ Examen Paedagogicum}          \begin{document}     \maketitle           \tableofcontents          \lipsum[1] \Cite{test1} \lipsum[2]          \printbibliography     \end{document}


title: Producing TikZ-made .pdfs and using /includegraphics on them?

text: I'm helping TeX a professor's handwritten notes for publishing/pre-print purposes, and for producing certain graphics, I use PGF/TikZ. However, it seems he is having trouble compiling the code whenever TikZ is involved, so he wants me to compile the TikZ images separately, and then `\includegraphics` on all of them instead. (Seems a bit of a crime, but boss' orders I guess.) However, trying to make the TikZ images standalone (i.e. including the TikZ code, some article document class, then compiling to .pdf), I am left with a huge amount of whitespace coming from the rest of the single page document. This leads to a lot of problems trying to `\includegraphics` with it, as the image itself is miniscule compared to all the blank space. Is there a way to shorten the produced pages to fit exactly the dimensions of the TikZ-images? Or aside from dropping TikZ and going with a third party software, is there perhaps a better solution overall?


title: Separate long math text under sum symbol into different lines?

text: I have the following equation, where there is a lot of stuff under the sum symbol:               \begin{equation}     d(\vec{x},\vec{y})=       \sum_{Z_{xy}\in\vec{Z}_{xy},\forall x\in\vec{x},\forall y\in\vec{y}}          f(Z_{xy})     \end{equation}      In the resulting document, I find it kind of hard to read. Is there a way to write the equation to make the result more readable, e.g. putting the stuff under the sum symbol on different lines?


title: How to type a double limit?

text: > **Possible Duplicate:**   >  Separate long math text under sum symbol into different lines? I'm interested in typesetting the following double-limit: ![enter image description here](http://i.stack.imgur.com/B7Yvm.png)


title: Writing 3 expressions below \bigcup?

text: Let's say I have:               \bigcup_{a \in X}      This will print a big U with `$a \in X$` below it. Now, let's say I also want to write `$b \in Y$` and `$c \in Z$`below that big U. Is this possible?


title: How can I write a latex fraction without a bar?

text: > **Possible Duplicate:**   >  Separate long math text under sum symbol into different lines? I'm trying to write a math formula like this:               \sum_{ \frac{n=0}{(n+k-i) \text{~even}} }^{k-i}      This looks just as I want it, but I don't want the bar between n=0 and (n+k-i) text. ![enter image description here](http://i.stack.imgur.com/VxkNu.png) I tried using the `matrix` env,               \sum_{ \begin{matrix}{n=0}\\{(n+k-i) \text{~even}}\end{matrix} }^{k-i}      ![enter image description here](http://i.stack.imgur.com/m7NuK.png) But that looks really bad, because the (n+k-i) text is too large.


title: Multiple subscripts

text: > **Possible Duplicate:**   >  Separate long math text under sum symbol into different lines? I'm trying to produce a product which has two subindices. Like this: `\\[ \phi_n(X)=\prod_{z\in \mu_n \\\ z \textup{primitive}} (X-z) \\]` That doesn't work: the `\\\` is not recognized.


title: LaTeX command for double lower index summation

text: I would like to know what is the latex command to include a double lower index using sigma notation (i.e: second index lies underneath the first index)? I tried typing:               \displaystyle\sum_{m,n=-\infty, \; (m,n)\neq (0,0)}^{\infty}     \left[       \frac{1}{(z-2 m\omega_{1} - 2 n\omega_{2})^{2}}      -\frac{1}{   4(m\omega_{1} +   n\omega_{2})^{2}}     \right]       I would appreciate the assistance. Thanks


title: Inserting new line under \exists in math mode

text: > **Possible Duplicate:**   >  Separate long math text under sum symbol into different lines? Minimal example of my document. I'm using redesigned `exists`.               \documentclass{article}     \usepackage{amsfonts}     \usepackage{amsmath}          \let\stdexists\exists     \renewcommand{\exists}{\mathop{\vphantom{\sum}\mathchoice       {\vcenter{\hbox{\huge$\stdexists$}}}       {\vcenter{\hbox{\Large$\stdexists$}}}{\stdexists}{\stdexists}}\displaylimits}          \begin{document}     \begin{equation}     \exists_{j\in S j\neq i}\exists_{n \in \mathbb{N}} {p_{ij}}^{(n)}>0     \end{equation}     \end{document}      This code gives an output: ![](http://i.stack.imgur.com/1PMZT.png) What I need is: ![](http://i.stack.imgur.com/iAxvv.png) How can I do that?


title: Customizing legend in pgfplots

text: I am trying to customize the legend for this graph. _First_ of all, I would like the legend width to be equal to the x-axis width. At the moment, I am setting the width of the legend via                /tikz/every even column/.append style={column sep=1.0cm}      and I could manually adjust this value so that length equals the x-axis width, but I guess that there is a more elegant way to set the width of the legend. _Second_ , I don't really like the little color rectangles in the legend. I only want one rectangle in front of every entry and not two. This rectangle does not need to have a border and should be vertically centred with the text. The alignment seems to be okay for the rectangle closer to the text, but not for one the far left. **Update:** Thanks to Christian Feuersänger's comment, there is possibility to change the rectangles via               legend image code/.code={%         \draw[#1, draw=none] (0cm,-0.1cm) rectangle (0.6cm,0.1cm);      or what Gonzalo Medina proposed               legend image code/.code={%         \draw[#1, draw=none, /tikz/.cd, bar width=3pt, yshift=-0.2em, bar shift=0pt] %         plot coordinates {(2*\pgfplotbarwidth,0.6em)};      _Third_ , I would like to the legend entries to start next to the text "Legend:". I don't really know if with these requirements it still makes sense to use legend or if it would be better to add everything manually via `after end axis/.code` and `\ref{label}`. ## Graph ![enter image description here](http://i.stack.imgur.com/N8QPL.jpg) ## MWE               \documentclass{article}     \usepackage{pgfplots}     \pgfplotsset{compat=newest}          \begin{document}     \begin{tikzpicture}         \begin{axis}[                     ybar,                     height=6cm,                     title={Some plot},                     width=12cm,                     axis on top,                     y axis line style={opacity=0},                     axis x line*=bottom,                     tick align=inside,                     tick style={draw=none},                     xtick=data,                     ymajorgrids,                     major grid style={draw=white},                     xtick={1,2,3,4},                     legend style={                         at={(0.0,-0.15)},                         anchor=north west,                         legend columns=-1,                         /tikz/every even column/.append style={column sep=1.0cm}                             },                 ]                        \addlegendimage{empty legend}                 \addlegendentry{\textbf{Legend:}}                                    \addplot coordinates {                     (1, 0.2064)                     (2, 0.3961)                     (3, 0.5961)                     (4, 0.7961)}; \addlegendentry[text width=45pt, text depth=]{legend a}                 \addplot coordinates {                     (1, 0.3064)                     (2, 0.4961)                     (3, 0.6961)                     (4, 0.8961)}; \addlegendentry[text width=65pt, text depth=]{lengend b}         \end{axis}      \end{tikzpicture}     \end{document}


title: How to create a column layout from a number of choices?

text: I am trying to create a command namely `\twoc` to make a simple two column answer space for a specific question. The output should appear like this: ![enter image description here](http://i.stack.imgur.com/mdBhw.png) While my code for the `.tex` file that I will be doing should only be like this using the command `\twoc`: ## Code               \Question What comes first?\\     \twoc     \text {apple}     \text {zebra}     \text {girrafe}     \text {dog}     \text {elephant}     \text {chicken}     \text {mouse}     \text {carabao}      ## Note The command `\twoc` will automatically divide the text choices even. Example if text choices that are made was 8 then there should be 4 in each column.


title: Is there any other margin I must set to reduce margin to zero?

text: I have basic class file and I would like to set margins of an a4paper to 0mm. Here is the markup of some-class.cls:               \NeedsTeXFormat{LaTeX2e}     \ProvidesClass{some-class}[2013/07/29]          \renewcommand{\normalsize}{\fontsize{10pt}{12pt}\selectfont}     \DeclareOption{a4paper}{         \setlength\paperheight {297mm}%         \setlength\paperwidth  {210mm}     }     \DeclareOption{landscape} {         \setlength\@tempdima   {\paperheight}%         \setlength\paperheight {\paperwidth}%         \setlength\paperwidth  {\@tempdima}     }          %Default options for design     \ExecuteOptions{a4paper}     %Process user given options     \ProcessOptions          \RequirePackage[top=0mm, bottom=0mm, left=0mm, right=0mm, textwidth=210mm]{geometry}      Content of my document.tex:               \documentclass[]{some-class}     \author{roncsak}     \title{some title}     \date{2013/07/28}     \begin{document}     Lorem ipsum     \end{document}      I would like to set an A4 paper with zero margins. Instead I notice some margin on the left side (approximately 10mm). I could reduce that margin with the `\RequirePackage[top=0mm, bottom=0mm, left=-10mm, right=0mm, textwidth=210mm]{geometry}` but I would like to understand why this margin left behind.


title: Change the action of Shift+Alt+M in Texstudio

text: The default mode of TexStudio is to enter `\\[ \\]` when I enter `Shift` + `Alt` + `M` and put the cursor between `\\[` and `\\]`. I would like to enter                \[ * \]  *       and put cursor on the first `*` for entering the math and then using `Alt` + `Space` to move it to the second `*` to enter the text (`*` denotes a placeholder). How this can be done?


title: Error while writing equation

text: \documentclass[12pt,a4paper]{article}     \usepackage[a4paper, total={6in, 8in}]{geometry}         \usepackage[utf8]{inputenc}         \usepackage[T1]{fontenc}         \usepackage{fourier}         \usepackage{mathtools}     \usepackage{amsmath}     \usepackage[english]{babel}     \usepackage{graphicx}     \usepackage{marginnote}     \begin{document}     \underline {Chandrashekhar EOS (1935)} : \\     \begin{align*}     \overline \rho &= $K$ ~\Big( $sinh ~t$ ~- ~$t$\Big)\\     \overline P &= \frac {1}{3} $K$ ~ \Big($sinh~t$ - 8 $sinh$ \frac {1}{2} t  + $3t$\Big)\\     \end {align*}     \end {document}      can you tell me why I have error in the right side of the equations?


title: My tikzpicture code is huge - is it possible to simplify in a neat way?

text: Evening! My first question here so don't be harsh on me :) I'm drawing some pentagonal numbers and trying to illustrate these with tikz. I can get the job done but I'm not that into doing numbers for more than n=4. The code is               \begin{tikzpicture}[scale=.75]     \draw[dotted](0,0)coordinate(1)--++(0:1)coordinate(2)     --++(0:1)coordinate(3) --++(0:1)coordinate(4)     --++(72:1)coordinate(5)--++(72:1)coordinate(6)      --++(72:1)coordinate(7)--++(144:1)coordinate(8)      --++(144:1)coordinate(9) --++(144:1)coordinate(10)      --++(216:1)coordinate(11)--++(216:1)coordinate(12)      --++(216:1)coordinate(13)--++(288:1)coordinate(14)--cycle;     \foreach \x in {1,2,...,14}     \filldraw(\x) circle (2pt);     \draw[dotted](0,0)coordinate(1) --++(0:1)coordinate(2)     --++(0:1)coordinate(3) --++(72:1)coordinate(4)     --++(72:1)coordinate(5) --++(144:1)coordinate(6)      --++(144:1)coordinate(7) --++(216:1)coordinate(8)     --++(216:1)coordinate(9);     \foreach \x in {1,2,...,10}     \filldraw(\x) circle (2pt);     \draw[dotted](0,0)coordinate(1) --++(0:1)coordinate(2)      --++(72:1)coordinate(3) --++(144:1)coordinate(4)     --++(216:1)coordinate(5);     \foreach \x in {1,2,...,6}     \filldraw(\x) circle (2pt);     \end{tikzpicture}      As you can se - the code isn't sexy at all and I sense that it can be shortened (hopefully) :) Help me out here dudes! ![enter image description here](http://i.stack.imgur.com/4QFHn.png)


title: How to show a different section title than 'References' for the reference list?

text: > **Possible Duplicate:**   >  How can I change the "References" to "Reference" in the thebibliography > environment?   >  Change reports text for bibliography I am writing my CV in LaTeX and I am using BibTeX to easily show all my publications. As resume jargon uses the term 'References' at the group of people they can get in touch with to ask about me I was wondering if I could change the title of the section of 'References' for something like 'Selected Publications'. My document class is `article`.


title: How can I change the "References" to "Reference" in the thebibliography environment?

text: My problem is that I have only one reference. So I would like the head of this part to appear "Reference" instead of commonly "References". More generally, could we change the title "References" to an arbitrary name? Thank you very much for your help!


title: Drawing checkered torus (doughnut)

text: How to draw a checkered torus (doughnut) in LaTeX? I have seen the example of drawing a torus. But I also need to make a `$4 \cross 4$` chess board on it. It'll be more helpful if I can also change the color scheme!


title: Extending the faktor package

text: I'm writing a script (topic ring theory) where I have to set lots of quotients of algebraic objects. Usually I simply write `M/N`. However there are some cases where this is no easy to read (`M+N/N` or such). So I want to set the first object a bit higher and the second a bit lower. I found the faktor package which does this. However faktor uses `\diagup` in a fixed size. For larger expressions a larger one seems suitable. Do you have any idea how I can change the source code of the package so that   1. I have two commands (one with a small and one with a large slash) or better   2. the `\diagup` has automatically the right size. I also tried `xfrac`. First I ran into this message:               This is a LaTeX bug: check coding!     ! Command name `\if_num:w' already defined! Current meaning: \ifnum.     \msg_kernel_bug:x ...oding!}\tex_errmessage:D {#1}      A comment at Debians bug tracking system suggested to exchange `mathtools` and `xfrac`. This worked on my system. However the formulas inside a `gather*`-environment look too small to me: ![example with \\sfrac](http://i.stack.imgur.com/qvbWq.png) The font size here seems smaller than at inline text. Thatswhy I wanted to try `faktor`. I noticed another disadvantage with `xfrac`. My document needs _a lot more_ time to compile. The initial revision took ~13 sec to compile (pdflatex) and with `xfrac` it took ~1300 secs or nearly half an hour.


title: Unexpect differences between calling \ifmmode from within a command and outside a command

text: In answering another question regarding testing for math mode, I proposed the following command               \newcommand{\testa}{%       \ifmmode         ^{12}\text{CO(1-0)}%       \else         $^{12}$CO(1-0)%       \fi     }      But @egreg pointed out that I should be writing either:               \newcommand{\egrega}{%       \relax       \ifmmode         ^{12}\text{CO(1-0)}%       \else         $^{12}$CO(1-0)%       \fi     }      or               \DeclareRobustCommand{\egregb}{%       \ifmmode         ^{12}\text{CO(1-0)}%       \else         $^{12}$CO(1-0)%       \fi     }      and proposed I test things out in an `array` environment to see what happens.               \[\begin{array}{c}       \testa     \end{array}\]      Sure enough, `\testa` results in the following warning:               ! Missing $ inserted.     <inserted text>                      $     l.42   \testa          ?       whereas the two command `\egrega` and `\egregb` work as expected. I wasn't happy with just this. My understanding of robustness is quite shacky. And, while I've read various posts such as What is the difference between Fragile and Robust commands?, I still felt a bit in the dark. So, I tried a different approach. I tried writing               \[\begin{array}{c}       \ifmmode{Math}\else{NOT MATH}\fi     \end{array}\]      Really, I don't why I did this. I expected to the same error as with the _faulty version_ of the command. But instead I didn't get an error at all. Instead, I got the following _unexpected_ and _erroneous_ result: ![enter image description here](http://i.stack.imgur.com/PTW9W.png) Clearly something is going **very** wrong here, and not in any way I anticipated. If instead I write               \[\begin{array}{c}       \relax\ifmmode{Math}\else{NOT MATH}\fi     \end{array}\]      or precede the `\ifmmode` by anything else to be processed, all seems to go well. What am I failing to understand here?


title: How to use PSTricks with PDF Texify in WinEdt?

text: The page How to use PSTricks in pdfLaTeX? explains a workaround that allows to use PSTricks in pdfLaTeX. As far as I understand it, it allows you to include a mix of eps and pdf figures in a TeX document and to compile the document with pdfLaTeX. Along similar lines, I was wondering if there is any way to get PSTricks to work with PDFTeXify in WinEdt?


title: Macro that knows it is at the end of a section?

text: In Is it a bad idea to use \begin{section} ... \end{section} in LaTeX?, Jan Hlavacek says: > Of course it is typically possible to recognize an end of a section, but > there is actually a number of ways how a section can end: start of another > section, start of the next chapter or part, start of `\endmatter`, > bibliograpy, index, etc, or the end of document. How would I go about writing a macro that recognizes when it is at the end of a section? I'd like it to work properly in `\afterpage` so that I can fix some of the issues in my answer to Section reminders at the top of each page? I believe this means that it'll have to use marks to detect where it is in relation to a sectioning command, but I don't know enough about LaTeX to be certain. For example, I'd like to be able to do something like the following:               \documentclass{article}     \usepackage{afterpage}     \newcommand{\printendedsections}{%         \ifatendofsubsubsection{(end of subsubsection \thesubsubsection)}{}%         \ifatendofsubsection{(end of subsection \thesubsection)}{}%         \ifatendofsection{(end of section \thesection)}{}%         \ifatendofchapter{(end of chapter \thechapter)}{}%         \ifatendofpart{(end of part \thepart)}{}%     }     \begin{document}          % will expand to '(end of subsection 2.1)' at the top of page 2 because     % subsection 2.2 starts right at the top of page 2     \afterpage{\hbox{\printendedsections}}          \section{sec1}          asdf     \printendedsections% expands to nothing because section 1 hasn't ended yet          \subsection{sub1.1}          \printendedsections% expands to nothing because subsection 1.1 hasn't ended yet     asdf     \printendedsections% expands to '(end of subsection 1.1)(end of section 1)'          \section{sec2}          asdf     \printendedsections% expands to nothing because section 2 hasn't ended yet          \subsection{sub2.1}          pretend there is enough content here     to push the start of subsection 2.2     to the top of the next page     \printendedsections% expands to '(end of subsection 2.1)'          \subsection{sub2.2}          asdf     \printendedsections% expands to '(end of subsection 2.2)(end of section 2)'          \end{document}


title: Changing the apperance of equation numbers with amsmath

text: For equations in my document, I use the facilities of the `amsmath` package. In order to make the equation numbers more eye-catching, I want them to be in boldface and a little bit indented to the right, i.e. like this: ![comparison of default and desired output](http://i.stack.imgur.com/rxoRK.png) I've already tried redefining the internal `amsmath` macros `\maketag@@@` or `\tagform@`. But both               \def\maketag@@@#1{\hbox{\m@th\bfseries#1\hspace{3mm}}}      and               \def\tagform@#1{\maketag@@@{\bfseries(\ignorespaces#1\unskip\@@italiccorr)}\hspace{3mm}}      also change the references produced by `\eqref`, as this macro internally uses `\tagform@` to produce its output. These references should keep their default appearance, however, as I don't need the prominent formatting in the running text. The most promising approach I've tried so far is to redefine `\print@eqnum`:               \def\mytagform#1{\maketag@@@{\bfseries(\ignorespaces#1\unskip\@@italiccorr)}\hspace{3mm}}     \def\print@eqnum{\mytagform\theequation}      This redefinition doesn't affect the `\eqref` references. Sadly though, it seems to work only with `align` environments, the tags of `equation` environments aren't changed:               \documentclass{article}     \usepackage{amsmath}     \makeatletter     % \maketag@@@ and \tagform@ also influence \eqref     % \def\maketag@@@#1{\hbox{\m@th\bfseries#1\hspace{3mm}}}     % \def\tagform@#1{\maketag@@@{\bfseries(\ignorespaces#1\unskip\@@italiccorr)}\hspace{3mm}}          % \print@eqnum looks promising, but applies only to align environments     \def\mytagform#1{\maketag@@@{\bfseries(\ignorespaces#1\unskip\@@italiccorr)}\hspace{3mm}}     \def\print@eqnum{\mytagform\theequation}     \makeatother     \begin{document}     \begin{equation}         1+1=2\label{equation}     \end{equation}     \begin{align}         1+1 &= 2\label{align}     \end{align}     \eqref{equation}, \eqref{align}     \end{document}      outputs ![enter image description here](http://i.stack.imgur.com/aBYNy.png) **How can I change the appearance of equation numbers without affecting references produced by`\eqref`?**


title: How to style equation label and reference differently?

text: > **Possible Duplicate:**   >  Changing the apperance of equation numbers with amsmath I need to be able to make the labels of equations bold, but at the same time I need the citations to those equations to have normal style in the rest of the text. Here is what I tried:               \let\theoldequation\theequation      \renewcommand*{\theequation}{\textbf{\theoldequation}} % bold equation numbers      and this (using `etoolbox` package)               \pretocmd{\theequation}{\textbf}{}{}      Output: ![enter image description here](http://i.stack.imgur.com/Gbkpo.png) To solve this, I googled a lot, and could only come up with the following trials:               \renewcommand{\eqref}[1]{\textnormal{(\ref{#1})}}      and               \let\oldeqref\eqref     \renewcommand*{\eqref}{\textnormal{\oldeqref}} % bold equation numbers      and               \pretocmd{\eqref}{\textnormal}{}{}      and the last one:               \patchcmd{\eqref}{\textbf}{\textnormal}{}{}      But none yielded what I am required to do. Can you give a solution to this problem?


title: Is it possible to move an equation number in the equation environment?

text: > **Possible Duplicate:**   >  Changing the apperance of equation numbers with amsmath I would like to move an equation number from its default position a little bit left. (I learned to move an equation a little bit left from this site. But I could not locate any reference to move the equation number a little bit left. I searched this site with "move equation number".) The following is the code that I am using.               \documentclass[12pt]{report}     \usepackage{graphicx}     \usepackage{amssymb}          \begin{document}     \begin{equation}     \hspace{-9cm}a_1+d_1=47     \end{equation}     \end{document}      Edited Question: How can I align both equations and the equation numbers in the following code?               \documentclass{article}     \usepackage{amsmath}     \makeatletter          \def\mytagform#1{\maketag@@@{\bfseries(\ignorespaces#1\unskip\@@italiccorr)}\hspace{3cm}}     \def\print@eqnum{\mytagform\theequation}     \makeatother     \begin{document}     \begin{align}     \label{eq:eq1}     \hspace{-6cm}a_1+7d=47     \end{align}          \begin{align}     \label{eq2}     \hspace{-6cm}a_1+20d=112     \end{align}          \end{document}


title: Alternative to adjustwidth for use with a lettrine (or alternative to lettrine)

text: I'm using `\lettrine` for the first paragraph of a section. However I'd like that section to be narrower than the others so I'm also using `adjustwidth` from the `changepage` package. This causes alignment problem for the next paragraphs of that section If I use this:               \begin{adjustwidth}{1.5cm}{1.5cm}     \lettrine[lines=3]{L}{orem} ipsum dolor sit amet, consectetuer adipiscing elit.      Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur     dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a,     magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique     senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo.          Lorem ipsum (paragraph 2) dolor sit amet, consectetuer adipiscing elit.      Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur     dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a,     magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique     senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo.     \end{adjustwidth}       Then the second paragraph has a blank space on the left that looks as if it were expecting the `L` lettrine to be there (in other words, its `\parshape` is wrong). This is expected results since `adjustwidth` uses list and that `lettrine` doesn't work well with list (according to its documentation). However, if I do:               \begin{adjustwidth}{1.5cm}{1.5cm}     \lettrine[lines=3]{L}{orem} ipsum dolor sit amet, consectetuer adipiscing elit.      Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur     dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a,     magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique     senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo.     \end{adjustwidth}     \begin{adjustwidth}{1.5cm}{1.5cm}     Lorem ipsum (paragraph 2) dolor sit amet, consectetuer adipiscing elit.      Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur     dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a,     magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique     senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo.     \end{adjustwidth}       Then everything works fine. However it's not very practical because I will have to do it in several places. Is there any known elegant solution/package/newenvironment for this problem. i.e. a replacement to `adjustwidth` that would work with `lettrine` ? Or alternatively a replacement to `lettrine` that would work with `adjustwidth` ?


title: Display real apostrophe in parts of a document

text: The question How to make a real apostrophe or single-quote in LaTeX is my question too, but the answer points to a package `upquote` that affects the entire document. I need to display an apostrophe (U+0027) only a couple of times within the document. Otherwise I would like the general conversion to quote to take place.               \documentclass{article}     \usepackage{fontspec, xunicode, xltxtra}     \defaultfontfeatures{Mapping = tex-text}          \begin{document}     \noindent I would like an apostrophe to appear in the word ap'ple (U+0027), but a right quotation mark (U+2019) when I quote the word `orange'.     \end{document}      ![enter image description here](http://i.stack.imgur.com/RpGzE.png)


title: Error while scaling a table

text: I'm trying to scale this too wide table, but I'm getting an error and unable to solve this problem at all. Here is the error: "! You can't use `\hrule' here except with leaders" on the caption line". Here is a simplified file:               \documentclass[10pt, a4paper]{article}     \usepackage{graphicx}          \textwidth 16cm     \textheight 23.5cm     \headsep -2em     \headheight 0em     \evensidemargin 0cm     \oddsidemargin 0cm     \parskip0.1explus0.0exminus0.0ex          \newcommand{\EVE}{\texttt{{EVE}}}          \usepackage{url}     \usepackage{amsmath}     \usepackage{amssymb}      %\usepackage{hyperref}     \usepackage[english]{babel}     \usepackage{cite}     \usepackage{tabu}     \usepackage{color}     \usepackage[table]{xcolor}     \usepackage{array,ragged2e}     \usepackage{caption}     \usepackage{breqn}     \usepackage{mathrsfs}     \usepackage{amsmath}     \usepackage{algorithm}     \usepackage{graphics}     \usepackage{graphicx}     \usepackage{algorithmic}     \newcommand{\R}{\mathbb{R}}     \newcommand{\I}[1]{\textbf{\texttt{#1}}}                    \begin{document}          \section{Test}               \begin{table}     \centering     \scalebox{0.8}{     \caption{The table}     \begin{tabular}{|c|c|c|c|c|c|c|c|}     \hline     \multicolumn{1}{|c|}{\textbf{1}} & \multicolumn{1}{|c|}{\textbf{2 }} & \multicolumn{1}{|c|}{\textbf{3}} & \multicolumn{1}{|c|}{\textbf{4}} & \multicolumn{1}{|c|}{\textbf{5}} & \multicolumn{1}{|c|}{\textbf{6}} & \multicolumn{1}{|c|}{\textbf{7}} & \multicolumn{1}{|c|}{\textbf{8}}\\     \hline          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 \\ \hline          \end{tabular}     }     \\[10pt]     \end{table}          \end{document}


title: Minted working from terminal but not Texpad

text: > **Possible Duplicate:**   >  minted not working on mac I'm using the minted package in latex on my mac (running lion). Now when I use the terminal to type               pdflatex -shell-escape MintedProblem.tex       it compiles fine and the resultant pdf looks perfect. When I try and typset the exact same document through Texpad (I assume any other IDE also) I just get a load of errors pertaining to the MintedProblem.out.pyg file. I have set up in preferences to use -shell-escape but this hasn't fixed it. Any ideas? My $PATH is shown below in case this sheds some light on things               /Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/Philip/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/bin:/Users/Philip/.rvm/gems/ruby-1.9.3-p194@global/bin:/Users/Philip/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/Philip/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/usr/texbin      All the errors are of the following form               Undefined control sequence. (...err}{\PYZbs{}}\PY{n}{relax}\PY{p}{\PYZpc{}}...)      Below is a minimal working file (working from terminal, not Texpad)               \documentclass[12pt, titlepage]{article}     \usepackage{minted}     \begin{document}     \newpage          \begin{minted}[mathescape,                    linenos,                    numbersep=5pt,                    gobble=2,                    frame=lines,                    framesep=2mm]{csharp}       string title = "This is a Unicode π in the sky"       /*       Defined as $\pi=\lim_{n\to\infty}\frac{P_n}{d}$ where $P$ is the perimeter       of an $n$-sided regular polygon circumscribing a       circle of diameter $d$.       */       const double pi = 3.1415926535     \end{minted}          \end{document}


title: Insert code into a latex doc. without leading tabs

text: When I write latex I usually indent my sections like this (it allows easier folding in vim, is like reading code, etc).               section{section}              bla bla bla bla bla              subsection{a}                  bla bla bla bla bla              subsection{b}                  bla bla bla bla bla      The problem is when I insert code (see below) into my document if I indent the all of the code 3 tabs it will be be indented 3 tabs in the document. I want to preserve the relative indenting but I don't want that extra three tabs of indentation. For example this latex:                   subsection{a}                  bla bla bla bla bla         \begin{lstlisting}         public static void main(String [] args){             bla bla         }         \end{lstlisting}      Produces:               *a*          bla bla bla bla bla                 /* code is indented 3 tabs */             public static void main(String [] args){                 bla bla             }      I would like it to produce:               *a*          bla bla bla bla bla     public static void main(String [] args){         bla bla     }      This is the code that is responsible for the code formatting (thanks Cloudanger).                   \usepackage{listings}         \usepackage{color}              \definecolor{dkgreen}{rgb}{0,0.6,0}         \definecolor{gray}{rgb}{0.5,0.5,0.5}         \definecolor{mauve}{rgb}{0.58,0,0.82}              \lstset{frame=tb,           language=Java,           aboveskip=3mm,           belowskip=3mm,           showstringspaces=false,           columns=flexible,           basicstyle={\small\ttfamily},           numbers=none,           numberstyle=\tiny\color{gray},           keywordstyle=\color{blue},           commentstyle=\color{dkgreen},           stringstyle=\color{mauve},           breakatwhitespace=true           tabsize=3         }


title: pgfplots "Dimension too large" returned when plotting rational function

text: I've been using `pgfplots` for graphing for a while, now, and have recently run into a situation where I need to graph rational functions. Most of these have worked out fine, but one has caused me to get a "Dimension too large" error. Here is my code:               \documentclass{article}     \usepackage{pgfplots}          \begin{document}            \begin{tikzpicture}         \begin{axis}[axis lines=middle, ymax=10, ymin=-10, xlabel=$x$, ylabel=$y$]           \addplot[only marks, scatter, scatter src=explicit, point meta=y] coordinates {             (-4, 4)             (-3, 5)             (-2, 10)             (-1, -5)             (0, 0)             (1, 1)             (2, 1.429)           };           \addplot[smooth, domain=-10:-1.5, variable=\x, samples=301, unbounded coords=jump, variable=\x] {(5 * \x) / (2 * \x + 3)};           \addplot[smooth, domain=-1.5:10, variable=\x, samples=301, unbounded coords=jump, variable=\x] {(5 * \x) / (2 * \x + 3)};           \addplot[dashed, domain=-10:10] {5 / 2};           \draw[dashed] ({axis cs:-1.5,0}|-{rel axis cs:0,0}) -- ({axis cs:-1.5,0}|-{rel axis cs:0,1});         \end{axis}       \end{tikzpicture}          \end{document}      This can be avoided by making the domains of the second and third plots restricted to `-3:-1.5` and `1.5:3`, respectively. I don't see how I would get too big a number, and can only imagine this being a decimal underflow issue. How can I fix this problem?


title: Access label of chapter / section / ... based on nesting depth

text: I want to know how to get the label of the chapter/section/subsection/paragraph which my text is currently in. I don't mean the name of the section via `\nameref{}` or `\titleref{}` , nor the number `\ref{}`, nor any `\label{}` related output. I want to get the `\chaptername` and so on, but related to the current nesting depth, with only one command. Best combined with the babel package for international use. If this works a rearranging of sections/paragraphs is easier, because the labels get updated according to the heading they are in. I can't provide a MWE, but here is something that comes quite close to what I mean. Note that the `\currentheadingname` command is the missing piece, which I am looking for.               \documentclass{book}     \begin{document}     \chapter{SomeChapter}     Greetings from this \currentheadingname          \section{SomeSection}     In this \currentheadingname \dots           \subsection{SomeSubsection}     This \currentheadingname is about \dots     \end{document}      The desired result looks like:   1. SomeChapter Greetings from this chapter 1.1. SomeSection In this section ... 1.1.1. SomeSubsection This subsection is about... Is there such a command? Or any workaround?


title: Overlapping todonotes

text: When adding several notes on the same line using `todonotes` and then one note on the line behind them, its impossible to see which notes belong to which line since the line connecting each textbox to the corresponding piece of text overlap. I made a minimal example below. Is there any way to automatically solve this problem using `todonotes` or any similar package?               \documentclass[10pt,a4paper]{article}      \usepackage{todonotes}     \usepackage{lipsum}          \begin{document}          \todo{Lorem}\textbf{Lorem} \todo{ipsum}\textbf{ipsum} \todo{dolor}\textbf{dolor}     sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore     et dolore magna aliqua. Ut enim ad \todo{minim}\textbf{minim} veniam, quis nostrud     exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.           \end{document}      ![An example of the problem with overlapping lines](http://i.stack.imgur.com/pSWWC.png) A couple of acceptable solutions (which I do not node how to obtain in LaTeX) is the following: ![Solution 1](http://i.stack.imgur.com/IMznw.png) ![Solution 2](http://i.stack.imgur.com/yCFmX.png)


title: Why is the .toc file created at end document?

text: To create a Table of Contents (for example), LaTeX2e follows the process:   * Run 1     * `.aux` file is created from scratch after `\begin{document}`.     * When processing section headers, write `\addtocontents` to the `.aux` file with the pertinent sectioning information.     * At `\end{document}`, `\input` the `.aux` file, which executes `\@writefile` via `\contentsline` to generate the `.toc` file.   * Run 2     * At `\begin{document}`, deactivate `\@writefile` and re-input the `.aux` file. This generates labelling information, etc., for the current compilation and has no effect on the `.toc` file already generated.     * After `\begin{document}`, the `.aux` file is opened for writing, which clears its contents. The process starts anew. The `2e` sources don't go into detail about why the system was designed this way. Since there are limited write registers, writing all `.toc` information in one pass at `\end{document}` minimises the number of files that need to be kept open during the document. So that aspect is sensible. But why is the `.aux` file input both at the beginning _and_ the end of the document? Couldn't the `.toc` file be generated at `\begin{document}` instead? (One difference is that if ‘Run 1’ is terminated prematurely, no `.toc` file will be generated at all so there'll be no ToC. Whereas if the `.toc` file were created at `\begin{document}` it would contain a partial ToC — but that's arguably no better or worse. And you could add, say, a `\@finishedauxtrue` flag inserted at `\end{document}` to catch this happening if necessary.) [[ **EDIT** : Well, loading the `aux` file at the end allows for some checking whether labels have changed, and so on. So the `aux` file does always need to be loaded twice; I guess my question is whether there's any difference for ToC generation when that happens.]]


title: moderncv - filesize of pdf too big

text: I managed to work out how to create a job application that is entirely written in the moderncv style. I use the moderncv class itself for my CV and the attachments (making each document a section with one to several scanned images embedded). For the cover letter I use the moderncv-based proposal of _yes-man_ from a mrunix thread. My problem is the file size of the attachment pdf. I have lots of certificates and documents to show. I scanned them and converted them from pdf to png and use               \usepackage{float}     \floatstyle{boxed}      \restylefloat{figure}      to show them in a pretty way. But with only a selection of 18 images the pdf has 14 MB, with all images 28 MB. So I reduced filesize with gimp and then scaled the images with 1.5 instead of 0.6 - but the result is unacceptable low resolution (bad image quality). Is there a solution out of this trap, i.e. is there a way to bring down pdf file size to 2-3 MB with ca. 18 almost full page png images embedded in a moderncv document - without losing readability and too much of image quality? EDIT: I tried black&white with good (!) results:               -rw-r--r-- 1 tj users  1288744 25. Sep 20:27 scan1.png     -rw-r--r-- 1 tj users    70618  6. Okt 15:19 scan1b.png     -rw-r--r-- 1 tj users   496796  6. Okt 18:02 scan1c.png     -r-xr-xr-x 1 tj users  1743427 25. Sep 14:26 scan 1.pdf      scan1 is the default conversion from the pdf to png, scan1b is the result of reducing image size (to unreadable, unfortunately), and scan1c is scan1 in black&white - less than half the size, quite good.


title: Latex "command examples" lookup / reference - from the command line?

text: I am already very fond of the `texdef` tool, which is used on the command line, something like this:               $ texdef -t latex \newcounter          \newcounter:     macro:#1->\expandafter \@ifdefinable \csname c@#1\endcsname {\@definecounter {#1}}\@ifnextchar [{\@newctr {#1}}{}      That is, we can lookup: search for and find the definition of `\newcounter` from the command line - which I think is great. However, often I am in need for something else. Like right now, I need to use `\newcounter`, and since I rarely use counters, I've completely forgotten what the correct syntax of usage (i.e. where I use `\the` and stuff). And then I always have to look up online `:)`, which means search engine, then click on hits, then it's not always the information that I hoped for, then back in browser, etc etc.. And not the least, I cannot be offline for this process. So, basically, what I'd need is a command line tool, with which I can look up some short information about a command, and hopefully an example; for instance, here's a pseudo:               $ texexampleref  \newcounter                    % \newcounter: creates a new counter (dimen?)          % example usage:          % create a new counter that is automatically set to zero     \newcounter{NameOfTheNewCounter}     % To increase the counter, use:     \stepcounter{NameOfTheNewCounter}     % ... or (add number 1):     \addtocounter{NameOfTheNewCounter}{1}     % To set the counter value explicitly, use:     \setcounter{NameOfTheNewCounter}{12}     % To show the counter value (typeout)     \typeout{ Counter value is: \theNameOfTheNewCounter }     % ...      Here, I borrowed a bit from LaTeX/Counters - Wikibooks as content. Basically, I'd hope for the info lines to be prefixed with a percent sign `%` -- so that the entire example snippet is pastable, say, in a `pdflatex` terminal shell; and it would be "compilable", in the sense that it would produce some output there in the terminal (at least a typeout to standard output). And of course - at least in this case - the same example can be delivered for queries about `\stepcounter` and `\addtocounter` and `\setcounter`, too. I kind of doubt this exists - for while not terribly comlicated, I can imagine this tool to be a maintenance nightmare `:)` (although, I could also imagine a superlong Community Wiki here, with user-editable examples, which could serve as one downloadable database source for the tool ... or, if there is a single command used for marking examples in `.dtx` files and such, maybe examples could be automatically harvested). But still, I'd like to know for sure - so my question is: is there such a tool out there?


title: labeling with words with counter, using lists

text: I'm sure it's very easy: I want to draw a circle and at specific, equally spaced angles display some words. So I can draw the circle as curved arrows using a `\foreach`. How can I use the same `\foreach` to take words I want to display from a list of words? Here is some code (which I didn't make, but found in texexample.net)               \def \n {12}     \def \radius {4cm}     \def \margin {9}           \foreach \s in {1,...,\n}     {       \node at ({360/\n * (\s - 1)}:\radius) {\s};       \draw[->, >=latex] ({360/\n * (\s - 1)+\margin}:\radius)        arc ({360/\n * (\s - 1)+\margin}:{360/\n * (\s)-\margin}:\radius);         }      \end{tikzpicture}     \end{document}      Now, instead of the`{\s}`, which displays numbers at the nodes, I'd like it to display words.


title: Cyrillic in minted label

text: Is it posible to use the Cyrillic text for the `label` option in minted source code listing? I try to compile this piece of latex code with xelatex:               \begin{minted}[mathescape,frame=lines,label=Паралелепіпед]{c++}     G4Box(const G4String& pName, // Ім'я об'єкту                    G4double  pX, // Напівдовжина за X                    G4double  pY, // Напівдовжина за Y                    G4double  pZ) // Напівдовжина за Z     \end{minted}


title: Frame numbers "truncated" in beamer presentation after first two-digit frame number

text: I'm trying to test out the Wuerzburg theme for a beamer-presentation, but running into some difficulties with the frame numbers in the header (or footer). In my preamble I have the following               \RequirePackage{atbegshi}     \documentclass{beamer}          \usepackage[english]{babel}          \mode<presentation>{\AtBeginSection{%     \begin{frame}     \frametitle{Contents}     \tableofcontents[currentsection]     \end{frame}}     \useoutertheme[nofootline]{wuerzburg}     \useinnertheme[outline,shadow]{chamfered}     \usecolortheme{shark}     \setbeamercovered{transparent}     }     \setbeamertemplate{navigation symbols}{}     \setbeamertemplate{frametitle continuation}[from second][(cont'd)]      The frame numbers show up in the header as desired, but they only look as they should for the first 9 frames. From frame 10/xx and on, something weird happens and the frame numbers end up being like as in the image I've attached. Same thing happens in the footer if i remove the nofootline option from the outer theme. I've tried to take a look in the .sty file, and other examples I've found online, but since I'm not too familiar with beamer yet I haven't managed to figure out how to fix this. The beamer theme is available at http://www.cgogolin.de/Computer.html . ![Sample of how frame numbers get truncaged](http://i.stack.imgur.com/zhoEN.png)


title: Diffuse russian text

text: I use some russian text in my file and when I compile it to pdf text becomes diffuse and transparent. How can I fix it? (To compile source file I use `latex + dvipdfm`, MikTex version 2.9) This is my code:               \documentclass[12pt]{article}          \usepackage[russian,english]{babel}          \usepackage[landscape, left=0.7cm, right=0cm, top=1.5cm, bottom=0.4cm]{geometry}          \usepackage{fancyhdr}     \pagestyle{fancy}     \fancyhf{}     \fancyhead[L]{Left}     \fancyhead[R]{Right}     \fancyheadoffset{-0.5cm}          \begin{document}     \selectlanguage{russian}          Hello world!          Привет мир!          \end{document}


title: Several nameref and page margins

text: I've been struggling with `nameref` for some time now. I am trying to make them respect the available space there is on a line, but I can't seem to find how. The LaTeX code is the following:               \documentclass{report}     %\documentclass{scrreprt}     \usepackage[inner=3.5cm,outer=2.5cm,top=2.5cm,bottom=2.5cm,pdftex]{geometry}     \usepackage[T1]{fontenc}     \usepackage[utf8]{inputenc}     \usepackage{lmodern}     \usepackage[pdftex]{hyperref}          \hypersetup{         colorlinks = true     }          \overfullrule=15pt % debug          \begin{document}          \chapter{Chapter name}          \section{Section name}          \subsection{XML\_DOM\_NodeFirstSonGet}\label{XMLDOMNodeFirstSonGet}     \subsection{XML\_DOM\_NodeSonsCount}\label{XMLDOMNodeSonsCount}     \subsection{XML\_DOM\_NodeSonsGet}\label{XMLDOMNodeSonsGet}     \subsection{XML\_DOM\_NodeSonsNodesCount}\label{XMLDOMNodeSonsNodesCount}     \subsection{XML\_DOM\_NodeSonsNodesCount}\label{XMLDOMNodeSonsNodesGet}          Normal text:\\\newline     Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\\               See \nameref{XMLDOMNodeFirstSonGet}, \nameref{XMLDOMNodeSonsCount}, \nameref{XMLDOMNodeSonsGet}, \nameref{XMLDOMNodeSonsNodesCount}, \nameref{XMLDOMNodeSonsNodesGet}.\\          See \nameref{XMLDOMNodeFirstSonGet}, \nameref{XMLDOMNodeSonsCount}, \nameref{XMLDOMNodeSonsNodesCount}, \nameref{XMLDOMNodeSonsNodesGet}.\\               See \nameref{XMLDOMNodeFirstSonGet}, \nameref{XMLDOMNodeFirstSonGet}, \nameref{XMLDOMNodeFirstSonGet}, \nameref{XMLDOMNodeSonsCount}, \nameref{XMLDOMNodeSonsNodesCount}, \nameref{XMLDOMNodeSonsNodesGet}, \nameref{XMLDOMNodeFirstSonGet}.     \end{document}      And the resulting PDF looks like this: ![enter image description here](http://i.stack.imgur.com/egQMp.png) As you can see, the second and third line containing `\nameref`s are overfull and won't respect the line width as the normal text does. The result is even worst with `\documentclass{scrreprt}` as they are all overfull and cropped by the page limit: ![enter image description here](http://i.stack.imgur.com/Kc1sD.png) As I don't know the length of the string that will be displayed, I can't arbitrarily force a new line. What also strikes me is that I didn't find any information about this behavior. Is there a way to fix this?


title: colorful background of the chapters in ToC without ''tocloft'' package

text: I would like to create a table of contents where the chapters appear with a colorful background just like attached Image, and i hope to do this without `tocloft` ( without packages or with `titletoc` ) ![enter image description here](http://i.stack.imgur.com/MLOQu.png) an attempt by Beginner               \documentclass{book}     \usepackage{fancyhdr}     \usepackage{titletoc}     \usepackage[svgnames]{xcolor}          \renewcommand\thesection{\arabic{section}.}     \renewcommand\thesubsection{\arabic{subsection}.\arabic{section}}          \pagestyle{fancy}     \renewcommand{\headrulewidth}{0pt}     \fancyhead[LE]{}     \fancyhead[RO]{}     \fancyhead[RE]{}     \fancyhead[LO]{}     \cfoot{\thepage}          \titlecontents*{chapter}       [0pt]       {\addvspace{1mm}}       {\colorbox{MidnightBlue}{\textcolor{white}%              {\chaptername\ \thecontentslabel}}}       {}       {\colorbox{MidnightBlue}{\textcolor{white}%              {\hspace{7.5cm}\contentspage}}}          \makeatletter     \let\stdl@chapter\l@chapter     \renewcommand*{\l@chapter}[2]{%       \stdl@chapter{\colorbox{MidnightBlue}{\textcolor{white}{#1}}}{\textcolor{MidnightBlue}{#2}}}     \makeatother          \begin{document}          \tableofcontents          \chapter{Chapter One}     \section{Section Two}     \subsection{Subsection Two}          \end{document}


title: Changing case of URL in \href argument

text: I would like to write a macro similar to the `\href` command from the `hyperref` package, but which takes a single argument. The URL is generated by making the argument lowercase. Here is a minimal example:               \documentclass{article}     \usepackage{hyperref}     \newcommand\mylink[1]{\href{www.\lowercase{#1}.com}{#1}}          \begin{document}     \mylink{MyURL}     \end{document}      However, the `\lowercase` command is not expanded, and the link points to `www.\lowercase{MyURL}.com`. Is there a way to solve this problem?


title: Biblatex: Automatic *Vgl.* & automatic quote indenting (depending on quote length)

text: Is it possible to create a command that:   1. Whenever it exceeds a certain number of lines in the output (preferably 3), it will be typeset indented.   2. The citation will automatically be typeset without " _Vgl._ " -- regardless of whether it is the short or the long form.   3. When the output is a paraphrase or summary (in other words: when the output is no citation) it is typeset with the prenote " _Vgl_ ".   4. It works in `biblatex`. Related answers for inspiration: In Linking quotation environment with citation styles lockstep worked out a quotation command based on `biblatex` that automatically generates a " _Vgl._ "-less output when used in a citation environment. And that generates a " _Vgl._ " output when used without quotation mark. Output-Example: > This is a paraphrase (vgl. Author 2001) > > This is a paraphrase with prenote (siehe hierzu auch Author 2001) > > "This is a direct quotation" (Author 2001) The Code:               \documentclass{article}          \usepackage[ngerman]{babel}          \usepackage[style=authoryear]{biblatex}          \NewBibliographyString{compare}     \DefineBibliographyStrings{ngerman}{%       compare = {vgl\adddot},     }          \usepackage{csquotes}     \SetCiteCommand{\autocite}          % \usepackage{etoolbox}% loaded by `biblatex`           \newbool{withintextquote}          \makeatletter     \patchcmd{\csq@tquote@i}{\begingroup}{\begingroup\booltrue{withintextquote}}{}{}     \makeatother          \renewbibmacro*{prenote}{%       \iffieldundef{prenote}{%         \ifbool{withintextquote}{%         }{%           \bibstring{compare}\addspace         }%         }         {\printfield{prenote}%          \setunit{\prenotedelim}}}          \usepackage{filecontents}          \begin{filecontents}{\jobname.bib}     @misc{A01,       author = {Author, A.},       year = {2001},       title = {Alpha},     }     \end{filecontents}          \addbibresource{\jobname.bib}          \begin{document}          This is a paraphrase \autocite{A01}          This is a paraphrase with prenote \autocite[siehe hierzu auch][]{A01}          \textcquote{A01}{This is a direct quotation}          \printbibliography          \end{document}      In Custom quotation style which depends on length of quotation Martin Scharrer worked out a way to generate quotations that are typeset indented or unindented -- depending on the length of the quotation. The main point with this command is: Whenever the quotation exceeds a certain number of lines in the typeset output, it will be indented. The code:               \documentclass{article}          \makeatletter \newcommand{\cquotation}[1]{%         % \settowidth doesn't like paragraphs         \setbox\@tempboxa\hbox{%             \def\par{\hspace{3\linewidth}}% If a paragraph is included force long form             %\let\par\space  % Ignore paragraphs             #1}%         \ifdim\wd\@tempboxa>3\linewidth             \begin{quote}                 \itshape                 #1             \end{quote}         \else             {\itshape #1}%         \fi } \makeatother          \begin{document}          % Lipsum add paragraphs :-( \def\Text{text text text text text } \edef\Text{\Text\Text\Text\Text\Text}          \Text \cquotation{some short quote} \Text          \Text \cquotation{% Some quotation just short of three lines of text. Some quotation just short of three lines of text. Some quotation just short of three lines of text. Some quotation just short of three lines of text. Some quotation just short of three lines. } \Text          \Text \cquotation{% Some quotation shorter than three lines.          But with a paragraph inside. } \Text          \Text \cquotation{% Some quotation longer than three lines.  Some quotation longer than three lines. Some quotation longer than three lines.  Some quotation longer than three lines. Some quotation longer than three lines.  Some quotation longer than three lines. Some quotation longer than three lines.  Some quotation longer than three lines. } \Text          \end{document}               % Lipsum add paragraphs :-( \def\Text{text text text text text } \edef\Text{\Text\Text\Text\Text\Text}          \Text \cquotation{some short quote} \Text          \Text \cquotation{% Some quotation just short of three lines of text. Some quotation just short of three lines of text. Some quotation just short of three lines of text. Some quotation just short of three lines of text. Some quotation just short of three lines. } \Text          \Text \cquotation{% Some quotation longer than three lines.  Some quotation longer than three lines. Some quotation longer than three lines.  Some quotation longer than three lines. Some quotation longer than three lines.  Some quotation longer than three lines. Some quotation longer than three lines.  Some quotation longer than three lines. } \Text          \end{document}      **Note**. There occur two minor problems with this command.   1. Whenever you use `\autocites{}{}` with more than one source you will get something like _vgl. Grice (1989); vgl. Levinson (2000)._ including more than one _vgl._.   2. When you use this command with `autocite=footnote` the counter will "jump" two steps with every `\autocite` that is embedded in a `\cquotation{}`, e.g. whenever you have something like this `\cquotation{text text text \autocite{}.}` the counter will add two instead of one. Thus, the numbering of your footnotes will look odd (for example 1, 2, 3, 5, 7, 8, 9 ...). Both issues are successfully addressed in moewe's answer to Biblatex: Problems with _vgl._ and numbering in dynamic quotation command.


title: Pgfplots graphics tick label positioning issue with latex->dvi (but not with pdflatex->pdf)

text: I'm trying to plot an image file in a pdfplots axis. This is a minimal example (the files fig2a.eps and fig2a.png both contain the image that should be plotted):               \documentclass{standalone}     \usepackage[utf8]{inputenc}     \usepackage[english]{babel}     \usepackage{tikz,pgfplots}     \begin{document}     \begin{tikzpicture}     \begin{axis}     \addplot graphics[xmin=-0.15, xmax=0.15, ymin=0.0, ymax=0.2] {fig2a};     \end{axis}     \end{tikzpicture}     \end{document}      When compiling with pdflatex, I get exactly what I want. With latex (producing a dvi file), the tick labels are all on top of each other inside the image, so something goes wrong with the positioning. I suppose version information is useful in this case -- from the output to the screen I have this when running both latex and pdflatex:               This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012)      What am I doing wrong?


I have just downloaded WinEdt and written my first code, but it will not run because I keep getting the following error. I am at a loss as to how to fix this. > Error launching Console Application PDFLaTeX ... > > Command Line: pdflatex.exe --interaction=errorstopmode --synctex=-1 > "practice.tex" > > Startup Folder: C:\Users\shahand\WinEdt Team\WinEdt 8 > > The system cannot find the file specified.


title: The system cannot find the file specified (error)

text: I have been using Windedt with Texlive since many days. But I stopped using it for a while, and when I now compile a tex file, its giving error "The system cannot find the file specified". I don't know wats wrong. I have used this before. I tried re-installing Winedt, no use. I have recently changed the System Path for installing some software. Has it affected in anyway?? Please help me.


title: Lyx: How to align text

text: I don't know how to describe exactly my issue, but I'll make a try: I am writing a document on Lyx, and I am using the module "report". I have customised the page margins but when I write paragraphs, some sentences do not obey the margin and some words are not in the same line. Graphically: ![enter image description here](http://i.stack.imgur.com/SWLQY.png) From a PDF that is created with Office there is a tool (a ruler I think) with which you can make the paragraphs in order to be all the words in the same line. For example: ![enter image description here](http://i.stack.imgur.com/fgRUF.png) How can i fix this issue?