title: create a non breaking environment

text: > **Possible Duplicate:**   >  How to prevent LaTeX from line-breaking a phrase? I add names of persons into an index. How can I prevent that there will be a line brake in the name?               \newcommand*{\person}[1]{#1\sindex[person]{#1}}      It would be nice if there is another solution then writing `~` in all names manually.


title: Code fails with Emergency stop, when using \expandafter\csname and such in listings

text: I am further working on my code for LaTeX Examples. I want to use the package showexpl for the simultaneus printing of code and results. Unfortunately I get an '! Emergency stop.'               \documentclass{scrbook}     \makeatletter     \providecommand{\packagename}{templatedemo}     \RequirePackage{etoolbox}     \RequirePackage{showexpl}          \providecommand\AddDemo[3][]{%       \expandafter\providecommand\csname demo@content@#2\endcsname{#3}%       \expandafter\providecommand\csname demo@options@#2\endcsname{#1}%     }          \providecommand\demo@printhis{}     \providecommand\PrintDemo[1]{%       \ifcsdef{demo@content@#1}%       { % print          \renewcommand{\demo@printhis}{\expandafter\csname demo@content@#1\endcsname}         \begin{LTXexample}            \demo@printhis         \end{LTXexample}        }%       {}     }          \AddDemo{text}{Sample Text}% end: \AddDemo          \makeatother     \listfiles          \begin{document}       \PrintDemo{text}     \end{document}      If this would work, the next problem would be that the listings shall only show the expanded version. So If I wrote:               \begin{document}         \begin{LTXexample}            \PrintDemo{text}         \end{LTXexample}      \end{document}      the listings package would output '\PrintDemo{text}' instead of its contents.


title: Reference to something in a different file, in a different directory?

text: I'm working on a text that has to be split up in 4 parts, with each part containing it's own table of contents and it's own appendix. Four separate pdf's are needed. The page numbers and section numbering has to be continued from one part to the other though, so eg. if `DEEL1` (in english: `PART1`) ends at page 10, `DEEL2` has to continue at page 11. Since I know the length of each document I have done this manually using `\setcounter{page}{10}` (same goes for sectioning, although I'm not sure of how to let the appendix sectioning work). My directory is split up into folders for each part.               DELEN     ├── DEEL1     ├── DEEL2     ├── DEEL3     └── DEEL4      Now I'd like to be able to reference something that isn't in that particular part. Eg.: if `\label{prt1:sec:section2}` is in part one, I would like to be able to use `\ref{prt1:sec:section2}` in parts two, three and four too. Is this possible?


title: Specify .ist-File for latexmk in TextMate

text: So I'm using latexmk.pl to compile my TextMate LaTeX Project and it's running quite nice. The only thing I'm missing, is, that i want to specify an individual style file for the `makeindex` command, i.e. latexmk.pl when `latexmk` decides to run makeindex, it should add something like               makeindex -s mystyle.ist      I won't mind setting the .ist file to my $TM_LATEX_MASTERs name, but it would also be nice to have a seperate style file. I haven't found anything to define such an option for latexmk that is called from TextMate. Do you have any ideas? PS: I'm using XeTeX to compile, but i think that might only be of minor interest.


title: Macro parameter delimited by more than one delimiter

text: TeX user can simply create the macro with a parameter delimited by an arbitrary sequence of tokens. For example               \def\macro #1delimiter{...#1...}      Is it possible to create a macro with a parameter which has more than one delimiter? I mean something like this:               \mydef\macro #1[first or second]{...#1...}     \macro text first  % -> ...text ... (delimiter is first)     \macro text second % -> ...text ... (delimiter is second)      The parameter text should be scanned to the first delimiter from a list of delimiters. No more scanning. I know that you can set a fixed delimiter after this (\par for example) and then to treat with this longer parameter and read words "first" or "second" from it. But this approach reads more input data than we need. Unwanted tokenization is done, maybe here is unbalanced text etc.


title: How to construct the following table with title in LaTeX?

text: I would like to construct a table look like the picture below: ![wanted](http://i.stack.imgur.com/VLErE.png) The code below represents my best attempt so far (the words in the table don't really mean anything):               \resizebox{9cm}{!} {     \begin{tabular}{l*{2}{c}r}      Model              & Linear Regression && MLE \\     \hline     fakedata50  & -1.037 & &4   \\     fakedata100 & -1.038 && 3  \\     fakedata500  & -0.7859 && 2 \\     fakedata5000  &-0.7742 && 2  \\     fakedata10000 &-0.7665&&o \\     fakedata100000 &-0.7206&&j \\     fakedata1000000 &-0.6939&&j \\     \end{tabular} }      However, I would like to center my table but the command `\centering` is not working. Also, when I tried to enlarge my graph by changing the value in `\resizebox`, the font size increased as well, which is undesirable. Is there a way of increasing the font size proportionally to how much I enlarge my table? Lastly, how can I typeset a title for my table?


title: How to get the catcode of a token?

text: For debugging a complicated macro I would like to print out the catcode of a token. Optimally I would like to have a macro `\getcatcode` such that, for example, `\getcatcode{a}` would expand to `10`. How can this be done? I found lots of information about how to set/change catcodes, but nothing about how to read them.


title: Control errors with subcaption subfigure

text: Code:               \documentclass[fleqn,11pt,a4paper]{article}     \usepackage{geometry,array,graphicx,float,caption}     \usepackage{subcaption}          \begin{document}     \begin{figure}[H]         \centering         \begin{subfigure}             \includegraphics[width=5cm]{initial_uniform.eps}             \caption{Uniform Distribution}             \label{fig1a}         \end{subfigure}     \end{figure}      I have the caption package installed and subcaption.sty is detected. However, when I use subfigure I am getting these errors:               ! Missing number, treated as zero.     <to be read again>                         \let      l.72        \includegraphics                            [width=5cm]{initial_uniform.eps}          ! Illegal unit of measure (pt inserted).     <to be read again>                         \let      l.72        \includegraphics                            [width=5cm]{initial_uniform.eps}      and more control errors. When I comment out the lines for begin and end subfigure i.e use just normal figure, everything works just fine. I can't understand what is wrong here.


title: Typesetting mathematical constants

text: Is there any command for typesetting constants in mathematical formulas? I would imagine something similar to `\operatorname` or `\DeclareMathOperator`, but for constants. I want the constant to be typeset in roman font as in the text mode (with proper spacing and ligatures - this concerns constants denoted by a couple of letters).


title: change position of tick multiplier

text: I have a plot like this and want to change the position of the 'tick multiplier', i.e. change where the $10^{-3}$ or $10^{-4}$ actually occurs. I don't want to change where ticks occur or remove the scaling.               \documentclass{standalone}     \usepackage{amsmath,tikz,pgfplots}     \begin{document}     \begin{tikzpicture}     \begin{axis}[scaled ticks=true]     \addplot coordinates {     (20000,0.0005)     (40000,0.0010)     (60000,0.0020)     };     \end{axis}     \end{tikzpicture}%     \end{document}      ![enter image description here](http://i.stack.imgur.com/CfXjq.png)


title: Drawing relationships between elements of a database

text: I am looking into a feasible way of drawing relationships between Elements from a database. An example: Element x is related to Element Y via the Role "sister". Relationships exist in the form 1:1, 1:n or m:n, so one element may link to >1 other elements, there are also >1 element types and >1 role types. Right now it is done manually in Powerpoint, which is really prone to errors. Is there a suitable way to draw these diagrams via TikZ/PGF or any other software? I'd love to write some SQL script to get me the list of elements with their relationship and have e.g. Python prepare the TeX Code. The major challenge is for me, that I have no clue how many elements come from the database and I would like to have LaTeX do the positioning. ![enter image description here](http://i.stack.imgur.com/ptnlr.png)


title: choose from a list with xstring

text: I want a command that does the following:               \variation{1}{aaa;bbb;ccc} ----> aaa     \variation{2}{aaa;bbb;ccc} ----> bbb     \variation{3}{aaa;bbb;ccc} ----> ccc      The string in the second input can be a list with as many ; as needed (perhaps none at all), not just three as shown. I have almost got what I needed using xstring but it contains superfluous inputs and notation and is basically not elegant!               \newcommand{\variation}[3]{\StrBetween[#1,#2]{;#3;}{;}{;}}      Hence this is what I get               \variation{1}{2}{aaa;bbb;ccc} ----> aaa      It's the second input is the superfluous one.


title: Addition and subtraction of chemical equations

text: Is there a package that supports the addition or subtraction of chemical equations, perhaps with automatic tabbing and a alignment. Whilst it is obvious I could set up tables or use mathmode's align feature, it seems so much more efficient to have a package handle the tabbing automatically, since it is rather predictable in this application. `mhchem` does not seem to have such a feature... ![enter image description here](http://i.stack.imgur.com/QhUwI.png) ![enter image description here](http://i.stack.imgur.com/cj1hH.png) Another advantage is you could maintain the readability of your equations and you would not have the added clutter associated with tables, especially tabs `&`, which diminish the readability of your .tex document. And of course, the line should be automatically inserted before the last row.


title: Using PGF/TikZ 3.0 on mac

text: Today I updated my MacTeX/texlive distribution and I have finally PGF/TikZ version 3.0.0!! However, after using the 2.10-CVS version as described in this answer for a long while, I want to make sure that I know how to revert to the global installation so I could use the newer version. I guess I have to delete the relevant directories as described in the answer. And then what? Is it enough?


title: Putting nodes tightly next to each other in tikz

text: I would like to have a shape in my diagram looking like this: ![desired shape](http://i.stack.imgur.com/ykZIk.png) My main problem is to arrange the nodes as tightly as possible. My current approach is               \documentclass{standalone}          \usepackage{tikz}     \usepackage{amssymb}          \begin{document}     \tikzstyle{state}=[circle, draw, minimum size=5mm,inner sep=0pt]     \tikz{     \node[state] (a) {};     \node[left of=a] {$\vartriangleright$};     }     \end{document}      which results in ![enter image description here](http://i.stack.imgur.com/CBa8J.png) This is of course not preferable. I just need to know how to place the triangle node as tightly as possible right next to the circle node.


title: TikZ: using decorations.markings to decorate a clipped path

text: I clipped a circle along the line `atan(2/3)`. Where the circle is clipped I would like to put an arrow. I thought it would be as simple as `(atan(2/3) + 180)/360` to get its percentage location along the path. Unfortunately, it wasn't. I ended up subtracting `32.5` degrees due to trial and error. I would like to make a more exact placement though.               \documentclass[tikz]{standalone}     \usetikzlibrary{decorations.markings}          \begin{document}     \begin{tikzpicture}       \pgfmathsetmacro{\angle}{atan(2/3)};       \pgfmathsetmacro{\ppi}{\angle + 180};       \pgfmathsetmacro{\percent}{(\ppi - 32.5)/360};            \begin{scope}[rotate = \angle, decoration = {           markings,           mark = at position \percent with {\arrow{stealth}}         }]         \clip (0, .4) rectangle (-.45, 0);              \draw[postaction = decorate] (cylinder) circle[radius = .395cm];       \end{scope}     \end{tikzpicture}     \end{document}      ![enter image description here](http://i.stack.imgur.com/EIFs2.png)


title: Creating commands for frame grids

text: From Jake's answer to Drawing on an image with TikZ , I learned how to display gridlines on my beamer slides during development. It has greatly helped me in precise positioning of tikz nodes and objects. The code that I slightly modified and am using now, is:               \begin{tikzpicture}[remember picture, overlay]         \draw[help lines,xstep=.25,ystep=.25,gray!20] (current page.south west) grid (current page.north east);         \draw[help lines,xstep=1,ystep=1,gray] (current page.south west) grid (current page.north east);         \foreach \x in {-15,-14.5,...,15} {             \node [anchor=north, gray] at (\x,0) {\tiny \x};             \node [anchor=east,gray] at (0,\x) {\tiny \x};         }     \end{tikzpicture}      which, on a slide, looks like this: ![enter image description here](http://i.stack.imgur.com/hz74t.png) Now, I find myself repeatedly adding these lines manually for each slide and commenting them out when I'm done. It's getting cumbersome, and also causing my file to bloat. I would like to be able to toggle gridlines on and off with a single command. How can I:   * Convert the above snippet into a command that, if set in the preamble, turns gridlines on for all the slides (or frames) and   * If the command is called from inside a `\begin{figure}...\end{figure}`, turns it on only for that slide. Needless to say, these shouldn't mess with any existing tikz figures on that slide. * * * For now, I've simplified a lot of the bloat by defining a new command:               \newcommand{\gridlines}{         \begin{tikzpicture}[remember picture, overlay]             \draw[help lines,xstep=.25,ystep=.25,gray!20] (current page.south west) grid (current page.north east);             \draw[help lines,xstep=1,ystep=1,gray] (current page.south west) grid (current page.north east);             \foreach \x in {-15,-14.5,...,15} {                 \node [anchor=north, gray] at (\x,0) {\tiny \x};                 \node [anchor=east,gray] at (0,\x) {\tiny \x};             }         \end{tikzpicture}     }      and just calling `\gridlines` before the `\end{frame}` in each slide. A big improvement over copying 4-5 lines of code each time, but still not as convenient as a global on/off option. Ideally, I would like it to be applied last, so that it overlays on everything else on the slide. Would it be possible to hack/redefine `\end{frame}` so that it becomes `\gridlines\end{frame}` instead?


title: How to modify itemize vertical spacing within blocks in beamer?

text: I have noticed that when I have "itemize" environments defined within blocks in beamer, that they introduce more vertical spacing between the top and the bottom of the blocks, than vertical text. Since I have a slide with some text filled blocks and directly after, a slide with only "itemize" holding blocks, I would like the spacing between the itemized text and the block to be the same as for regular text. On this question I have read about "squeeze" option, but it doesn't seem to work... **Additional info** : The problem is in the additional vertical space that is included by the "\itemize" environment. I have found this answer on how to remove vertical spacing from the itemize list, and I am using this approach. However, it is a brute force approach. What I would like to know if it is possible to have the same vertical space between the end of the itemize list and the bottom of a block, as the one set between the normal text and the bottom of the block. MWE:               \documentclass[10pt]{beamer}     \usepackage{amsmath}     \usepackage{amsfonts}     \usepackage{amssymb}     \usepackage{exscale}     \usepackage{epsfig}     \usepackage{fancybox}     \usepackage{lmodern}     \usepackage[T1]{fontenc}     \usepackage{overpic}          \usepackage{multimedia}          \usetheme{default}     \usecolortheme{crane}          % -- Modifications that enable the footline and set black color for the fonts      \setbeamertemplate{footline}{%         \begin{beamercolorbox}[wd=\paperwidth,ht=2.25ex,dp=1ex,right, rightskip=1mm, leftskip=1mm]{titlelike}             \textcolor{black}{                 %\inserttitle\hfill\insertauthor\hfill\insertframenumber%                 Something\hfill Something Else \hfill\insertframenumber%             }         \end{beamercolorbox}     }          \setbeamertemplate{itemize items}[square]          \setbeamercolor{item}{fg=black}     \setbeamercolor{frametitle}{fg=black}     \setbeamercolor{block title}{fg=black}     \setbeamercolor{title}{fg=black}     \setbeamercolor{block body}{bg=white}          % END Modifications          \begin{document}               \begin{frame}       \frametitle{text blocks}         \begin{block}{block}             block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   blockk         \end{block}{block}          \begin{block}             block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block         \end{block}         \begin{block}{block}             block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block         \end{block}     \end{frame}          \begin{frame}       \frametitle{itemize blocks}         \begin{block}{item}             \begin{itemize}                 \item item                  \item item                  \item item             \end{itemize}         \end{block}         \begin{block}{item}             \begin{itemize}                 \item item                  \item item                  \item item             \end{itemize}         \end{block}         \begin{block}{item}             \begin{itemize}                 \item item                  \item item                  \item item             \end{itemize}         \end{block}               \end{frame}          \end{document}


title: Cool Text Highlighting in LaTeX

text: LaTeX has `soul`. ConTeXt, of course, has beautifully marked up "sharpie" highlighting, where you can put sweet hightligher under your text for free! ![From randomdeterminism.wordpress.com](http://i.stack.imgur.com/BLWNY.png) In the pictured example, you can see highlights that not only highlight, but that do it with cool edges that look so good, you can smell fumes! The fearless author says he'll show how that was done in another post; this one shows only how to lay down a straight, yellow box. But, it is possible to do word-wrapped highlighting with cool-shapped boxes within ConTeXt, presumably. The trouble for me is that getting into the ConTeXt world is steep climb right now, given the state of documentation and the flux of changes, so I need to continue with LaTeX. But the _real_ problem is that now I can't live without the Organic-Looking Highlights of Awesomeness in that picture! As I said, Non-Organic-Looking Highlights of the Ordinary are easy with the soul package:               \hl{Some awesome text that word wraps fine.}      It just taunts me on the page with its straight lines. So, if I sacrifice word wrapping, I can use PGF/TiKz and create the following macro:               \newcommand\hl[1]{%         \tikz[baseline,%           decoration={random steps,amplitude=1pt,segment length=15pt},%           outer sep=-15pt, inner sep = 0pt%         ]%        \node[decorate,rectangle,fill=navcolor,anchor=text]{#1\xspace};%     }%      Which creates something like this: ![A picture of how my TiKz highlighter looks](http://i.stack.imgur.com/O7zKN.png) Now, my color is too dark and my randomness needs adjusting, but you see that a similar effect could be achieved. My trouble is that I don't understand TeX enough to dig into the Soul package and add the TiKz/PGF goodness that it so sorely needs. So, I leave it to you guys. Anyone want to tackle this? Or is it yet another piece of fruit, just a touch out of reach, that shall have to wait until ConTeXt settles down?


title: Make the chapter number to appear as text in the TOC

text: I am using the Memoir class to develop a thesis template and I have a problem that I am not able to solve. I want the chapter number to be displayed as text in the TOC. I already made the number to appear as text in the actual chapter but a haven't been able to do it in the TOC. Basically this is what I want to do: Chapter One: Introduction 1.1 Why 1.2 XXXX Chapter Two: Experiment 2.1 XXX 2.2 XXX If you can help me with this problem I will really appreciate your help.


title: fakebold error in fontspec or lualatex

text: I have been trying to fake small caps which are not available in Myriad Pro. So I used the Scale and FakeBold options. Scaling is allright, but as you all know the glyphs slim out. To work against that I tried to "fatten" them somewhat. The code below does not "fatten" the scaled characters when using lualatex (latest TeX-Live). Using xelatex (also latest TeX-Live) works fine. I think its a bug.               \documentclass[11pt,a4paper]{article}     \usepackage{fontspec}     \setmainfont{TeX Gyre Heros}     \begin{document}     ABC {\fontspec[FakeBold=5,Scale=0.72]{TeX Gyre Heros} ABC} ABC     \end{document}      For demonstration the code above uses another fontwich actually supports small caps.


title: How could I customize \titlepage in beamer?

text: everyone, I have a beamer presentation but now I need to add two logos to the `\title` page before that the macro `\title`, but when I add this to the code I get several errors, I think that I have to use the macro `\defbeamertemplate` but I don't know how to add the images and text. I have the following code:               \documentclass{beamer}          \usepackage{graphicx}          \begin{document}     \begin{frame}          \begin{picture}(18,1)     \put(-26,-67.5){\includegraphics[scale=0.3]{ipn.png}}     \put(240.5,-70.5){\includegraphics[width=2.1cm]{escom.png}}     \end{picture}          \textcolor{red}{\textbf{\begin{Large}     \\\hspace{1.35cm}Instituto Polit\'ecnico Nacional     \end{Large}}\\}     \hspace{1cm}     \textcolor{blue}{\textbf{\begin{Large}     Escuela Superior de C\'omputo     \end{Large}}}           \title{Trabajo Terminal: 2011-0003 SOCPO}          \end{frame}          \end{document}      I would like to get something like this: ![I would like to get something like this](http://i.stack.imgur.com/sduk5.png)


title: How to place a shaded box around a section label and name

text: In working with a publisher, I need to format section headings like this (using ASCII art):               +-----+-------------------------------------+     | 1.2 |  Section name                       |     +-----+-------------------------------------+              Texts starts here, aligned with the              section name, and so on...      At least, that's the basic idea - more details below. That is:   1. The section label and name should all be "boxed".   2. The whole box extends the width of the text on the page.   3. The section name should align with the text itself; the section label hangs into the left margin.   4. Even more ideally, the background of the boxes containing the section number and section name should be shaded (differently: the section number is in a box with a slightly darker shade of blue that the section name). I'd be happy with just this as a solution. But why not hope beyond hope, and tell the full story? The actual "box" actually has rounded, not square, corners at the left extreme, so much so that the left end of the larger box is actually rounded entirely. Plus, the right end of the "box" containing the section number itself is similar. That is, the far left of the box is a rounded edge, the far right is a vertical edge, and the dividing "line" between the section number and name is rounded also. Here's an attempt in ASCI art, without the top and bottom of the boxes (I couldn't make that look any good):               ( 1.2 ) Section name |      No comments on the merits of this format please `:-)`. Just wondering if anyone knows how to do it in LaTeX. I have been playing with various packages, such as `titlesec`, but I cannot seem to massage this in to what the publisher would like. I can manage point 3 above (in addition to getting font and font size about right); that's about it.


title: Screen friendly/easy on the eyes background

text: Do you have suggestions on how to make a PDF file easier to read on a computer screen? By this I mean anything which isn't changing the format and layout, as this has been discussed in other questions I believe. I'm thinking of keeping the text in black while using a sand-coloured background. What's a good package for that?


title: Figures Grouped at the End

text: A requirement for a paper I'm writing is that all figures occur at the end of the document, with one figure per page, and with a page of figure captions preceding the pages of figures. Is there any way to automate this from what I have? (That is, figures normally interspersed in the document with `\caption`'s and `\label`'s inside the `\begin{figure}` environment) If not, (that is, if I would need to move the figures around) what would be a good TeX-approved way to do this?


title: want to bring references/bibliography without new section

text: Hi I am working on a document where I don't want to have any empty space before bibliography starts. Even don't want the bibliography title. For now I deleted the heading, but still the space remains. Can anybody please suggest me how can I get rid of the space?   This is what I tried.               \documentclass[11pt, twoside]{report}     %All the packages that I needed.      \renewcommand{\bibname}{} %The heading Bibliography gone     \begin{document}     %%%%%%%%%%%%%%%%     %%All text     {{\footnotesize}     \bibliographystyle{plain}       % Style BST file % or add {bmc_article}      \bibliography{compbio2014} }          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     \end{document}      Basically I want the references to be started just after the last section text with new line. But no section break. So far I was using wither plain, or bmc_article bst file. Any help will be really great. Thanks, Mitra.


title: Double subscript error with \newcommand?

text: Disclaimer: I know of Defining a newcommand with sub- or superscript and avoiding "double subscript" error but this only gives a work-around, but no explanation to my question. Here's a summary of the problem. This code:               \documentclass{article}          \newcommand*{\one}{a_1}   %no explicit brackets     \newcommand*{\two}{{a_1}} %explicit brackets          \begin{document}       $b_\one$ % error: Double subscript       $b_\two$ % no error     \end{document}      Gives me the error `Double subscript` on `b_\one`. Why? When do I need the "scope" brackets and when do I not need them? I always thought a command defined by `\newcommand` is "automatically" a _single_ "object" on its own that does not need to be put inside brackets. The question is _not_ why one needs brackets at all (this is clear), but the question is why one needs them in the defintion when using `\newcommand`? By the way, what is the correct "vocabulary" for the "scope" and "object" in LaTeX?


title: Bibtex file content won't appear in beamer presentation

text: Somehow I can't get through this problem. I have made a `beamer` presentation. At the very end of it I would like to present the `.bib` file that I have created. Though I get no errors, I also can not get any content of this file to appear. Here is the code of the last frame:               \frame{     \frametitle{Literaturverzeichnis}     \nocite{*}     \bibliographystyle{amsalpha}     \bibliography{bibliographie}     }      Thanks a lot for your help.


title: How to make global a color list definition with \@namedef done inside a foreach loop

text: ### Motivation As stated in the title, I'm trying to define a command able, from a list of colors as input, to create a list in which colors are numbered. This, manually, has been done in Arrows coordinates in TikZ ### Preliminary work I've tried to search in the site questions related to the problem, such as How to define macros in a foreach loop with effects between iterations and after the loop without using global?, How to define macros in a foreach loop with effects between iterations and after the loop without using global? (especially solutions shown in Martin's comment). But I can't figure out a solution when the definition is based on `\@namedef` ### The minimal-non-working-example This is what I tried:               \documentclass[11pt,a4paper]{article}     \usepackage{tikz}          \makeatletter          \newcommand{\setcolorlist}[1]{             \foreach \listitem [count=\i] in {#1}{                 \global\let\@tempa\@namedef{color@\i}{\listitem}             }             \@tempa     }          % Command in which colors are necessary     \newcommand{\drawcoloredarrows}[1]{         \foreach \i  in {#1}{             \edef\mycolor{\@nameuse{color@\i}}             \draw[\mycolor,-stealth] (0,-\i)--(2,-\i);          }     }          \makeatother          \begin{document}     \setcolorlist{red,cyan,blue,green}          \begin{tikzpicture}         \drawcoloredarrows{1,...,4}     \end{tikzpicture}     \end{document}      getting: ![enter image description here](http://i.stack.imgur.com/oNX0i.png) ### How it should work This is how it should work:               \documentclass[11pt,a4paper]{article}     \usepackage{tikz}          \makeatletter     \@namedef{color@1}{red}     \@namedef{color@2}{cyan}        \@namedef{color@3}{blue}      \@namedef{color@4}{green}            \newcommand{\setcolorlist}[1]{             \foreach \listitem [count=\i] in {#1}{                 \global\let\@tempa\@namedef{color@\i}{\listitem}             }             \@tempa     }          % Command in which colors are necessary     \newcommand{\drawcoloredarrows}[1]{         \foreach \i  in {#1}{             \edef\mycolor{\@nameuse{color@\i}}             \draw[\mycolor,-stealth] (0,-\i)--(2,-\i);          }     }          \makeatother          \begin{document}     %\setcolorlist{red,cyan,blue,green}          \begin{tikzpicture}         \drawcoloredarrows{1,...,4}     \end{tikzpicture}     \end{document}      getting: ![enter image description here](http://i.stack.imgur.com/nwdMk.png)


title: How to use all variants of Latin Modern Roman with fontspec?

text: Sorry I have minimal knowledge of how font families work in TeX. After trying to read the fontspec documentation I get more and more confused. I am trying to get as many variants of Latin Modern Roman working as I can, especially the variants of unslanted roman, oblique small caps. Foe example I do not know how to get small caps oblique to be used when itshape and scshape are both in effect. I originally wanted `\textup` to have the Unslanted variant of the font but doing `UprightFont = Latin Modern Roman Unslanted` would change all normal font to that as well. I thought the whole point of `\textup` and `\textrm` being separate commands is allow distinction with upshape? Anyhow because of this I am defining `\textun` for the unslanted variant. Is it also possible to have fake bold with small caps by using, say, `weight` in fontspec such that I can put `\textsc{Abc}` in section headings (i.e. such that it works with `\bfseries`)?               \documentclass[a4paper,10pt,english,draft]{article}     % Additional Options     \usepackage[log-declarations=false]{xparse}     \usepackage[quiet]{fontspec}     %fontspec options:     \setmainfont[Ligatures=TeX,SmallCapsFont={* Caps}, SlantedFont={* Slanted}]{Latin Modern Roman}     \newfontface\textun{lmromanunsl10-regular.otf}      %I cannot use \newfontface\textun{Latin Modern Roman Unslanted} for some reason...     \begin{document}         Latin Modern Roman normal text \newline           \textit{Latin Modern Roman italic text} \newline           \textsl{Latin Modern Roman Slanted} \newline           \textun{Latin Modern Roman Unslanted} \newline         \textsc{Latin Modern Roman Caps} \newline           \emph{\textsc{Latin Modern Roman Oblique small caps?}}     \end{document}


title: Why does Minted color the first method of a c++ class differently?

text: I am using minted to list c++ source code in LaTeX. When I compile the following sample I get a strange result.               \documentclass[12pt,a4paper]{article}     \usepackage[utf8]{inputenc}     \usepackage{minted}          \begin{document}          \begin{figure}[h!tb]     \begin{minted}[linenos=true]{cpp}     class Gpio{       public:         static void setMode(uint32 pin, PIN_MODE mode);         static void setValue(uint32 pin, PIN_VALUE mode);         static void setPullUpDownMode(PUD_MODE mode);       private:     };     \end{minted}     \end{figure}          \end{document}      The result I get looks like this: ![Minted C++ Example Result](http://i.stack.imgur.com/MPwnR.png) Does somebody have an idea why the first method is not colored blue? It's always the first one, I have tried various numbers of public methods. Also if there is only one, it's still black and not blue.


title: Changing fontsize on individual beamer note pages

text: I am writing a presentation in which certain slides are heavily commented upon and others not so much. As I am using `\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]` (and thus displaying notes on the same page as their relevant slide), certain notes are just cut off midway through. I have tried to find overlay options that would fix this, but to no avail. I think the easiest thing to do would be to set a smaller font for those pages with a lot of note text. Using `\setbeamerfont{note page}{size=\tiny}` — as recommended here — doesn't yield the right result. Any input is appreciated!


title: Troubles in installing package

text: I'm using TeXShop (V 2.47) on my Mac (V 10.7.4) and tried to install the tabu- package but failed. Here is what I did:   1. Saved the tabu.dtx and tabu.ins file in my Donwloads-directory (source for both files)   2. Run tabu.ins in TeXShop.   3. After compilation several new files were generated in my Donwloads-directory, such as tabu.sty.   4. Run the following command in Terminal to open the directory, where I wanted to save the tabu.sty: open /usr/local/texlive/2010/ Now, the problem is, that I don't know where to copy the tabu.sty. I thought TeX Live Utility might be a tool for these kind of issues but running it (the first time) only produced a new problem: 2012-06-11 20:48:42 +0000 Notice -[TLMOperation main][11119] tlmgr: package repository http://ctan.dcc.uchile.cl/systems/texlive/tlnet The supported release as specified by the repository (2011) does not match the release version of the installation (2010), bailing out.


title: Signature below listings

text: How can I put automatic signature below my code listings. Now I put my code listings like this:               \begin{lstlisting}     MY CODE     \end{lstlisting}      Settings of listings:                   \usepackage{color}     \definecolor{bluekeywords}{rgb}{0.13,0.13,1}     \definecolor{greencomments}{rgb}{0,0.5,0}     \definecolor{redstrings}{rgb}{0.9,0,0}          \usepackage{listings}     \lstset{language=[Sharp]C,       showspaces=false,       showtabs=false,       breaklines=true,       numbers=left,       frame=single,       showstringspaces=false,       breakatwhitespace=true,       escapeinside={(*@}{@*)},       commentstyle=\color{greencomments},       keywordstyle=\color{bluekeywords},       stringstyle=\color{redstrings},       basicstyle=\ttfamily     }


title: Biblatex citation style ASM

text: Bbased on the code in configuring bibliography with biblatex and BibTeX style for the American Society for Microbiology (ASM) – chronological order, authors bold I am trying to configure the bibliography so that looks like the ASM exsample:   1. **Caserta E, Haemig HAH, Manias DA, Tomsic J, Grundy FJ, Henkin TM, Dunny GM.** 2012. _In vivo_ and _in vitro_ analyses of regulation of the pheromone-responsive prgQ promoter by the PrgX pheromone receptor protein. J. Bacteriol. 194:3386-3394. So far I was able to get the following code:               \documentclass[american, 12pt]{article}     \usepackage[latin1]{inputenc}     \usepackage{babel}     \usepackage{csquotes}     \usepackage{xpatch}     \usepackage[style=numeric,subentry,sorting=none,backend=bibtex,firstinits=true,terseinits=true,url=false,doi=false,isbn=false,maxbibnames=99]{biblatex}     \addbibresource{\jobname.bib}          \AtBeginBibliography{%        \renewcommand*{\finalnamedelim}{%        \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%        \addspace\mkbibbold{\bibstring{}}}%        \renewcommand*{\mkbibnamelast}[1]{\mkbibbold{#1}}%        \renewcommand*{\mkbibnamefirst}[1]{\mkbibbold{#1}}%        }           \DeclareFieldFormat[article]{volume}{\mkbibbold{#1}}           \DeclareNameAlias{default}{last-first}           \DeclareFieldFormat       [article,inbook,incollection,inproceedings,patent,thesis,unpublished]       {title}{{#1\isdot}}            \renewbibmacro{in:}{}           % remove the \addot if you don't want a dot before the year.      \xapptobibmacro{author}{\adddot\addspace\printfield{year}}{\typeout{successfully patched bibmacro{author} to include year}}{\typeout{failed to patch bibmacro{author} to include year}}      \xapptobibmacro{editor}{\adddot\addspace\printfield{year}}{\typeout{successfully patched bibmacro{editor} to include year}}{\typeout{failed to patch bibmacro{editor} to include year}}           \DeclareFieldFormat{date}{\scriptsize{#1}}      \DeclareFieldFormat{pages}{#1}          \AtEveryBibitem{\clearfield{month}}     \AtEveryBibitem{\clearfield{day}}          \begin{filecontents}{\jobname.bib}     @article{ho1995,     author        = {David D. Ho and Avidan U. Neumann and Alan S. Perelson and Wen Chen   and John M. Leonard and Martin Markowitz},     title         = {Rapid turnover of plasma virions and CD4 lymphocytes in HIV-1 infection},     journal       = {Nature},     volume        = {373},     number        = {6510},     page          = {123-126},     date          = {1995},     }     @article{testartlong,       author        = {Arnold Uthor and William Riter and Rita Esearcher and Steven C. Ientist and Stuart T. Udent and Peter R. Ofessor and Lewis E. C. Turer},     title         = {An Article about Articles},     journal       = {Journal of Articles},     volume        = {8},     number        = {2},     page          = {1-5},     date          = {2010},      }     @article{testart,       author        = {Arnold Uthor and William Riter},       title         = {A Very Interesting Article},       journal       = {Journal of Articles},       volume        = {7},       number        = {3},       page          = {1-5},       date          = {2010},     }     @book{testbook,       author        = {Walter Ordsmith},       editor        = {Eddie Ditor},       title         = {The Work},       subtitle      = {Subtitle},       date          = {1983},     }     @online{testonline,       author        = {Bernie Logger},       title         = {A Very Opinionated Blog Post},       url           = {http://example.com},       year          = {2013},     }     \end{filecontents}          \begin{document}       Let's cite \cite{ho1995}.       \printbibliography     \end{document}      How can I remove the bracket [1] to get 1. on the number in the biblography and how to suppress the date at the end of the reference after the pages? Thank you for your suggestions.


title: Insert pictures into whitespace in document

text: Okay, I'm not sure if this is even possible. We're currently switching the layouting of our "Basics" university intro booklet from Scribus to LaTeX. A difficulty there is minimising white space after articles. In Scribus we'd manually place comics where white space occurs, but now we'd like to automate this process. One way I was thinking about would be to place a lot of those comics somewhere in the document and tell latex to put them where there's space (in the whitespace hopefully), but I'm neither sure how to do that nor if it even works. So yeah, place pictures where whitespace was, basically it.


title: Placing TikZ drawings in a minipage side by side

text: I've some problems with aligning some drawings I made with TikZ: I want these two TikZ pictured below to be displayed side by side with the two captions being on the same horizontal level. Unfortunately, right now the caption of the second drawing appears well below the first caption because the second drawing is a bit larger. How can I add some blank space above the first drawing so that the two captions are vertically aligned?               \documentclass{article}     \usepackage{tikz}     \usepackage{caption}     \begin{document}     \begin{minipage}{0.6\textwidth}     \begin{center}     \begin{tikzpicture}     [level distance=20mm,     every node/.style={fill=blue!75,circle, draw, inner sep=2pt},     level 1/.style={sibling distance=40mm,nodes={fill=blue!60}},     level 2/.style={sibling distance=20mm,nodes={fill=blue!45}},     level 3/.style={sibling distance=10mm,nodes={fill=blue!35}}]     \node {5}           child {node {2}}           child {node {9}};     \end{tikzpicture}     \captionsetup{font=footnotesize}     \captionof{figure}{Caption 1}     \end{center}     \end{minipage}     \begin{minipage}{0.6\textwidth}     \begin{center}     \begin{tikzpicture}     [level distance=20mm,     every node/.style={fill=blue!75,circle, draw, inner sep=2pt},     level 1/.style={sibling distance=40mm,nodes={fill=blue!60}},     level 2/.style={sibling distance=20mm,nodes={fill=blue!45}},     level 3/.style={sibling distance=10mm,nodes={fill=blue!35}}]     \node {1}           child {node {5}              child {node {1}}              child[missing]           }           child {node {8}};     \end{tikzpicture}     \captionsetup{font=footnotesize}     \captionof{figure}{Caption 2}     \end{center}     \end{minipage}          \end{document}


title: PGFPlots: convert the filling of the bars

text: How can convert the filling of the bars from horizontal to vertical ?               \documentclass[border=0.5mm,12pt]{standalone}          \usepackage{pgfplots,pgfplotstable}        % Grafici          \pgfplotsset{%                 mesh line legend/.style={legend image code/.code=\meshlinelegend#1},%                 /pgf/number format/use comma,%                 compat=newest,%     %            height=9cm,%                 width=12cm%     }     \begin{document}     %\begin{figure}     \centering     \begin{tikzpicture}     \makeatletter \newcommand{\pgfplotsdrawaxis}{\pgfplots@draw@axis} \makeatother     \pgfplotsset{axis line on top/.style={      axis on top=false,      after end axis/.append code={         \pgfplotsset{axis line style=opaque,           ticklabel style=opaque,           tick style=opaque,           grid=none}         \pgfplotsdrawaxis}       }     }     \pgfdeclarehorizontalshading{stefan}{50bp}{     color(0.00000000000000bp)=(violet);     color(8.33333333333333bp)=(blue);     color(16.66666666666670bp)=(cyan);     color(25.00000000000000bp)=(green);     color(33.33333333333330bp)=(yellow);     color(41.66666666666670bp)=(orange);     color(50.00000000000000bp)=(red)     }     \begin{axis}[%     ybar,     xtick=data,     /pgf/number format/fixed,     legend pos=outer north east,     ymajorgrids=true,     %xmin=0, xmax=7,     ymin=0, ymax=14,     point meta min={0},     point meta max={14},     yticklabel shift=2pt,     xticklabel shift=2pt,     x tick label as interval,     minor ytick={0,0.4,...,14},     xticklabel style={text height=1.5ex},     xtick={0,1,...,7},     extra x ticks={0,1,...,7},     extra x tick style={         xticklabel pos=right,         xticklabel style={text depth=0pt}     },     %extra y ticks={0,2,...,12},     %extra y tick style={     %    yticklabel pos=right     %},     tick style={thin,black},     xlabel=\large Classe,     ylabel=\large Frequenza,     colorbar,     colorbar style={         /pgf/number format/fixed,         xticklabel shift=2pt,         xticklabel style={text height=1.5ex}     },     axis line style={draw=none}, after end axis/.append code={\draw (rel axis cs:0,0) rectangle (rel axis cs:1,1);},     colormap={new}{color(0cm)=(violet);color(1cm)=(blue);color(2cm)=(cyan);color(3cm)=(green);color(4cm)=(yellow);color(5cm)=(orange);color(6cm)=(red)}     ]     \addplot[%             ybar interval,             area style,             shading=stefan,     %        draw=none,             shader=interp,             samples=10,             draw=black             ] coordinates{%                  (1, 6)                  (2, 9)                  (3, 11)                  (4, 12)                  (5, 7)                  (6, 5)                  (7, 0)                  };     \end{axis}     %\end{figure}     \end{tikzpicture}     \end{document}


title: Numbering a figure with a symbol in a way that is compatible with \label and \ref

text: In a long paper, full of figures labeled as usual, there are two figures which I would like to single out and label with symbols. For instance, I would like to have them labeled `Figure $\dag$` and `Figure $\ddag$`. I would like to do this in a way that is compatible with `\label` and `\ref`, so that when I refer to `Figure $\dag$` `\label{dagfig`} with `\ref{dagfig}`, I get `$\dag$`. I would also like the figures to appear with this labeling in the list of figures. Is there some way to do this?


title: How do I add a blank line between the footnote line and the footnotes?

text: Between the footnote line and the first footnote on that page, I need to add a double-space. I've tried using the \ command, but it adds a space after the number. Does anyone know a way for me to do this?


title: Any way for pandoc to print numbered sections in plain text output?

text: Here is my LaTeX input:               \documentclass{article}     \begin{document}     \section{foo}     \section{bar}     \end{document}      I run the following command using pandoc 1.11.1:               pandoc -o test.txt -t plain -N test.tex      And here is what I get:               foo     ===          bar     ===      Is there a way to have the plain text sections and subsections numbered automatically?


title: etoolbox's iftoggle vs verbatim

text: My problem is that I can set up toggles, using etoolbox's `\newtoggle{x}`, set it to true with `\toggletrue{x}` and even use it with `iftoggle{x}{this for true}{this for false}`. However, if I try to put a `verbatim` environment inside a conditional block, it breaks and gives me an error message:               Runaway argument?      for x in range(1, 43): print('x=', x) \end {verbatim}      ./q4.tex:19: Paragraph ended before \@xverbatim was complete.     <to be read again> )     ./Quiz1.tex:90: Missing number, treated as zero.     <to be read again>                         {     l.90 \vspace{                  1 pc}      ?                         \par      l.19 }{}          ?      for the code:               \iftoggle{displaysolutions}{          \textit{The statement will execute y times.}     \begin{verbatim}     for x in range(0, y):         print('x=', x)     \end{verbatim}          }{}      Any ideas of what I'm possibly doing wrong? Any alternatives?


title: Could using different packages cause a contradiction for the compiler?

text: If I am writing a pdf with LaTeX, I would like to use commands from different packages for figures or tables or what so ever ... and I just use all the packages i need, could this lead to a contradiction or errors while compilation ? For example:               \usepackage[german]{babel}     \usepackage[english]{babel}     \usepackage[dutch]{babel}      or               \usepackage{booktabs}     \usepackage{array}     \usepackage{tabularx}      ?


title: How to track changes between PDFs?

text: I've got a modestly large document (60 pages or so), of technical documentation, in two versions (one of them improved). Unfortunately, I seem to have lost the source of the older version (but I do have the code for the most up-to-date document). > I'd like to compare the two versions of the document (in PDF format) and see > what got changed between the two, preferably in a `diff`-like format. Not a whole lot changed between the two versions, but minor details are important and could be easily overlooked. Suggestions how to to this efficiently and effectively will be deeply appreciated. Non-TeX related solutions also welcome, including non-free ones. I should mention that the documents contain exclusively text, with very few figures and tables, and modest amount of formulae. **Edit:** The documents were created with pdfLaTeX by myself, and if you think there's relevant information in the packages I used, I can provide that as well. **Edit 2** : A lot of good and promising answers! I will make an effort to try them all one of these days, and will post an update here with the result. This might make a good community wiki.


title: Find changes in pdf directly

text: I would like to track my corrections in the pdf format simply. Actually after every running I wanna avoid scroll to specified pages of changes. is there anyway to manage that?


title: What exactly is SyncTeX?

text: I stumbled upon these SyncTeX files in my directories and wanted to know what they are for. I searched this site and the internet and I think I have some vague understanding of what it is but I'm still not very satisfied with my actual knowledge. I've found many questions about configuring SyncTeX but none about what it is and what it does. So, could someone explain what is SyncTeX and what does it do exactly and/or point to some general purpose documentation?


title: What are the synctex.gz files and what they need for?

text: I think the title is self explanatory but neither here (Egad! What are all those files?) nor here (File extensions of LaTeX-related files) I found a detailed answer


title: xskak wont parse 0-0

text: Okay so I used to do a table for chess moves and import a picture from some online service to write chess stuff in LaTeX. Now I found `xskak`, and that is really a lot nicer and easier. But I can't trick `xskak` into accepting 0-0 for a move, why is that? It gives me a ZZ directly before the move in the output and my later diagram shows up without that move. Is ther some other notation for castling?


title: Table of contents doesn't get created

text: I am trying to create a table of contents, but it doesn't show up. I use the beamer documentclass. My code looks like this:               \documentclass[12pt]{beamer}     \usepackage[ngerman]{babel}     \usepackage[utf8]{inputenc}     \usepackage{amsmath, amsfonts, amssymb}          \setbeamertemplate{footline}[frame number]     \usetheme[secheader]{Boadilla}     \beamertemplatenavigationsymbolsempty     \title{...}     \author{...}     \date{\today}          \begin{document}          \begin{frame}         \titlepage     \end{frame}          \begin{frame}             \tableofcontents     \end{frame}          \section{Section1}          \begin{frame}     \end{frame}          \section{Section2}          \begin{frame}     \end{frame}          \end{document}


title: diagonal line within matrix

text: I've got simple task - draw block of matrices, when one of the matrices contains diagonal and vertical lines. I am able to make diagonal dotted lines but so far i have not succeeded with solid line. Example of my matrix follows: ![enter image description here](http://i.stack.imgur.com/fMSG5.jpg)                \begin{pmatrix}      \hat{B} &         & & & \\              & ddots & & & \\              &         & ddots & & \\              &         & &  ddots \\\hline              \\               \\            & & \text{{\huge{0}}}  & &  \\              \\      \end{pmatrix}


title: Change style of labels of Tikz nodes of a given style

text: How can all labels of a given type of node be restyled in Tikz? Imagine that there are nodes of different styles, and that only the nodes of style X should have red labels. Is this possible without having to change all labels one by one of nodes of style X?


title: Setting default image dpi using sphinx and texi2pdf

text: In QGIS project, we are using Sphinx to create our documentation as HTML and PDF. We are having a bit of a problem with figures as they show a bit blurry in PDF. I found out that the reason is because `texi2pdf` default DPI is 72. I would like to set it to something like 135dpi. I have read somewhere that I should use `\pdfimageresolution` for this; I tried to use it as:               latex_preamble = r"""\pdfimageresolution135"""      in the sphinx `conf.py` file, but with no results. Can anyone explain me if this is the right direction, or what is being done wrong?


title: The equals sign is missing

text: When I use the fonts `fourier` and `iwona` at the same time, the equals sign `=` does not appear. For example, the source               \documentclass{article}      \usepackage{fourier}     \usepackage[math]{iwona}     \begin{document}     $A=B$     \end{document}      produces               A B      **Question: How can I fix this problem?** (*) I want to use `iwona` and to replace fonts for `\mathbb` with ones of `fourier`. Remarks:   1. If I use the package `fourier` first, then `=` appears as usual. But all of the fonts are replaced by `fourier` fonts, so this is not the solution which I want.   2. The following error could relate to the problem. > LaTeX Font Warning: Font shape `OT1/iwonam/m/n' undefined (Font)   >  using`OT1/cmr/m/n' instead on input line 5. > > LaTeX Font Warning: Some font shapes were not available, defaults > substituted.   3. If I use only `iwona` then the equals sign appears.    4. If there is a way to satisfy (*), please let me know.


title: How to change the "polyu/polyubanner" in beamer with beamerthemeHongKong?

text: I am using a beamer template for presentation with beamerthemeHongKong style. Now I want to change the logo "polyu/polyubanner" coming in the pdf output. I searched for the image file but it is not there. When I used my logo it came in another frame. The code is               \documentclass{beamer}     \usepackage[compress,nonav,red, %gold,%numbers,%nologo, %polyu                ]{beamerthemeHongKong}     \usefonttheme{structuresmallcapsserif}          \begin{document}          \title{}     \author{}     \date{\today}          \frame{\titlepage}          \end{document}


title: \newcounter vs \newcount

text: What are the differences between `\newcounter` vs `\newcount`? So far as my knowledge goes `\newcounter` is from LaTeX and `\newcount` is from TeX. Also, I find that `\newcounter` has an optional automatic reset mechanism. So, if I define `\newcounter{mycounter}[section]`, `mycounter` is reset to zero every time the `section` counter is incremented. Are there any other differences between the two? Are there specific places or situations of their use? And internally, what exactly is used by `\newcounter`? Is it actually `\newcount`?


title: How do I ask LaTeX to exactly fill up a page?

text: I understand that I can control interline spacing in LaTeX in a number of ways. The commands like `\baselineskip`, `\baselinestretch`, `\linespread` come in handy in controlling the interline spacing. Each has its own speciality and circumstances of usage, as we can find in these discussions (A, B, C). If want to go for a ready made solution for controlling line spacing, packages like `setspace` come in quite handy (built-in commands like `\onehalfspacing` or `\setstretch` for more finer controls). Anyway, my problem is a bit different. I have some text (both in paragraph and list mode) which I want to fill up exactly one page. To complicate the scenario, it may even contain equations and graphics. (Let us leave aside floats.) If I want to solve the problem statically, all I will have to is to play with some value of `\baselineskip` (or `\setstretch`) until satisfied. While this works good for most of the cases, I will have to go through the process again when I want to delete or add some texts. Would it be possible to have a dynamic value for `\baselineskip` or `\setstretch` so that my text always fills up one page? (Definitely within reasonable limits.) Another idea will be to use a number of `\vfill`s between some pieces of texts. But I think that this technique is usable for cover pages only. I am not putting here an MWE. I think that one is not applicable. * * * The problem is not a theoretical one, I am preparing some kind of handout which I want to fill-up exactly one page.


title: LaTeX is confusing subsections and figures

text: So I have a section of code that looks like this               \documentclass[a4paper,12pt]{article}     \usepackage[utf8]{inputenc}     \usepackage{graphicx}     \usepackage{verbatim}     \usepackage[margin=1in]{geometry}     \usepackage{hyperref}     \usepackage{booktabs}     \usepackage{xparse}     \usepackage{tikz}     \usetikzlibrary{calc}          \begin{document}          \label{collecting_the_spectra}     \subsection{}     \label{usb}     If the screen in Figure \ref{4_specs}           \begin{figure}[htp]     \centering     \includegraphics[width=5in]{4_specs.png}     \hspace{1.5in}\parbox{5in}{\caption{All spectrometers.}}     \label{4_specs}     \end{figure}          \end{document}      and should compile if you point `4_specs.png` at an actual picture but for some reason it outputs stuff like this ![enter image description here](http://i.stack.imgur.com/bXkPD.png) Notice the spots where it says "Figure 0.1". No where else is a label made called `4_specs`. Those are the only references broken in the entire paper. Why is LaTeX doing this?


title: Texworks compiling acting non-deterministic. Difficulty adding images to document

text: I am trying to add some png graphics to a document. The figure section on its own compiles, as does the remainder of the document. Combined, it always errors out the first time but sometimes just re pasting the text and recompiling works. I am using texworks with miktex on windows 8. The error message I get is 'file ended while scanning use of \end'. Here is the complete document.               \documentclass[11pt]{article}     \textwidth=6.5in     \textheight=10in     \oddsidemargin=0in     \evensidemargin=0in     \topmargin=-0.5in     \topskip=0in     \headheight=0in     \headsep=0in     \usepackage{amsmath}     \usepackage{graphicx}     \usepackage{grffile}     \usepackage{sidecap}     \graphicspath{ {C:/Users/Ian/Dropbox/} }               \author{Ian Fiddes}     \title{BME 205 Assignment \#5: Null Models}     \date{\today}          \begin{document}     \maketitle     \section*{Introduction}      In this assignment, we utilize four null models to determine the likelihood of a open-reading frame (ORF) to be found on the opposite strand of a gene. While the programs are generalized to work for any gene and genome,     we will focus on the \textit{S. solfataricus} genome, and in particular the THSA\_SULSH gene. The impetus of this assignment is the discovery of a putative 388 codon long ORF on the opposite strand of the THSA\_SULSH gene.     Is this a real gene? What is the likelihood of a ORF of that length being found randomly in a genome? What is the best way to model this? We will move from simpler to more complicated models to try and answer this question.     \\     \\     The first model relies purely on GC content of the species' genome to determine the likelihood of an ORF of a given size. The second model relies on the species'     codon bias, as found from codon bias databases. Codon bias is the amount different codons are used in annotated ORFs for the species. Not all codons are used equally between     different species. The third model determines the probability of a ORF being found on the opposite strand of a DNA sequence generated with a weighted random using a provided     codon bias table. The fourth model determines the probability of a ORF being found on the opposite strand of a provided protein sequence by generating a representative DNA sequence based on provided     codon bias.          \section*{Model 1 - No Selection or Selection for G+C Content}     The probability of a ORF to be found in a random sequence based only on GC content can be calculated by the following equation.     \begin{equation}     P(\mbox{ORF}) = 2N*P(\mbox{ATG})*(1-P(\mbox{TAA})-P(\mbox{TAG})-P(\mbox{TGA}))^{n-1}     \end{equation}     Where N is the number of nucleotides in the genome and n is the size of the ORF in amino acids. The individual probabilities are calculated simply using the GC content. Note that N is multiplied by 2 to account for both strands of the genome.     \begin{equation}     \begin{aligned}     P(A,T) &= \frac{(1-\mbox{\%GC})}{2} \\     P(G,C) &= \frac{\mbox{\%GC}}{2}     \end{aligned}     \end{equation}     For the putative ORF found on the opposite strand of the THSA\_SULSH gene in \textit{S. solfataricus}, which is 388 codons long, $P(\mbox{ORF})$ is $7.05190*10^{-08}$.          \section*{Model 2 - Non-specific Selection}     The probability of an ORF to be found in a random sequence based on kmer counts can also be calculated directly. After counting the 3-mers present in a genome the following equation,     which is identical to equation 1. The only difference is how the individual probabilities are calculated.     \begin{equation}     \begin{aligned}     P(\mbox{ORF}) &= 2N*P(\mbox{ATG})*(1-P(\mbox{TAA})-P(\mbox{TAG})-P(\mbox{TGA}))^{n-1}      \\     P(\mbox{XXX}) &= \frac { \mbox{Count}(\mbox{XXX})}{2N}     \end{aligned}     \end{equation}     XXX is any codon.     For the putative ORF found on the opposite strand of the THSA\_SULSH gene in \textit{S. solfataricus}, which is 388 codons long, $P(\mbox{ORF})$ is $4.87122*10^{-08}$.          \section*{Model 3 - Opposite strand of a protein coding gene}     For this model, simulations must be used and the result cannot be calculated directly. To this end, I wrote a Python program to generate weighted random protein-coding ORFs and then look for the longest ORF on the opposite strand.     For this, an ORF was defined as a sequence that began with 'ATG' and contained no stop codons ('TAA','TAG','TGA') in the frame of the sequence. The random codon generation is weighted by using a codon bias table for the species.          \begin{figure}     \centering     \includegraphics[scale=0.5]{model3_lognormal_evalue.png}     \caption{Model 3 fitted to a log normal distribution. 10,000 sequences were tested.}     \end{figure}          \end{document}


title: Can one kern math font euler.otf using lualatex and fontspec?

text: I am at it again... :) Using the http://github.com/khaledhosny/euler-otf/blob/master/euler.otf font, can one kern distance between T and P with Lualatex? Clearly, my attempt does not work... Could it perhaps be that the used glyphs are not called T and P?               \documentclass{standalone}     \usepackage{filecontents}          \begin{filecontents*}{mykern.fea}     languagesystem DFLT dflt;     languagesystem latn dflt;     feature kern {         pos T P 200;     } kern;     \end{filecontents*}          \usepackage{fontspec}     \usepackage{unicode-math}     \setmathfont[math-style=upright,FeatureFile=mykern.fea]{euler.otf}          \usepackage{microtype}     \usepackage{siunitx}          \begin{document}          $TP$          \end{document}      ![enter image description here](http://i.stack.imgur.com/GuWzi.png)


title: Converting eps to png - dimensions

text: When I convert EPS to PNG using this command > gs -dSAFER -dBATCH -dNOPAUSE -r600 -sDEVICE=pnggray -sOutputFile=%1.png > "%1.eps" I get PNG picture with large dimensions, although the bounding box in EPS is correct. For example from EPS with header               %!PS-Adobe-3.0 EPSF-3.0     %%BoundingBox: 204 603 407 759     %%HiResBoundingBox: 204.242619 603.788607 406.691988 758.249977     %.................................     %%Creator: GPL Ghostscript 864 (epswrite)     %%CreationDate: 2011/12/10 21:30:18     %%DocumentData: Clean7Bit     %%LanguageLevel: 2     %%EndComments      I've obtained a 4958x7018 png. This would correspond to the whole A4 page and not to the bounding box. * * * Here's the link to png file: http://i.stack.imgur.com/i5joS.png (I did not want to put the huge monstrosity into the post) and the screenshot from gsview showing the bounding box: http://i.stack.imgur.com/BrJx3.png ; I also uploaded the EPS file to rapidshare - I am not sure what is the preferred way for sharing files here. (The file is here just for the case that the problem description is not clear enough.) * * * I usually draw my pictures in metapost, from which I easily get EPS and PDF - which are ideal for inclusion into my TeX documents. The reason I needed conversion to some different format was that I wanted to post the picture at math.SE. It is possible to upload pdf on imgur, but the result is very ugly. * * * My questions:   * Is there a way to get PNG with dimensions corresponding to bounding box?   * Any other suggestions for converting EPS to PNG using ghostscript? (Are there some more parameters I should have used?)


title: How to implement a table with multirow and multicolumn in latex

text: How can I create a table like this in latex? It is included multirow and multicolumn.![enter image description here](http://i.stack.imgur.com/BZowS.png)


title: Would you consider Luatex to be ready for a production environment

text: I'm setting up a number of document with dynamic texts. Basically LaTeX is view mechanism to dynamically present the results of ongoing statistical analysis on a database. So I have numerous `\ifnum`s and `\newif`s that are fed by Sweave with the values calculated in the R chunks of and Rnw file. And although the LaTeX if else constructs work, the LuaTex examples posted here on tex.se look so much more elegant and easier to debug that I would much prefer to go that route. Especially when I have multiple nesting I sometimes struggle to pinpoint why errors occur. I certainly do ask about advantages and disadvantages of LuaTeX and LuaLaTex itself. There are some excellent posts here discussing that already. What I do need is some arguments to propose the switch to LuaTex for some or all reports to my team. The immediate response is "LuaTex is still in beta, and will be for a while". However the authors suggest that it is stable enough: > major releases (x.x0 versions) are stable enough to be used for production > work Can you validate this with experience? Are there risks other than the possibility of having to refactor when a new version of LuaTex/LuaLaTex comes out? The documents I'm working on are relatively simple from a type setting perspective, and I'm only using standard document classes. Also, once prepared the templates are not likely to change much. I realize that there are some things I take entirely for granted with pdflatex, and my question could narrow down to whether this already applies (in your experience) to lualatex:   * Starting many pdflatex processes concurrently has never lead to any trouble.   * Once an a (Rnw --> Sweave --> tex) template works (has been tested, debugged and brought into production) I have never had too look at it again (except for some updates in R packages but that is definitely off topic here). topskip already gives me one pointer: learn the limitations of the current beta, work around it if necessary and be careful when updating. I interpret this as follows: looking at cost vs benefits it will be easier to program now and possibly (but most likely not) more costly to maintain later. Do you have more experiences you could share along that train of thought? **UPDATE** _- moved my notes on making the switch from pdflatex to lualatex to an answer below. It was getting too long to remain in the question_


title: Draw a 2-D representation of a protein with cpssp LaTeX

text: I have a MacBookAir and I want to draw a two-dimensional representation of a protein's secondary structure with `cpssp` in LaTeX. I have installed `cpssp` and MacTeX. I also created my `~/Library/texmf/tex/latex/cpssp`. Next I have run the Python script which I called from my terminal like               python cpssp.py -s seq.fasta -u ss.fasta -w 14 -i 1.5 -t 20 -o test      I get the `test.tex` file but I don't know how to use LaTeX to convert those coordinates into the actual image. I have read how to create a basic LaTeX and it works but when I try with the package `cpssp` it does not work. Can someone help me PLEASE. Any tip, advise or something will be appreciated. TeX file:               \cpsspLabel{-0.0}{pf_0111000}             \cpsspStartRes{-0.0}{1.5}{1}             \cpsspBend{-0.0}{1.5}{2.0}             \cpsspPiHelix{-0.0}{2.0}{2.25}             \cpsspSheet{-0.0}{2.25}{2.5}             \cpsspCoil{-0.0}{2.5}{3.75}             \cpsspSheet{-0.0}{3.75}{5.5}             \cpsspCoil{-0.0}{5.5}{6.75}             \cpsspAlphaHelix{-0.0}{6.75}{7.75}             \cpsspCoil{-0.0}{7.75}{8.75}             \cpsspSheet{-0.0}{8.75}{10.25}             \cpsspCoil{-0.0}{10.25}{10.75}             \cpsspSheet{-0.0}{10.75}{12.25}             \cpsspCoil{-0.0}{12.25}{14.0}             \cpsspEndRes{-0.0}{14.0}{50}         \cpsspLabel{-1.5}{pf_0111000}             \cpsspStartRes{-1.5}{1.5}{51}             \cpsspAlphaHelix{-1.5}{1.5}{2.75}             \cpsspCoil{-1.5}{2.75}{4.25}             \cpsspSheet{-1.5}{4.25}{5.0}             \cpsspCoil{-1.5}{5.0}{5.5}             \cpsspSheet{-1.5}{5.5}{6.0}             \cpsspCoil{-1.5}{6.0}{7.5}             \cpsspAlphaHelix{-1.5}{7.5}{11.75}             \cpsspCoil{-1.5}{11.75}{12.75}             \cpsspSheetT{-1.5}{12.75}{14.0}             \cpsspEndRes{-1.5}{14.0}{100}         \cpsspLabel{-3.0}{pf_0111000}             \cpsspStartRes{-3.0}{1.5}{101}             \cpsspSheet{-3.0}{1.5}{1.75}             \cpsspCoil{-3.0}{1.75}{3.75}             \cpsspSheet{-3.0}{3.75}{4.5}             \cpsspCoil{-3.0}{4.5}{6.5}             \cpsspAlphaHelix{-3.0}{6.5}{10.25}             \cpsspCoil{-3.0}{10.25}{11.5}             \cpsspSheetT{-3.0}{11.5}{14.0}             \cpsspEndRes{-3.0}{14.0}{150}         \cpsspLabel{-4.5}{pf_0111000}             \cpsspStartRes{-4.5}{1.5}{151}             \cpsspSheet{-4.5}{1.5}{2.0}             \cpsspCoil{-4.5}{2.0}{5.75}             \cpsspSheet{-4.5}{5.75}{6.75}             \cpsspCoil{-4.5}{6.75}{8.0}             \cpsspSheet{-4.5}{8.0}{8.75}             \cpsspCoil{-4.5}{8.75}{9.75}             \cpsspSheet{-4.5}{9.75}{10.5}             \cpsspCoil{-4.5}{10.5}{11.25}             \cpsspAlphaHelix{-4.5}{11.25}{14.0}             \cpsspEndRes{-4.5}{14.0}{200}         \cpsspLabel{-6.0}{pf_0111000}             \cpsspStartRes{-6.0}{1.5}{201}             \cpsspAlphaHelix{-6.0}{1.5}{1.75}             \cpsspCoil{-6.0}{1.75}{6.0}             \cpsspSheet{-6.0}{6.0}{9.0}             \cpsspCoil{-6.0}{9.0}{10.5}             \cpsspSheet{-6.0}{10.5}{13.5}             \cpsspCoil{-6.0}{13.5}{14.0}             \cpsspEndRes{-6.0}{14.0}{250}         \cpsspLabel{-7.5}{pf_0111000}             \cpsspStartRes{-7.5}{1.5}{251}             \cpsspCoil{-7.5}{1.5}{6.0}             \cpsspEndRes{-7.5}{6.0}{268}


title: Function graphs

text: Can you help me with my page of function graphs? I could make the first four graphs but there is a problem with plotting by others. All graphs should have the same size like the first four ones. Thank you!               \documentclass{article}     \usepackage{pgfplots}     \usepackage{subfigure}     \usepackage{tikz}     \usetikzlibrary{shapes.geometric,calc,arrows,decorations.markings,decorations.pathmorphing}     \newcommand{\tg}{\mathop{\mathrm{tg}}}     \newcommand{\cotg}{\mathop{\mathrm{cotg}}}     \newcommand{\arctg}{\mathop{\mathrm{arctg}}}     \newcommand{\arccotg}{\mathop{\mathrm{arccotg}}}     \begin{document}     \begin{figure}[H]      \centering       \subfigure     {     \begin{tikzpicture}[smooth,scale=0.8]             \draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};             \draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};             \draw[blue,thick,domain=-1.5:1.5] plot (\x,{1}) node[above] {$y=c$};      \end{tikzpicture}     }     %     {         \begin{tikzpicture}[smooth,scale=0.8]             \draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};             \draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};             \draw[blue,thick,domain=-1.5:1.5] plot (\x,{\x}) node[above] {$y=x$};       \end{tikzpicture}     }     %     \subfigure     {       \begin{tikzpicture}[smooth,scale=0.8]             \draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};             \draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};             \draw[blue,thick,domain=-1.5:1.5] plot (\x,{\x*\x}) node[above] {$y=x^2$};       \end{tikzpicture}     }     %     \subfigure     {       \begin{tikzpicture}[smooth,scale=0.8]            \draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};             \draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};             \draw[blue,thick,domain=-1.15:1.15] plot (\x,{\x*\x*\x}) node[above]     {$y=x^3$};       \end{tikzpicture}     }     %     \subfigure     {       \begin{tikzpicture}[smooth,scale=0.8]             \draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};             \draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};             \draw[blue,thick,domain=-1.5:1.5] plot (\x,{\x}) node[above] {$y=\frac{1}{x}$};       \end{tikzpicture}     }     %     \subfigure     {       \begin{tikzpicture}[smooth,scale=0.8]             \draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};             \draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};             \draw[blue,thick,domain=-1.5:1.5] plot (\x,{\x}) node[above]     {$y=\sqrt{x}$};       \end{tikzpicture}     }     %     \subfigure     {       \begin{tikzpicture}[smooth,scale=0.8]             \draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};             \draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};             \draw[blue,thick,domain=-1.5:1.5] plot (\x,{\x}) node[above] {$y=e^x$};       \end{tikzpicture}     }     %     \subfigure     {       \begin{tikzpicture}[smooth,scale=0.8]             \draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};                 \draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};             \draw[blue,thick,domain=-1.5:1.5] plot (\x,{\x}) node[above] {$y=\ln{x}$};       \end{tikzpicture}     }     %     \subfigure     {       \begin{tikzpicture}[smooth,scale=0.8]             \draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};             \draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};             \draw[blue,thick,domain=-1.5:1.5] plot (\x,{\x}) node[above] {$y=\sin(x)$};       \end{tikzpicture}     }     %     \subfigure     {       \begin{tikzpicture}[smooth,scale=0.8]             \draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};             \draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};             \draw[blue,thick,domain=-1.5:1.5] plot (\x,{\x}) node[above] {$y=\cos(x)$};       \end{tikzpicture}     }     %     \subfigure     {       \begin{tikzpicture}[smooth,scale=0.8]             \draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};             \draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};             \draw[blue,thick,domain=-1.5:1.5] plot (\x,{\x}) node[above] {$y=\tg(x)$};       \end{tikzpicture}     }     %     \subfigure     {       \begin{tikzpicture}[smooth,scale=0.8]             \draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};             \draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};             \draw[blue,thick,domain=-1.5:1.5] plot (\x,{\x}) node[above]    {$y=\cotg(x)$};       \end{tikzpicture}     }     %     \subfigure     {       \begin{tikzpicture}[smooth,scale=0.8]             \draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};            \draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};             \draw[blue,thick,domain=-1.5:1.5] plot (\x,{\x}) node[above]    {$y=\arcsin(x)$};       \end{tikzpicture}     }     %     \subfigure     {       \begin{tikzpicture}[smooth,scale=0.8]             \draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};             \draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};             \draw[blue,thick,domain=-1.5:1.5] plot (\x,{\x}) node[above]    {$y=\arccos(x)$};       \end{tikzpicture}     }     %     \subfigure     {       \begin{tikzpicture}[smooth,scale=0.8]             \draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};             \draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};             \draw[blue,thick,domain=-1.5:1.5] plot (\x,{\x}) node[above]    {$y=\arctg(x)$};       \end{tikzpicture}     }     %     \subfigure     {       \begin{tikzpicture}[smooth,scale=0.8]             \draw[thick,->] (-2,0) -- (2,0) node[below] {$x$};             \draw[thick,->] (0,-1.5) -- (0,1.5) node[right] {$y$};             \draw[blue,thick,domain=-1.5:1.5] plot (\x,{\x}) node[above]    {$y=\arccotg(x)$};       \end{tikzpicture}     }     \end{figure}     \end{document}      ![graphs](http://i.stack.imgur.com/9zDsY.jpg)


title: How to draw Venn diagrams (especially: complements) in LaTeX

text: What I am up to is to write some exercises dealing with logical formulas for my students, like: ![A \\cup B](http://i.stack.imgur.com/8Irn9.gif) And the students should draw these formulas on Venn diagrams. At the end of the lesson, I really would like to print the correct answer for them. I found a great resource on a forum thread at latex-community.org, which helped me a lot to make up some Venn diagrams with tikz, but have some problems with visualizing complements, like ~A. A simple, modified version of the TeX file found on the forum linked above, can be seen below, which produces the following expression: ![enter image description here](http://i.stack.imgur.com/4kH61.gif)               \documentclass{letter}       \usepackage{tikz}       \def\firstcircle{(90:1.75cm) circle (2.5cm)}       \def\secondcircle{(210:1.75cm) circle (2.5cm)}       \def\thirdcircle{(330:1.75cm) circle (2.5cm)}       \begin{document}         \begin{tikzpicture}           \begin{scope}         \clip \secondcircle;         \fill[cyan] \thirdcircle;           \end{scope}           \begin{scope}         \clip \firstcircle;         \fill[cyan] \thirdcircle;           \end{scope}           \draw \firstcircle node[text=black,above] {$A$};           \draw \secondcircle node [text=black,below left] {$B$};           \draw \thirdcircle node [text=black,below right] {$C$};         \end{tikzpicture}       \end{document}      Which looks like: ![enter image description here](http://i.stack.imgur.com/308dn.png) Could anyone please help me out plotting/defining some expressions dealing with complements? A nice example could be: ![$\\overline{A \\cap B}$](http://i.stack.imgur.com/V2E3l.gif) That should look like: (image from Wikipedia) ![enter image description here](http://i.stack.imgur.com/gYFf5.png) I do not insist on the red color :) I would like to use the simplest possible solution, as I would like to mass generate the exercises with the help of R. So any suggestion dealing with gnuplot, R or any other opensource packages is welcome. Thank you! * * * **UPDATE (25/01/2011):** added details based on answers. Thank you @Leo Liu, you helped me a lot! I modified a bit the code you suggested to be able to color the area outside of the two circles also (in the _H_ universe), but have no idea how to set a background to that polygon also. The code:               \begin{tikzpicture}[fill=gray]     % left hand     \scope     \clip (-2,-2) rectangle (2,2)           (1,0) circle (1);     \fill (0,0) circle (1);     \endscope     % right hand     \scope     \clip (-2,-2) rectangle (2,2)           (0,0) circle (1);     \fill (1,0) circle (1);     \endscope     % outline     \draw (0,0) circle (1) (0,1)  node [text=black,above] {$A$}           (1,0) circle (1) (1,1)  node [text=black,above] {$B$}           (-2,-2) rectangle (3,2) node [text=black,above] {$H$};     \end{tikzpicture}      And the image generated: ![enter image description here](http://i.stack.imgur.com/9P4l7.png) I will also look for `even odd rule` in the near future which does not make sense for me at the moment but looks really simple and promising!


title: Remove line from Header

text: I am using               \usepackage{fancyhdr}     \pagestyle{fancy}     ........     \lhead{My Name}      This setup creates header with a horizontal line.   1. How can I remove line appearing in header?   2. When I convert this document to pdf it creates one inch extra space in my header. This space does not show up in dvi display or in postscript file. But does show up in pdf. How can I remove extra space in pdf?               \documentclass[10pt, twocolumn]{article}          \usepackage {amsfonts}     \usepackage{mathtools, fancyhdr}     \usepackage{IEEEtrantools}          \pagestyle{fancy}     \addtolength{\evensidemargin}{-1cm}     \addtolength{\oddsidemargin}{-1cm}     \setlength{\parindent}{0in}     \setlength{\parskip}{6pt}          \renewcommand{\headrulewidth}{0pt}           \usepackage[margin=0.7in, headsep=4pt]{geometry}           \begin{document}     \chead{My Name, Date...... }          \begin{IEEEeqnarray*}{lcr}     e^{-at} \hspace{1cm} \sin bt & \frac{b}{(s+a)^2+b^2} \hspace{1cm} & s>-a\\     \end{IEEEeqnarray*}     \end{document}


title: Problem with \textbf and \textsc using mathdesign

text: As soon as I use the package `mathdesign` the commands `\textbf` and `\textsc` won't work for Sans Serif and Typewriter fonts. My MWE looks as follows:               \documentclass{article}     \usepackage[utf8]{inputenc}     \usepackage[T1]{fontenc}     \usepackage[ngerman]{babel}          \renewcommand{\rmdefault}{ugm} % URW Garamond     \renewcommand{\sfdefault}{uop} % URW Classico (Optima)     \usepackage{luximono}     \usepackage[garamond]{mathdesign}          \begin{document}          \noindent     \normalfont RM-Family: Standard, emph, textbf, textit, textsl, texttt, textsc\\     \rmfamily Text, \emph{Text}, \textbf{Text}, \textit{Text}, \textsl{Text}, \texttt{Text}, "`Not available"'\\          \noindent     \normalfont SF-Family: Standard, emph, textbf, textit, textsl, texttt, textsc\\     \sffamily Text, \emph{Text}, \textbf{Text}, \textit{Text}, \textsl{Text}, \texttt{Text}, \textsc{Text}\\          \noindent     \normalfont TT-Family: Standard, emph, textbf, textit, textsl, texttt, textsc\\     \ttfamily Text, \emph{Text}, \textbf{Text}, \textit{Text}, \textsl{Text}, \texttt{Text}, "`Not available"'          \end{document}      It leads to 3 Warnings which are all similar to this one:               LaTeX Font Warning: Font shape `T1/uop/mb/n' undefined     (Font)              using `T1/uop/m/n' instead on input line 19.      My output looks like this (I marked the spots responsible for the warnings): ![Example with problems](http://i.stack.imgur.com/W3Zzw.png) If I use `{\fontseries{b}\selectfont Text}` instead of `\textbf{Text}` and `{\fontshape{sc}\selectfont Text}` instead of `\textsc{Text}`, everything works fine, I don't get any warning and my result looks like this: ![Example without problems](http://i.stack.imgur.com/O6Udr.png) Not changing the fonts in preamble for Sans Serif family and Typewriter (using the standard defined by the documentclass) won't solve the problem. Has anyone an idea how to fix this? I'm working in the following environment: Miktex 2.9 (64-bit); mathdesign 2.31; Roman-font: URW Garamond; Sans Serif- font: URW Classico; Typewriter-font: LuxiMono.


title: Comma delimited list - how to obtain the length?

text: It's simple. I have a list like `{0,1,54,1,3}` as input argument to a command in making. How can I obtain the length of this list? Something like               \length(#1)      where `#1` is the list.


title: How to output Bibliography on separate page in 2-column layout (LyX)

text: I'm using LyX with the default document class & settings, except with 2-column layout. How do I get the Bibliography to output on a separate page? I tried inserting a New Page, but that just bumps it up to the top of the next column. Thanks!


title: Xparse macro with optional parameter breaks value for PGF foreach

text: I write a document class and want to execute something a certain number of times, depending on a user-defined quantity. So I thought I'd use a `foreach` loop from PGF together with accessor macros:               \documentclass{scrartcl}     \usepackage[utf8]{inputenc}     \usepackage[T1]{fontenc}          \usepackage{xparse,etoolbox,pgffor}          \makeatletter     \csdef{my@test}{3}          \DeclareDocumentCommand{\val}{m g}{%       \csname #1@#2\endcsname%     }     \makeatother          \begin{document}       Testing direct: \csname my@test\endcsname            Testing macro: \val{my}{test}            \foreach \i in {1,...,\csname my@test\endcsname}{a}            \foreach \i in {1,...,\val{my}{test}}{a}     \end{document}      Unfortunately, using `val` breaks `foreach`: ![enter image description here](http://i.stack.imgur.com/OsoSJ.png) with error message `Illegal unit of measure (pt inserted)` (several times). Funny: if I use parameter specification `{m m}` instead of `{m g}`, the problem goes away. It is feasible to not use the macro inside the class definition -- I do need the optional parameter, though -- but what is going on here? ### Background Users can create a list of `X`s by using a macro of the form               \addX{group}{name}{key1=val1,key2=val2,..}       This macro is implemented with `xparse` and `keyval`. It stores the information in macros of the form `\X@group@name@key`. In order to hide this from users, I provide accessor macros like `val` above. There are also macros and environments that utilise the created list directly, one of which would contain a loop as defined above, repeating stuff (for every `X`) depending on user-provided values. The last parameter of `val` is to be optional so that a default value can be returned if the user provides no key (which would be the value I suppose will be requested most often).


title: Updating a variable

text: I define a variable using `\def\x{0}`. How can I update this variable by adding 1? `\def\x{\x+1}` doesnt work (it just gets stuck in an infinite loop) Or can I define variables in some other way that can do this?


title: Align successive equations through the entire document

text: I am fairly new to TeX and need to create my math assignment with TeX. I have succeeded aligning all my calculations with the use of `\begin{align*}` and `\intertext{}`, however in my document i have sections and subsections and if I `\end{align*}` and begin after the sections or subsections the alignment is off. I have gone through google but all I can find is about `\begin{equation}` and has no mentioning of sections nor graphics. How do I (if it is possible) make the alignment through the entire document? Example:               \section{Opgave 1}          \subsection{a) Beregn arealet, der begrænses af kurven for $f(x) = x^{3}$, x-aksen og     linjerne $x = -1$ og $x = 1$.}     \begin{align*} % This     \intertext{Først beregnes det bestemte integrale imellem $x = 0$ og $x = 1$:}     \int_0^1 x^{3}\ dx &= 0.25\\     \intertext{Da den er symetrisk omkring 0 kan vi tage det dobbelte areal:}     0.25 \cdot 2 &= 0.50\\     \end{align*}          \begin{center}     \includegraphics[width=100mm]{opg1graph.png}\\     Opg. 1, a)     \end{center}          \pagebreak          \subsection{b) Bestem arealet af den lukkede figur, der dannes af parablen med regneforskriften $f(x) = -x^2 + 2x + 1$ og den rette linje med regneforskriften $g(x) = -0,5x + 1$}     \begin{align*} % Is not aligned with this     \intertext{Først findes de punkter hvor $g(x)$ afgrænser $f(x)$:}     f(x) &= g(x) \\     -x^2 + 2\cdot x + 1 &= -0.5\cdot x + 1 \\     solve(-x^2 + 2\cdot x + 1 &= -0.5\cdot x + 1,x) \\     x &= 0\\     x &= 2.5\\     \intertext{Så tager vi det bestemte integrale imellem $x = 0$ og $x = 2.5$:}     \int_0^{2.5} -x^2 + 2x + 1\ dx &= 3.54167     \pagebreak     \intertext{Og det bestemte integrale for $g(x)$, for at fjerne arealet under linjen:}     \int_0^{2.5} -0.5\cdot x + 1 dx &= 0.9375     \intertext{Nu trækkes arealet under linjen fra:}     3.54167 - 0.9375 &= 2.60417\\     \end{align*}


title: What makes clipping with starred graphics object and its dual produce different result?

text: Based on the following taken from `pstricks.tex`,               \def\solid@star{%       \if@star         \pslinewidth=\z@         \psdoublelinefalse         \def\pslinestyle{none}%         \def\psk@fillstyle{\psfs@solid}%         \let\psfillcolor\pslinecolor       \fi}      starred object               \xxx*[linecolor=<color>]      is similar to               \xxx[fillstyle=solid,fillcolor=<color>,linestyle=none,linewidth=0]      However, this similarity is no longer held when we use them as the clipping path. In the following example, a red solid rectangle will be clipped by a circle. The first clipping uses the starred version `\pscircle*[linecolor=blue]` and produces a blue circle. But the second clipping uses its dual `\pscircle[fillstyle=solid,fillcolor=blue,linestyle=none,linewidth=0]` and produces a red circle. So the second clipping produces the expected result. ![enter image description here](http://i.stack.imgur.com/i2zQG.png)               \documentclass[border=12pt]{standalone}     \usepackage{pstricks}          \begin{document}          \begin{pspicture}[showgrid=top](4,4)         \psclip{\pscircle*[linecolor=blue](2,2){1}}             \psframe*[linecolor=red](4,4)         \endpsclip     \end{pspicture}     \qquad     \begin{pspicture}[showgrid=top](4,4)         \psclip{\pscircle[fillstyle=solid,fillcolor=blue,linestyle=none,linewidth=0](2,2){1}}             \psframe*[linecolor=red](4,4)         \endpsclip     \end{pspicture}          \end{document}      What makes this difference?


title: Space before chapters and contents

text: I am using LaTeX to write my dissertation, and I have realised that on the table of contents and on every chapter page, LaTeX leaves a lot of empty space. What I mean is that lets say in the page where chapter 1 begins, from the top of the page until the chapter title there is much more vertical space than on any other page. The same goes with chapter 2 etc... and for contents page as well. Can anybody help me to remove that space? Is there any mistake in my code or something like that? Is this a default of LaTeX? the preamble is               \documentclass[12pt,twoside]{report}     \pagestyle{plain}     \usepackage{a4paper}     \usepackage{setspace}     \doublespacing      \usepackage{amssymb}     \usepackage{amsmath}       I've tried the methods below, but none of them work properly.


title: Title of chapter wanted nearer to the top of the page

text: > **Possible Duplicate:**   >  Space before chapters and contents Is there any way of getting the title of the chapter closer to the top of the page than the default when using `\chapter{blahblah}`? I have a table I need to put into my appendix, but it is too big to fit on a whole page with the title of the chapter being where it is. I'm new to LaTeX, so please try and be as simplistic as possible (if there is a solution that it)


title: How do I change the margin under chapter?

text: I am using the `scrreprt` class and the margin between `\chapter` and the text is too big. I tried to change it with `\titlespace` but later found out that titlespace does not work for chapters. Is there an easy way to change this margin?


title: Changing the top margin in LaTeX for chapter name

text: When a new chapter starts I want to decrease the margin between the top of the page and where it says Chapter X. So I have something like Chapter X Chapter Title and I want to decrease the space between the beginning of the page and Chapter X


title: \parencite in footnote: where to put the full stop?

text: _I am not entirely sure, if this question fits the agenda of this site. I you feel that it does not, please accept my apologies._ Just a brief question: If I have a footnote with a quote, then reference the quote by `\parencite`. I am always uncertain, wheher I should place the full sopt after the `\parencite`or before it.   1. Cf. this wonderful quotation: "Wonderful quotation" (Author, Title, p.12).   2. Cf. this wonderful quotation: "Wonderful quotation." (Author, Title, p.12) `1\. \footnote{Cf. this wonderful quotation: \textquote{Wonderful quotation} \parencite[12]{key}.}` `2\. \footnote{Cf. this wonderful quotation: \textquote{Wonderful quotation}. \parencite[12]{key}}` I recall having been told, that you should _always_ end a footnote with a full stop. But with parentheses, it looks odd to me. I tried to look in my Oxford Style Manual, but couldn't find an advise. Anyway, I am open for advise that is not from the Oxford Style Manual.


title: Could not use patgen

text: All I see on my console is "Bad Representation" for even the .TRA file example of the patgen2 manual itself. What should I do?


title: Long LaTeX file causes a strange error

text: I have a long LaTeX article (1000 lines, single file) which also has a lot of figures and a few tables.               \documentclass[english]{egpubl}      %http://www.eg.org/index.php/docs/eg-tutorials/doc_download/14-egpublstyle-cgf The article compiles with a few warnings. However if I uncomment any of the lines in a paragraph near the end of file, I get an error:               ! File ended while scanning use of \@writefile     Miktek 2.8 gave \end{document} as location     Miktek 2.9 gives \begin{document} as location      The error appears on 3rd build pass (not on the first 2 after cleaning project). The PDF file seems to be generated normally. However this error makes me nervous. The offending paragraph:               To check segmentation expertize of the primary author,     %one dataset (F02) was manually segmented both by the primary author     and a neurosurgeon (the second author).     %Dice coefficient is 91\%, which is on par     %with segmentation correlations between neurosurgeons~\cite{ExpertDSCs} (86-96\% DSC).      I am using TeXnicCenter on Win7 x64 with 32-bit MiKTeX. Should I just ignore this error, or is there a way to fix it?


title: How to avoid a page break before a two-column TOC in memoir

text: Although `I wouldn't normally do this', I'm writing a short(ish) document for which I'd like to place a small TOC in two columns as the last thing on the title page. In single column mode it works fine. However, when I specify `\twocoltocetc`, I get a new page. Here's an MWE:               \documentclass[10pt,a4paper]{memoir}     \twocoltocetc     \begin{document}     \frontmatter     \title{Something or other}     \author{H.I.M. Self}     \maketitle     \tableofcontents*     \mainmatter     \chapter{Introduction}     \chapter{First chapter}     \section{First section}     \end{document}      What, if anything, must I do to fix this?