title: Code in \lstlisting breaks document (compile error)

text: I want to show a JSON object in my document. If I do the following, it works:               \begin{lstlisting}     {       "id": "5",       "key": "discardedCard"     }     \end{lstlisting}      But if I extend the code to the following, then there are only errors when compiling the document:               \begin{lstlisting}     {       "id": "5",       "key": "discardedCard",       "value": {         "suit": "DIAMONDS",         "rank": "QUEEN"       }     }     \end{lstlisting}      **Error log:**               ! Incomplete \iffalse; all text was ignored after line 19.     <inserted text>                      \fi      l.19     "               suit": "DIAMONDS",     A forbidden control sequence occurred in skipped text.     This kind of error happens when you say `\if...' and forget     the matching `\fi'. I've inserted a `\fi'; this might work.          ! Incomplete \iffalse; all text was ignored after line 19.      I'd like to provide a MWE but if I run the code in a MWE then it works. So it looks like there are other parts in my bachelor thesis which break the document. Is there a way to output code in a listing in a secure way or maybe escaped?


title: Aberrant footnote numbering behavior with footnoted captions

text: I don't have an explanation for the behavior shown by the following two MWEs. Clearly, the footnote number is altered by the length of text in the caption. Please advise me as to why this strange behavior is occurring and how to avoid it? MWE1: ![enter image description here](http://i.stack.imgur.com/uoSr3.png) MWE2: ![enter image description here](http://i.stack.imgur.com/TS8nK.png) MWE1 code:               \documentclass{article}     \usepackage[hmargin=2in,vmargin=5in]{geometry}     \begin{document}     \begin{figure}     \label{fig:temp}     \caption[Caption for LOF]{Caption\footnotemark. Some more text added here changes the footnote number in a length-dependent manner.}     \end{figure}     \footnotetext{Footnote text.}     \end{document}      MWE2 code:               \documentclass{article}     \usepackage[hmargin=2in,vmargin=5in]{geometry}     \begin{document}     \begin{figure}     \label{fig:temp}     \caption[Caption for LOF]{Caption\footnotemark. Less text rectifies the foonote number.}     \end{figure}     \footnotetext{Footnote text.}     \end{document}      * * * Edit. In response to a comment, I provide a demonstration that the aberrant numbering can occur even if the caption is but a single line. MWE3: ![enter image description here](http://i.stack.imgur.com/MoLEt.png) MWE3 code:               \documentclass{article}     \usepackage[hmargin=1.9in,vmargin=5in]{geometry}     \begin{document}     \begin{figure}     \label{fig:temp}     \caption[Caption for LOF]{Caption\footnotemark. Some more text added here changes the footnote number.}     \end{figure}     \footnotetext{Footnote text.}     \end{document}


title: Kile will not work on Ubuntu (utf8x.def)

text: I just installed Kile on Ubuntu and I can't get it to work. Even just starting with one of the templates I continue to get the error: > >     [PDFLaTeX]finished with exit code 1 >     /usr/share/texmf-texlive/tex/latex/base/input.sty:131:File 'utf8x.def > not found.\endinput >   I have spent quite a while trying to figure this out...


It appears when I try to build file in MiKTeX 2.9 I get               LaTeX Error: File 'baposter.cls' not found     Type X to quit or <RETURN> to proceed,     or enter new name.(Default extension:cls))     Enter file name:


title: Subfigure labelling for a single figure

text: I have a single figure containing two plots. The two plots are already labelled within the figure using (a), (b). ![My single figure](http://i.stack.imgur.com/1oZsv.jpg) So far I have been referencing the figures using the `cleveref` package as               \cref{fig:img1}(a)      However the `(a)` is not part of the reference link. My attempt at a work around is to use the `subfigure` environment               \documentclass{article}     %\usepackage{jheppub}     \usepackage{subcaption}     \usepackage{cleveref}     \usepackage{graphicx}          \begin{document}          \begin{figure}         \centering         \begin{subfigure}[t]{0.47\textwidth} % contains the two plots in a single figure             \includegraphics[width=\textwidth]{./img.pdf}             \caption{}             \label{fig:imga}         \end{subfigure}         \begin{subfigure}[t]{0\textwidth} % the hidden unwanted image              \includegraphics[width=\textwidth]{./img.pdf}              \caption{}              \label{fig:imgb}            \end{subfigure}     \caption{Main caption here}     \label{fig:main}     \end{figure}          \end{document}      So now when I reference `\cref{fig:imga}` it returns figure 1a etc. The only problem other than the spacing between the figure and the caption is that I have the figure label `(a)` under the first figure and a floating `(b)` under the second unwanted image. Using `\caption*{}` results in the labels not being counted, so the references just return the section number. Ideally I would like to hide these labels, but not disable them as I want to use them in the references. EDIT. Using `\phantomcaption` in place of the two subfigure `\caption{}`'s has worked perfectly.


title: LaTeX --> (X)HTML with tex4ht: bad quality images of equations

text: I'm using `tex4ht` to produce XHTML files from a LaTeX file. The XHTML file I obtain uses images for some equations which `tex4ht` could not convert directly to XHTML. **Problem:** images of equations have very bad quality. **What I want:** Better quality images. **More info on attempts & system:** I'm using MikTeX 2.9 under Windows Vista. I go to the command line and type `htlatex document.tex "xhtml"` to get the resulting XHMTL file. After doing some search on the web, I tried to change the file `tex4ht.env` as mentioned in here (changing `-density 110x100` to `-density 220x220 -geometry 50%`) in all locations I could find in my system (within the MikTeX path and also in the `AppData` windows directory) but the results are the same. I obtain during the compilation of `hlatex` the following line (among others): > System call: mgs -sDEVICE=pngalpha -sOutputFile=Untitled11x.png -r110x110 > -dEPSC rop -dBackgroundColor=16#ffffff -dTextAlphaBits=2 > -dGraphicsAlphaBits=2 -q -dbat ch -dNOPAUSE zzUntitled1.ps -c quit In particular, I would guess that the `-r110x110` means resolution was still set to 110x110, despite my changes to the file `tex4ht.env`. Any suggestions on how to improve the quality of equations images?


title: Why compilation with a lot of \lstinputlisting is so slow?

text: I'm using a lot of `\lstinputlisting` in my document and the compilation of it is really slow. Why it takes so long? How could I make things better?


title: Beamer: Warsaw style biliography colors

text: In _Beamer_ , I am using _Warsaw_ style. In bibliography, I use `\newblock` for different type of entries (author, title, journal, ect.). Where can I learn the _colour_ information about these structures (in which file, at which line)? For instance, when I mention an author's name in text, I want to colour the name with the same colour as it appears in the _bibliography_.


title: enumitem itemize environment shifts text into margin, or overlaps other text

text: I am in the process of transitioning from using the older {paralist} package to the {enumitem} package and this question on Suggestions for transitioning from paralist to enumitem package suggested to use the `align=left` option. However, this is results in text overlapping. If I remove the setting, then the default `{enumitem}` package results in text being overwritten. Not sure how to fix this...               \documentclass{article}          \usepackage{paralist}     \usepackage[shortlabels]{enumitem}     %\setlist{align=left}          \usepackage{geometry}     \geometry{showframe}          \usepackage{amsmath}          \begin{document}          \begin{itemize}[\textbf{Given:}]         \item $f(x) = \sqrt{x}$                $g(x) = \sqrt[3]{1 - x}$     \end{itemize}          \end{document}      This produces correct results with {parlist} package. Using the defaults of {enumitem}, shifts text into margin (with TeXLive2012 as of Oct 27, 2012): ![enter image description here](http://i.stack.imgur.com/e1svW.png) and with the `align=left`, the text overlaps. Or is there a better way for me to achieve the results that `{paralist}` produces.


title: With PGFPlots: How to manually enter ticks as fractions?

text: We can **display** tick labels as fractions by setting: `xticklabel style={/pgf/number format/frac}` However, _how can we manually enter the tick points as fractions?_ Just using `xtick={0,2/3,1}` does not work see, the MWE below.                \documentclass{article}      \usepackage{pgfplots}      \pgfplotsset{width=9cm,compat=1.5}      \begin{document}      \begin{tikzpicture}      \begin{axis}[      xticklabel style={/pgf/number format/frac},      domain=0:1,      samples=9,      xtick={0,2/3,1} ]      \addplot { x };      \end{axis}      \end{tikzpicture}      \end{document}


title: How can I create a counter so that it will enumerate a list I define

text: I am using a counter, like so:               \newcounter{sectionnumber}     \setcounter{sectionnumber}{0}     \newcounter{courseday}     \newcommand{\nextsection}{HW/Quiz \stepcounter{sectionnumber}\arabic{sectionnumber}}     \newcommand{\samesection}{Section  \arabic{sectionnumber}}      to propagate section numbers in my course calendar. However, textbook sections are numbered. 1.1, 1.2, 1.3, 2.1, 2.4, ect. Worse, I may want to cover them out of order and maybe throw an appendix in there. How can I define a list of sections and then have a counter enumerate this list in order?


title: pgfgantt: Can't get the examples work correctly

text: I need to make some Gantt Diagrams for a budget, and found on the web the pgfgantt package, which looks amazing. Unfortunately I can't make it work correctly with the examples of its documentation. I'm trying this example, compiling it with this version pdflatex and getting this log. This is a screenshoot of the generated PDF: ![obtained pdf](http://i.stack.imgur.com/J6ygy.png) And one of the expected result from the docs: ![expected pdf](http://i.stack.imgur.com/0A3nW.png) I'm pretty new to latex, and sincerely have no idea what is going wrong. Any help would be MUCH apreciated :D EDIT: Here is a log of compiling the example with `\listfiles` at the beginning of the doc as suggested by Alan Munn.


title: How to use the equivalent of a vfill in a tabular environment?

text: I have a table with two columns and one row. The first one is long and determines the overall height of the table (if need be it can be fixed to `\textheight`). In the second column I have two images. I would like one of them to be aligned to the top of the first column and the other to the second - an effect similar to a `\vfill` on a normal page - see example below. The `\vfill` doesn't seem to work, presumably because the table's height is not defined when that column is set? I have tried:   1. Calculating the remaining space on the page using the `\measurepage` macro from this question and inserting this using `\vspace` - unfortunately this seems to produce lengths much greater than the real available space   2. putting in a 0 width (invisible) rule of `\textheight` to fix the column height and then using `\raisebox` to move the column contents back up. (this fails miserably) Is there another way of Here is a minimal example               %% LyX 2.0.3 created this file.  For more info, see http://www.lyx.org/.     %% Do not edit unless you really know what you are doing.     \documentclass[10pt,a4paper,oneside,english,oldfontcommands,a4paper]{memoir}     \usepackage{fontspec}     \setcounter{secnumdepth}{2}     \setcounter{tocdepth}{2}          \makeatletter          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.     \pdfpageheight\paperheight     \pdfpagewidth\paperwidth               %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.     %packages     \usepackage{calc}     \usepackage{graphicx}     \usepackage{xcolor}     \usepackage{colortbl}     \usepackage{multirow}     \usepackage{lipsum}                    \newcommand\measurepage{\dimexpr\pagegoal-\pagetotal-\baselineskip\relax}          \makeatother          \usepackage{babel}     \begin{document}     \renewcommand{\tabularxcolumn}[1]{m{#1}}               \noindent\begin{tabularx}{\linewidth}{@{}X|p{0.2\linewidth}@{}}          \rule{\TX@col@width}{\textheight-\baselineskip}           &     \begingroup\rule{\linewidth}{0.15\textheight} \newline Some text \vfill \rule{\linewidth}{0.15\textheight}\endgroup \tabularnewline                  \end{tabularx}           \end{document}      Edit: Here is a picture showing what I am trying to acheive. Two column table, the left one determines the overall height. The two images on the right should be aligned with the top and bottom of the content of the left column. There will be some text between these images in the right column, of variable length. So far I can get the images either bottom aligned or top aligned, but not one at the top and one at the bottom. ![This is what I wantto acheive](http://i.stack.imgur.com/QOpvy.jpg)


title: How to align underlined text and a horizontal line created with \rule

text: As described in this question I'm using the tocloft package to customize the table of contents. We are putting a horizontal line under the whole section text up to the page number. Therefore we cannot just use `\underline` for the section text (because this would only affect the text) but have to use `\rule` to put the underlining. However, the underlining for the chapter numbers can just be placed with `\underline` because we want to have a gap btw. the underlining of the chapter number and the underlining of the chapter title+page. As you can see in the following snippet, the line is currently positioned with `[-0.5mm]` ...               \usepackage{tocloft}     \renewcommand{\cftchappresnum}{\underline} % chapter numbers are underlined     \renewcommand{\cftchapaftersnumb}{\rlap{\rule[-0.5mm]{0.96\textwidth}{.4pt}\hss}} % chapter entries are underlined as well      ... however this does _not_ correctly align with the previous underline. I think the question is now: _What would be the correct length_ (in `ex`?) _to move the line so that it aligns with an underline on the same line?_ Also: _What would be the correct thickness so it's the same as for the underline?_


title: Part style in memoir class

text: I use the `\chapterstyle{thatcher}` in `memoir` class. I would like the part style would be similar to the chapter style - but with title centered in the page. As I'm a newbie in LaTeX world, I wonder how should I use the commands which are described in the `memoir` manual (section 6.4)? I've tried the following ones in the preamble, and ... it doesn't work...               \renewcommand*{\partnamefont}{\large\centering}     \renewcommand*{\partnumfont}{\large}     \renewcommand*{\printpartnonum}{%     \vphantom{\printpartname}%     \vphantom{\partnumfont 1}%     \afterpartnum     \vskip -\onelineskip}     \renewcommand*{\parttitlefont}{\Large\scshape}     \renewcommand*{\printparttitle}[1]{%     \hrule\vskip\onelineskip \centering\parttitlefont ##1}


title: Listing with line numbers inside a table

text: I typeset a lot of listings (using the `listings` package) inside (`array`-based) `tabular` environments. This works like a charm, however, breaks when I pass the `numbers=` option to the listing:               \documentclass{article}          \usepackage{listings}     \usepackage{array}          \begin{document}          \begin{tabular}{p{8cm}}       % The following works if you remove the numbers=left option       \begin{lstlisting}[language=C,basicstyle=\ttfamily, numbers=left, gobble=4]         int main(){           printf("Hello, Bug\n");         }       \end{lstlisting}     \end{tabular}          \end{document}      This fails with the error message:               Runaway definition?     #1\\left\unskip \relax \@endpbox \hskip \col@sep      ! Forbidden control sequence found while scanning definition of \lst@temp.     <inserted text>                  }     l.9 ...sicstyle=\ttfamily, numbers=left, gobble=4]      Any idea, what causes this problem? Is there a possible workaround (besides external boxing or falling back to `\lstinputlisting`)?


title: How to create a matrix with rows and columns labeled (at the right side)?

text: I would like to create a matrix with rows and columns being labeled. I would like the matrix elements to be right aligned, the row labels being displayed to the right of the matrix, and the column labels above the matrix. I tried:               \documentclass{article}          \usepackage[T1]{fontenc}     \usepackage[american,ngerman]{babel}          \begin{document}     % does work:     $\bordermatrix{%      & 1 & 2 \cr     1 & x1 & x2 \cr     2 & x3 & x423 \cr     3 & x5 & x6     }$     % does not work (see error below):     % $\bordermatrix*{%     %   x1&x2&1\cr     %   x3&x4&2\cr     %   x5&x6&3\cr     %   1&2 6 }$     \end{document}          % ERROR: Misplaced alignment tab character &.          % --- TeX said ---     % l.17   x1&     %           x2&1\cr     % --- HELP ---     % The special character &, which should be used only to separate items     % in an array or tabular environment, appeared in ordinary text. You     % probably meant to type \&.      To get at least the row labels displayed at the correct side of the matrix, I wanted to use the starred version of `\bordermatrix`, but that did not work (as opposed to given in Voss's mathmode guide). Also, the matrix entries are not right aligned. How can I create such a matrix? Is there a way to do this with `amsmath`? **UPDATE** Thanks to the link by Werner, a minimal example is this:               \documentclass{article}     \usepackage{blkarray}     \newcommand{\matindex}[1]{\mbox{\scriptsize#1}}     \begin{document}     \[       A=\begin{blockarray}{rrl}         \matindex{1} & \matindex{2} & \\         \begin{block}{(rr)l}           \,100 & b\phantom{\,} & \matindex{row 1} \\           2 & 12 & \matindex{row 2} \\           e & f &  \matindex{ABDC} \\         \end{block}       \end{blockarray}     \]     \end{document}      It's just a quick hack to get a bit more horizontal space between the parentheses and the matrix entries.


title: Glossary term list width

text: I am using `glossaries` package in my document and I have some long term names. This breaks my layout. I tried to apply:               \setlength{\glspagelistwidth}{0.3\linewidth}      And it did not work at all. If I use:               \setlength{\glsdescwidth}{0.3\linewidth}      it will work on the description side, but I need the term side to have its width reduced not the description one. If I use:               \setlength{\glsdescwidth}{0.7\linewidth}      it will not give me the expected result either. How can I fix this? The minimum working example I could get (I tried to be the closest possible to my situation):               \documentclass{book}          \usepackage{lipsum}          \usepackage[utf8]{inputenc}          \usepackage[acronym]{glossaries}          \renewcommand*{\glossaryentrynumbers}[1]{}          \newcommand{\dictentry}[2]{%       \newglossaryentry{#1}{name={#1},description={#2}}%       \glsadd{#1}%     }     \newcommand{\dictentryspec}[3]{%       \newglossaryentry{#1}{name={#2},description={#3},sort={#1}}%       \glsadd{#1}%     }     \newcommand{\acronentry}[2]{%       \newglossaryentry{acro#1}{type=\acronymtype, name={#1},description={#2}, first={#2 (#1)}}%       \glsadd{acro#1}%     }                    \makeglossaries          \setlength{\glsdescwidth}{\dimexpr\linewidth-10\tabcolsep}     \renewcommand{\glsnamefont}[1]{\textbf{#1}}     \glstoctrue          \newglossarystyle{clong}{%     \glossarystyle{long}     \renewcommand{\glsgroupskip}{}     }     \begin{document}     My document.          \acronentry{AD}{Sample 1}     \dictentry{really long or long long long long term 1}{\lipsum[1]}     \dictentryspec{really long or long long long long term 2 in place}{used when I have é or â in glossaries}{\lipsum[1]}          \cleardoublepage     \renewcommand*{\arraystretch}{1.5}     \setlength{\glspagelistwidth}{0.3\linewidth}     \printglossary[type=\acronymtype,style=clong]     \cleardoublepage     \printglossary[type=main,style=clong]     \cleardoublepage     \end{document}


title: Mapping a macro onto multiple lists simultaneously

text: I have a macro (say `\myMacro`) that takes three arguments (say a, b, c) and I want to write another macro (say `\otherMacro`) that given three lists of parameters (comma delimited lists and all of the same length and the length of the lists is two or more) maps `\myMacro` onto these arguments in turn. That is               \otherMacro {a1, a2, a3}{b1, b2, b3}{c1, c2, c3}      gives the representation               \myMacro{a1}{b1}{c1} \mapsto       (\myMacro{a2}{b2}{c2} , \myMacro{a3}{b3}{c3})      and               \otherMacro {a1, a2, a3, a4}{b1, b2, b3, b4}{c1, c2, c3, c4}      gives the representation               \myMacro{a1}{b1}{c1} \mapsto       (\myMacro{a2}{b2}{c2} , \myMacro{a3}{b3}{c3}, \myMacro{a4}{b4}{c4})      I am a LaTeX novice and I am very sorry if similar questions have already been asked. I searched the site and found problems that were somewhat similar but I couldn't make sense of the solutions.


title: temporarily suppress hyphenation

text: On the title page of an article I want to insert a paragraph containing keywords. For indexing purposes (e. g. web search engines), I'd like to have the keywords unhyphenated (temporarily, of course). At the same time, the paragraph should be flushed at both sides, even though inter-word spaces may become larger than usual. How can I achieve that?


title: Bibtex: two months with dates

text: I would like to insert the dates of a conference into my bibtex-file. The conference took place in the period 29. november and 2. december. I tried the following, but with a not very satisfactory result:               month=nov#{29--2}#dec      Can someone help me to get proper dates?


title: TexStudio `Error: Could not start the command: pdflatex -synctex=1 -interaction=nonstopmode "file_name".tex`

text: I just start to use texstudio, seems better than texmaker, however while compilation it gives following error:               Error: Could not start the command: pdflatex -synctex=1 -interaction=nonstopmode "file_name".tex      does anyone knows how to solve this? or why does it happen? Thanks. Ubuntu 12.04 32 bit Here is the texstudio version in case that I installed wrong one: TeXstudio 2.7.0 (hg 4323:cf7f5964517f) Using Qt Version 4.8.1, compiled with Qt 4.8.2 R


title: Implement glossary list

text: I am trying to make two glossary lists, one with acronyms and one with abbreviation. I have followed the guide on http://en.wikibooks.org/wiki/LaTeX/Glossary but replaced _include{}_ with _input{}_. In Texstudio I get the error message _"could not start the command: pdflatex.exe.."_. In Texworks it runs without error message but does not display the list. The setup In preamble:               \usepackage[acronym,xindy]{glossaries} % nomain,      \makeglossaries     \begin{document}     \input{Acronyms.tex}      In Acronyms.tex               \newacronym{pmw}{PMW}{Passive microwave imager}     \newglossaryentry{qobs}{name = $Q_{obs,t}$ , description = Observed discharge}      In master document               \printglossary[type=\acronymtype,title=Abbreviations]     \printglossary[title=Acronyms]      In tex document I refer to the abbreviation like               \gls{pmw}      Is there an easier way to make an abbreviation or acronym list?


title: Align equivalent environment in lncs

text: Is there an equivalent `align` environment in `lncs` that has support for multiline equations? I have such an equation that I want to include in my text, and naively injecting `\\\` separators into an equation environment doesn't do the trick. For reference, here is the code:               \begin{equation}     c(\beta, \Sigma, \Pi, \Lambda, T) = C_t(Tr(\beta T)^{-1}) + \\     C_t(\mathbf{A} \times Tr(\beta, T)) + C_t((\mathbf{A} \times Tr(\beta, T))^{-1}) + \\     C_t(Tr(\beta, T)) + 2 \times (C_i(\beta, \Sigma, \Pi, \Lambda) + C(\mathbf{A}) + HW(c))     \end{equation}


title: How i can do if i want it in latex code of table of contents

text: I try to construct the table of content in latex but it have to in the form in this picture. How can i do it? ![enter image description here](http://i.stack.imgur.com/pQtXU.jpg)


title: Automatic line-breaks in tables?

text: I'm writing a short tabular CV that I have to add to my thesis. I thought a quick way would be to use a table for that purpose:               \begin{tabular}{ll}     2009-present           & very long text 1, very long text 2, very long text 3 , very long text 4, very long text 5, very long text 6, very long text 7, very long text 8, very long text 9, very long text 10\\     2009  & Masters\\     2006  & Bachelors\\     \end{tabular}      Unfortunately, LaTeX does not break the lines at the spaces. The only solutions I found so far, are   * "adding additional rows to the table"   * "use fixed table size + `\newline`". Manually adjusting texts is not very efficient. Is there also a way to automatize this (e.g. by defining a cell/column as "text-cell/column")?               \begin{tabular}{lp{12cm}}     2009-present           & very long text 1, very long text 2, very long text 3 , very long text 4, very long text 5, very long text 6, very long text 7, very long text 8, very long text 9, very long text 10\\     2009  & Masters\\     2006  & Bachelors\\     \end{tabular}      Could be a solution, but the right column does not automatically reach the right "border" of the page.


title: How can I obtain the same vertical space between the chapter number and the chapter title?

text: How can I obtain the same vertical space between the chapter number and the chapter title for all chapters? The space between the chapter number and the chapter title reduces when the title goes on more than one line. In this case I want to have the same space as the case when the title is one line.               \documentclass[12 pt, a4paper]{report}     \usepackage{thesis}     \usepackage{titlesec}               \titleformat{\section}     {\normalfont\fontsize{12}{15}\bfseries}{\thesection}{1em}{}     \titleformat{\subsection}     {\normalfont\fontsize{12}{15}\bfseries}{\thesubsection}{1em}{}     \begin{document}          \chapter{Vertical Spacing}     \end{document}      The `thesis.sty` file is given below.               \usepackage{ifthen}          \setlength{\topmargin}{0.0cm} \setlength{\headheight}{.8cm}     \setlength{\headsep}{.4cm} \setlength{\textheight}{23.5cm}     \setlength{\textwidth}{15 cm}      \setlength{\hoffset}{0.0cm}     \setlength{\voffset}{-1cm}            \def\chapter{\newpage\thispagestyle{plain}\secdef\CHAPa\CHAPb}     \def\CHAPa[#1]#2{%     \refstepcounter{chapter}     \addtocontents{lof}{\protect\addvspace{10pt}}%     \addtocontents{lot}{\protect\addvspace{10pt}}%     \addcontentsline{toc}{chapter}%       {\chaptername{\protect\ \thechapter: #1}}%          \renewcommand{\KM}{#2}      {{\centering \chaptername\ \thechapter \par}       { \centering #2\par}}       \vspace{\baselineskip}}     \def\CHAPb#1{%       { \centering #1\par}         \vspace{\baselineskip}}     \newcommand{\KM}{Introduction}      \newcommand{\sectionThesis}[1]{\renewcommand{\KM}{\sf #1}\section{#1}}               \newlength{\defbaselineskip}     \setlength{\defbaselineskip}{\baselineskip}     \newcommand{\setlinespacing}[1]%               {\setlength{\baselineskip}{#1 \defbaselineskip}}     \newcommand{\doublespacing}{\setlength{\baselineskip}%                               {2.0 \defbaselineskip}}     \newcommand{\singlespacing}{\setlength{\baselineskip}{\defbaselineskip}}     \setlength{\parindent}{10pt}               \usepackage{amsmath,amssymb,amsthm}          \numberwithin{equation}{section}     \renewcommand{\theequation}{\thesection.\arabic{equation}}          \bibliographystyle{amsplain}


title: Vertically align text to the top

text: I have some issue with latex. My content is vertically aligned to the middle. How can I change it my contents starts like               \onecolumn     \begin{table}     \caption{Topics found by LDA}     \label{table:topics}     \small     \begin{tabular}{|p{4cm}|p{4cm}|p{4cm}|p{4cm}|}     \hline     \hline     \textbf{Title} & \textbf{Title} & \textbf{Title} & \textbf{Title} \tabularnewline      \hline      ![enter image description here](http://i.stack.imgur.com/BU9xu.png) As you can see it's vertically aligned to the middle, how can I change it to top.


title: Increase distance after examples created with gb4e

text: The package gb4e is used to create linguistic examples. I have noted, however, that the vertical space set before an `exe` environment in `gb4e` is larger than the space set after it. I don't really see why this is the case - ideally they should be the same, in my view. How can I set them to be identical? MWE:               \documentclass{article}     \usepackage{setspace,gb4e}     \doublespacing     \begin{document}     \noindent Here is a German example:     \begin{exe}         \ex         \gll Den Hund des Mannes\\         the.\textsc{acc} dog the.\textsc{gen} man.\textsc{gen}\\     \end{exe}     It would be better to write the following:     \begin{exe}         \ex         \gll Der Hund des Mannes\\         the.\textsc{nom} dog the.\textsc{gen} man.\textsc{gen}\\     \end{exe}     These were two great examples!     \end{document}      ![enter image description here](http://i.stack.imgur.com/zLUYm.png) * * * **EDIT** Implementing Werner's suggestion (which works and looks great), I've noticed that I get a massive vertical space after an `exe` environment which I have included in a minipage (in order to be able to place two examples side by side). How can I reduce this space to the regular `\topsep` distance? MWE:               \documentclass{article}     \usepackage{setspace,gb4e}     \let\oldendexe\endexe     \def\endexe{\oldendexe\vspace{\topsep}}% Add \topsep gap below exe environment     \doublespacing     \begin{document}     \noindent Here is a German example:     \begin{exe}         \ex         \gll Den Hund des Mannes\\         the.\textsc{acc} dog the.\textsc{gen} man.\textsc{gen}\\     \end{exe}     It would be better to write the following:     \begin{exe}         \ex         \gll Der Hund des Mannes\\         the.\textsc{nom} dog the.\textsc{gen} man.\textsc{gen}\\     \end{exe}     These were two great examples! Below are some examples of German verbs and nouns.          \begin{table}[ht]     \begin{minipage}[t]{0.5\linewidth}     \doublespacing     \begin{exe}         \ex             \begin{tabular}[t]{l l}                 \multicolumn{2}{c}{Verbs}\\                 \textit{leben} & `live'\\                 \textit{haben} & `have'\\                 \textit{sehen} & `see'\\             \end{tabular}     \end{exe}     \end{minipage}     \begin{minipage}[t]{0.5\linewidth}     \doublespacing     \begin{exe}         \ex             \begin{tabular}[t]{l l}                 \multicolumn{2}{c}{Nouns}\\                 \textit{Erde} & `earth'\\                 \textit{Hand} & `hand'\\                 \textit{Haus} & `house'\\             \end{tabular}     \end{exe}     \end{minipage}     \end{table}     Aren't German words cool?     \end{document}      ![enter image description here](http://i.stack.imgur.com/fLbCt.png)


title: Table with combination of multirows and multicolumns

text: I need to create similar table using LaTeX: ![enter image description here](http://i.stack.imgur.com/BaWFf.jpg) I have tried to use `\tabular` and `\multicolumn`, but every time I get something wrong. Could someone help me?                 \documentclass{article}       \begin{document}          \begin{tabular}{ | l | l | l | l | l | l | l | l | l | l | l | l | l | l | l | l | l | l | l | l | l | l | }      \hline     \  & \  & \  & \  & \  & \  & \  & \  & \  & \  & \  & \  & \  & \  & \  & \  & \    & \  & \  & \  & \  & \  \\ \hline     \  & \  & \  & \  & \  & \  & \  & \  & \  & \  & \  & \  & \  & \  & \  & \  & \     & \  & \  & \  & \  & \  \\ \hline      &  & No 0 &  &  &  &  & No  1 &  &  &  &  & No  2 &  &  &  &  & No 3 &  &  &  &      \\ \hline           &  & TT & FF & P & R & F & TT & FF & P & R & F & TT & FF & P & R & F & TP & FP & P & R & F \\ \hline                    A & A1 & 2 & 3 & 0.4 & 0.4 & 0.4 & 3 & 7 & 0.3 & 0.6 & 0.54 & 5 & 12 & 0.28 & 1 & 0.79 & 5 & 0 & 1 & 1 & 1 \\ \hline           & A2 & 1 & 12 & 0.08 & 0.5 & 0.31 & 2 & 14 & 0.13 & 1 & 0.56 & 2 & 4 & 0.33 & 1 & 0.82 & 2 & 0 & 1 & 1 & 1 \\ \hline           & A3 & 0 & 0 & na & na & 0 & 0 & 4 & 0 & na & 0 & 0 & 0 & na & na & na & 0 & 0 & na & na & na \\ \hline               B & B1 & 2 & 9 & 0.18 & 0.5 & 0.42 & 3 & 26 & 0.12 & 0.75 & 0.47 & 4 & 30 & 0.12 & 1 & 0.54 & 4 & 0 & 1 & 1 & 1 \\ \hline          & B2 & 0 & 3 & 0 & 0 & na & 1 & 3 & 0.25 & 0.5 & 0.45 & 2 & 2 & 0.5 & 1 & 0.9 & 2 & 0 & 1 & 1 & 1 \\ \hline          & B3 & 0 & 1 & 0 & 0 & na & 1 & 3 & 0.25 & 1 & 0.75 & 1 & 2 & 0.33 & 1 & 0.82 & 1 & 0 & 1 & 1 & 1 \\ \hline                C & C1 & 1 & 56 & 0.02 & 1 & 0.14 & 1 & 38 & 0.03 & 1 & 0.19 & 1 & 11 & 0.08 & 1 & 0.45 & 1 & 0 & 1 & 1 & 1 \\ \hline         & C2 & 0 & 8 & 0 & 0 & na & 1 & 1 & 0.5 & 1 & 0.9 & 1 & 1 & 0.5 & 1 & 0.9 & 1 & 0 & 1 & 1 & 1 \\ \hline         & C3 & 0 & 2 & 0 & 0 & na & 0 & 7 & 0 & 0 & na & 1 & 4 & 0.2 & 1 & 0.69 & 1 & 0 & 1 & 1 & 1 \\ \hline                D & D1 & 0 & 37 & 0 & 0 & na & 2 & 16 & 0.11 & 0.33 & 0.27 & 3 & 18 & 0.14 & 0.5 & 0.39 & 3 & 0 & 1 & 1 & 0.53 \\ \hline        & D2 & 0 & 2 & 0 & 0 & na & 3 & 2 & 0.4 & 0.5 & 0.49 & 4 & 2 & 0.67 & 1 & 0.95 & 4 & 0 & 1 & 1 & 1 \\ \hline         & D3 & 0 & 0 & na & na & 0 & 0 & 6 & 0 & na & 0 & 0 & 1 & 0 & na & na & 0 & 0  & na & na & na \\ \hline         \end{tabular}         \end{document}


title: Show miniframes with split outer themes

text: I'd like to combine the `split` and `miniframes` themes of beamer. For example, I would have the miniframes appear in the right half of the title bar (where the subsections appear). If there are any subsections, I'd have the miniframes below or next to the subsection title. This is a sample document.               \documentclass[compress,aspectratio=43]{beamer}          \useoutertheme{miniframes}     \useoutertheme{split}     %\setbeamertemplate{headline}[miniframes theme]     \usecolortheme{whale}          \begin{document}          \section{First Section}     \frame{} \frame{} \frame{}          \section{Second Section}          \subsection{sub1}     \frame{} \frame{} \frame{}          \subsection{sub2}     \frame{} \frame{} \frame{}          \end{document}      I won't ask if it's possible, because everything is possible with TeX, but rather whether someone can help me :) To show what I mean, these are the headlines with `miniframes`: ![enter image description here](http://i.stack.imgur.com/WSb5C.png) These are with `split`: ![enter image description here](http://i.stack.imgur.com/I0eh8.png) And I want something like this mockup: ![enter image description here](http://i.stack.imgur.com/Ns59U.png)


title: Page breaks inside titlesec section headings

text: I use LaTeX to generate contracts and agreements. In most cases, it works okay but, every so often, it causes problems with pagination; specifically, if I have too many subsections without an explicit `\newpage`. This is an issue because, every time I edit or add a subsection I end up having to manually repaginate the entire document which sort of defeats the object of using Latex. There's nothing particularly fancy about the following LaTeX definition but, if you compile it, you'll notice two problems:   1. There's a completely unnecessary page break after "In this Agreement, unless clearly inconsistent with or otherwise indicated by the context :"   2. There's an overfull `\vbox` at (plus or minus) subsection 3.26 and, without a manual `\newpage`, I can't stop it "eating" the rest of the document                   \documentclass{article}              \usepackage{fontspec}         \usepackage{setspace}         \usepackage{url}         \usepackage[top=2.0cm, bottom=2.0cm, left=2.0cm, right=2.0cm]{geometry}         \usepackage{listings}         \usepackage[english]{babel}         \usepackage{float}         \usepackage[final]{pdfpages}         \usepackage{graphicx,type1cm,eso-pic,color}         \usepackage{fancyhdr}         \usepackage{lscape}         \usepackage{color}         \usepackage[pageatnewline]{titlesec}              \titleformat{\section}{\normalfont\Large\bfseries}{\thesection}{1em}{}         \titleformat{\subsection}{\normalfont\normalsize}{\thesubsection}{1em}{}         \titleformat{\subsubsection}{\normalfont\normalsize}{\thesubsubsection}{1em}{}         \titleformat{\paragraph}{\normalfont\normalsize}{\theparagraph}{1em}{}         \titleformat{\subparagraph}{\normalfont\normalsize}{\thesubparagraph}{1em}{}              \titlespacing*{\section}      {0pt}{3.5ex plus 1ex minus .2ex} {2.3ex plus .2ex}         \titlespacing*{\subsection}   {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}         \titlespacing*{\subsubsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}         \titlespacing*{\paragraph}    {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}         \titlespacing*{\subparagraph} {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}              \newcommand\blah{blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah}              \setcounter{secnumdepth}{7}              \begin{document}              \setcounter{section}{0}              \newlength{\tabheight}         \setlength{\tabheight}{1.0cm}         \newpage         \pagenumbering{arabic}              \pagestyle{plain}              \section{PARTIES}         \subsection {A registered company. Registration Number:  "***********", and}         \subsection {Another registered company. Registration Number: \textbf{"(***************)"}}              \section{RECITALS}         \textbf{NOW, THEREFORE, IN CONSIDERATION OF THE MUTUAL COVENANTS AND PROMISES CONTAINED HEREIN AND FOR GOOD AND VALUABLE CONSIDERATION, THE RECEIPT AND SUFFICIENCY OF WHICH IS HEREBY ACKNOWLEDGED, THE PARTIES HEREBY AGREE AS FOLLOWS:}         \subsection {Statements pertaining to the agreement.}         \subsection {More statements pertaining to the agreement.}         \subsection {\blah{}.}         \subsection {\blah{}}         \subsubsection {\blah{}}         \subsubsection {\blah{}}         \subsubsection {\blah{}}         \subsubsection {\blah{}}         \subsection {\blah{}.}         \subsection {\blah{}.}         \subsection {\blah{}.}         \subsection {\blah{}.}              \section{DEFINITIONS AND INTERPRETATION}         \subsection {DEFINITIONS}         \textbf{In this Agreement, unless clearly inconsistent with or otherwise indicated by the context :}          \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}         \subsection {"DEFINITION" means whatever we want it to mean \blah{};}              \section{INTERPRETATION}         \subsection {In this Agreement, unless clearly inconsistent with or otherwise indicated by the context:}         \subsubsection {Any reference to the singular includes the plural and vice versa;}         \subsubsection {Any reference to natural persons includes legal persons and vice versa; and any reference to a gender includes the other gender;}         \subsubsection {Where appropriate, meanings ascribed to defined words and expressions in the above paragraph's, shall impose substantive obligations on the Parties;}         \subsubsection {The clause headings in this Agreement have been inserted for convenience only and shall not be taken into account in its interpretation;}         \subsubsection {Words and expressions defined in any sub-clause shall, for the purposes of the clause of which that sub-clause forms part, bear the meanings assigned to such words and expressions in that sub-clause;}         \subsubsection {This Agreement is governed by and construed and interpreted in accordance with the laws of the Territory and shall be binding on successor in title;}         \subsubsection {Unless specifically otherwise provided, all amounts in this agreement are exclusive of value-added tax;}                   \end{document}      I've tried messing around with the widow/orphan control and pageatnewline in the `titlesec` parameter but nothing seems to stop the compiler from putting everything on one page. All I'm after really is automated section numbering and automated references/labels. Maybe there's a better way to do this without having to write my own formatter. However, for the moment, I'd just like to know how to make the compiler put a page break in if a section header goes over the end of a page.


title: \url wrapping extends into marginal notes space

text: This is a slightly odd one. I've been trying to get `\url{}` blocks to wrap really long URLs, and the only thing that seemed to work was to renew the `\UrlBreaks` command to allow breaking on practically all characters. However, whilst that prevents the long URL from overlapping the page margins, it seems to still push characters into the marginal notes spaces (defined by `\marginparsep` and `\marginparwidth`). The following document shows the problem:               \RequirePackage[hyphens]{url}     \documentclass[12pt]{article}          \usepackage[hyphens]{url}     \PassOptionsToPackage{hyphens}{url}     \usepackage[colorlinks=true, urlcolor=blue]{hyperref}     \usepackage[margin=1cm, bottom=3.5cm, top=3.5cm, head=2cm]{geometry}     \usepackage{showframe}     \usepackage{blindtext}          \setlength\parindent{0pt}          \let\origUrlBreaks\UrlBreaks     \renewcommand*{\UrlBreaks}{\origUrlBreaks\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\.\do\/\do\-\do\_\do\?\do\&\do\=}          \begin{document}          \blindtext          \url{http://really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-really-long-url.com}     \end{document}      When I compile it, half of the 'y' in really, and the entire '-' get pushed into the \marginparsep area. However, this does not seem to happen for blocks of regular text. See here: ![enter image description here](http://i.stack.imgur.com/0QWgm.png) Does anyone know why this happens, and what to do to fix it?


title: Implementing bibtopic results in 'TeX capacity exceeded'

text: I use TeXstudio and MiKTeX 2.9, and cite using natbibapa and apacite and BibLaTeX. I want to make a bibliography from Languages.bib, and reference list from Proposal.bib. Hence I installed bibtopic, but when trying to use it, I get the error "TeX capacity exceeded, sorry [parameter stack size=10000]. It shows up for the line saying `\begin{btSect}{Languages}`. Does someone spot the error? I think it might have to do with how I cite in parentheses and in text. I use `\citep{source}` and `\cite{source}` for that. Example code:               \documentclass{article}     \usepackage[natbibapa]{apacite}     \usepackage{bibtopic}          \begin{document}     \bibliographystyle{apacite}          \section{Example}     Division into macro areas, families, and naming and spelling are done according to the World Atlas of Language Structures \citep{wals}.      Other important sources were \cite{sanroque2012} and \cite{hatt}.          \begin{btSect}{Languages}     \section{Bibliography for sample languages}     \btPrintAll     \end{btSect}          \begin{btSect}{Proposal}     \section{References}     \btPrintCited     \end{btSect}          \end{document}


title: What causes my tangent and normal lines not to be visually perpendicular?

text: \documentclass[pstricks,border=12pt,dvipsnames]{standalone}          \usepackage{pstricks-add}     \usepackage[nomessages]{fp}          \FPset\LabelBase{4}     \FPeval\DeltaX{pi/LabelBase}     \FPset\DeltaY{1}          \FPeval\Left{0 -pi/4 -DeltaX/2}     \FPeval\Right{2*pi +DeltaX/2}     \FPeval\Bottom{0 -3 -DeltaY/2}     \FPeval\Top{3 +DeltaY/2}          \newlength\Width\Width=8cm     \newlength\Height\Height=6cm     \newlength\urx\urx=15pt     \newlength\ury\ury=15pt     \newlength\llx\llx=-15pt     \newlength\lly\lly=-15pt          \psset     {         trigLabels,         trigLabelBase=\LabelBase,         urx=\urx,         ury=\ury,         llx=\llx,         lly=\lly,         algebraic,         plotpoints=1000,         xAxisLabel=$x$,         yAxisLabel=$y$,      }          \def\f{sin(x)+sin(2*x)+sin(3*x)}     %\def\fp{cos(x)+2*cos(2*x)+3*cos(3*x)}          \def\fp{Derive(1,\f)}          \begin{document}     \begin{psgraph}[dx=\DeltaX,dy=\DeltaY]{->}(0,0)(\Left,\Bottom)(\Right,\Top){\dimexpr\Width-\urx+\llx}{\dimexpr\Height-\ury+\lly}         \psplot[linecolor=NavyBlue]{Pi -4 div}{TwoPi}{\f}         \pstVerb{/xxx {Pi 4 div}def}         \psCoordinates[linestyle=dashed,linecolor=gray](*xxx {\f})         \psplotTangent[linecolor=Red,Derive={\fp}]{xxx}{1}{\f}         \psplotTangent[linecolor=Green,Derive={-1/\fp}]{xxx}{1}{\f}     \end{psgraph}     \end{document}      ![enter image description here](http://i.stack.imgur.com/q5G7o.png) What causes my tangent and normal lines not to be perpendicular?


title: Draw single-vertex Feynman diagram

text: I am trying to draw a simple single vertex Feynaman Diagram, like the one shown next ![enter image description here](http://i.stack.imgur.com/2KOsN.png) I've tried using `feynmp` package but I am not able to reproduce it. My code is               \documentclass{article}     \usepackage{feynmp}     \DeclareGraphicsRule{.1}{mps}{.1}{}     \makeatletter     \def\endfmffile{%       \fmfcmd{\p@rcent\space the end.^^J%               end.^^J%               endinput;}%       \if@fmfio         \immediate\closeout\@outfmf       \fi       \ifnum\pdfshellescape=\@ne         \immediate\write18{mpost \thefmffile}%       \fi}     \makeatother     \begin{document}             \begin{fmffile}{DistributionScattering}                     \fmfframe(1,7)(1,7){                             \begin{fmfgraph}(40,25)                                     \fmfleft{i1}                                     \fmfright{o1}                                     \fmf{fermion}{i1,v1}                                     \fmf{fermion}{v1,o1}                                     \fmfblob{.15w}{v2}                                     \fmf{photon}{v1,v2}                             \end{fmfgraph}                     }             \end{fmffile}     \end{document}      My output is ![enter image description here](http://i.stack.imgur.com/NrqKx.png) How to reproduce the first diagram?


title: The second column always appears lower than the first one in the multicol environment

text: I need to make a two column document (on a landscape format sheet), but the second column appears in a lower position than the first one. I wrote "always" in the title because it also happens when I use the `minipage` environment to split the page in two columns. Here's an example, how can I solve this problem? Thank you. Luigi ![enter image description here](http://i.stack.imgur.com/Ts7sB.png) Here's the input file:               \documentclass{article}     \usepackage[italian]{babel}     \usepackage[utf8]{inputenc}     \usepackage[a4paper,margin=2cm,landscape]{geometry}     \usepackage{lipsum,multicol}     \usepackage[colorlinks]{hyperref}     \usepackage{titlesec}     \titleformat{\section}[block]{\Large\bfseries\filcenter}{}{1em}{}     \title{Nuovi e vecchi fatti stilizzati}     \date{}     \begin{document}     \pagenumbering{gobble}     \maketitle     \begin{multicols}{2}          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%     \section*{Kaldor Facts 1961}     \begin{enumerate}     \item La produttività del lavoro è cresciuta a un tasso sostenuto     \item Il rapporto capitale/lavoro è cresciuto a un tasso sostenuto     \item Il tasso di profitto sul capitale è stato stabile nei paesi sviluppati     \item Il rapporto capitale/output è rimasto stabile     \item Le quote di profitto e salario sono state stabili     \item Vi sono state differenze dei tassi di crescita tra paesi nell'ordine del 2\%-5\%     \end{enumerate}     \columnbreak     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%     \section*{New Kaldor Facts 2009 - Jones, Romer}     \begin{enumerate}       \item La produttività del lavoro è cresciuta a un tasso sostenuto     \item Il rapporto capitale/lavoro è cresciuto a un tasso sostenuto     \item Il tasso di profitto sul capitale è stato stabile nei paesi sviluppati     \item Il rapporto capitale/output è rimasto stabile     \item Le quote di profitto e salario sono state stabili     \item Vi sono state differenze dei tassi di crescita tra paesi nell'ordine del 2\%-5\%     \end{enumerate}          \end{multicols}     \end{document}


title: tikzmark and issue with pgfsys-dvips.def

text: When I try to use `\tikzmark` (actually, any feature that relies on the `[remember picture]` functionality of TikZ) in the WYSIWYG editor BaKoMa TeX, I get the following warning: > Package pgf Warning: Your graphic driver pgfsys-dvips.def does not support > marking the current position. This warning is given only once on input line > 24. and the desired output is not rendered. According to the developer of BaKoMa, this is an issue with the dvips driver of the PGF package, and not with BaKoMa editor. Is this truly a bug of the PGF package? If so, is there a work-around before an official patch is available? * * * An example to illustrate how the problem looks like:               \documentclass{beamer}     \usepackage{tikz}          \begin{document}          \begin{frame}{Title}          \tikz[remember picture] \node[circle,fill=red!50] (n1) {};     something          \bigskip          \centering          \tikz[remember picture] \node[fill=blue!50] (n2) {};          \bigskip          \begin{tikzpicture}[remember picture]       \node (c) [circle,draw] {Big circle};       \draw [overlay,->,very thick,red,opacity=.5]         (c) to[bend left] (n1) (n1) |- (n2);     \end{tikzpicture}          \end{frame}          \end{document}      **Output via BaKoMa** ![enter image description here](http://i.stack.imgur.com/Zpsf7.png) **Output via TeXworks** (with `pdflatex`) ![enter image description here](http://i.stack.imgur.com/eig4E.png)


title: Ibid for citations with same title and page

text: I use the style verbose-ibid, and I need it to use _ibid_ (without a page number) when the last entry is exactly the same as the previous one (that is, same work, same page). Right now, for the minimum working example below, the footnotes I get are > Author. _Book A_ , p. 1.   >  Ibid., p. 1. However, I need > Author. _Book A_ , p. 1.   >  Ibid. How do I do this?               \documentclass[12pt]{book}          \usepackage[backend=biber, style=verbose-ibid]{biblatex}     \usepackage{filecontents}          \begin{filecontents}{test.bib}          @book{a,       title = {Book},       author = {Author},     }          \end{filecontents}          \addbibresource{test.bib}          \begin{document}          Here is some reference.\footcite[1]{a}     Here is some reference.\footcite[1]{a}          \printbibliography          \end{document}


title: Concerning the equation mode

text: I am listing a bunch of itens that are left-aligned (actually, I am using the `\hspace` command); then, for one of them, I need to do a definition by cases, so i'm using the `equation` mode and, inside it, the `case` mode. My problem is: when I do it like that this item comes centered, and I can't seem to find a way to put it left-align. Any suggestions? EDIT: I'd like to have this implemented in a local-way; that is, generically equations would still be centered but in this particular case I'd like to be able to have them left-aligned... MWE               \documentclass[11pt,a4paper]{book}          \usepackage[portuguese]{babel}          \usepackage[utf8]{inputenc}          \usepackage[T1]{fontenc}          \usepackage{amssymb}          \usepackage{amsmath}          \usepackage{amsthm}          \usepackage{indentfirst}          \begin{document}               \hspace{1.5cm} $ x = something....$          \hspace{1.5cm} $ y = something...$          \begin{equation*}     z =      \begin{cases}     1 & \text{if } x > 0 \\     -1 & \text{if } x \leq 0.          \end{cases}     \end{equation*}          \end{document}


title: How to create a new column type with top alignment

text: I am trying to create a table which has wrapped text and the text in each cell is ragged right and top aligned. As you can see in the following image I'm not getting the top alignment. ![Text is not aligned at the top of each cell](http://i.stack.imgur.com/JB5up.jpg) Here is my LaTeX code:               \documentclass[letterpaper]{article}     \usepackage{array}     \newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}    \vspace{0pt}}m{#1}}     \begin{document}         \begin{table*}[!t]             \centering         \begin{tabular}[t]{|L{1.8cm}| L{2.3cm}|}             \hline             This is a long line.  It sets the height of the column and is top aligned &i want this to be top aligned too\\\hline             \end{tabular}         \end{table*}     \end{document}      I would appreciate any hints for how to fix this. Thank you!


title: Change color theme for Beamer

text: this question is indeed trivial, but I haven't found any answer to it online. I'm for the first time using the Beamer environment to make a presentation. I'm using the Cambridge US theme, but I want to change the color of the theme to structure, as seen in this example. I found quite a lot of information on how to change the color of specific elements within the Beamer environment, but I simply want to change the color of the entire theme. The reason for this is I don't like the combination of the red general theme and the blue graphics for itemize.               \documentclass{beamer}     \usetheme{CambridgeUS}     \setbeamercolor{structure}{}          \begin{document}           \begin{frame}      \frametitle{Introduction}      Blablabla      \end{frame}          \end{document}      Thanks!


title: Redefining a theorem counter

text: I have a document with a lot of lemmas and theorems. In the main part of the document there are sections and subsections, so I defined               \newtheorem{lem}{Lemma}[subsection]      to number the lemmas accordingly. But in the appendices I don't have subsections, so I figured it would be better if lemmas in the appendices are not numbered with respect to subsections, but with respect to sections. Therefore, I gave the command               \renewcommand\thelem{\thesection.\arabic{lem}}      just after opening the appendices with `\appendix`. But something strange happened. In appendix A I don't have lemmas. In appendix B the first lemma is numbered B.3. Could anyone explain me this behavior and suggest a solution? * * * **Edit:** If I give the command               \renewcommand\thelem{\thesection.\arabic{lem}}     \setcounter{lem}{0}      the first lemma will be numbered B.1. But I'm still confused about why it is necessary to set the counter to 0.


title: Acm style bibliography is shortening 3rd author

text: I have the following entry in my bibliography :               @article{szymanski,     author={Zbigniew Szymański, Stanisław Jankowski, Jan Szczyrek},     title="Reconstruction of environment model by using radar vector field histograms",     journal="Photonics Applications in Astronomy, Communications, Industry, and High-Energy Physics Experiments",     volume= "8454",     issue = "4",     pages= "1-8",     year="2012"     }      When I put a reference to this article I get in the references section this : ![enter image description here](http://i.stack.imgur.com/q12qg.png) How do I prevent the shortening of 3rd author ? ( I can provide what am I using - whether it is Bibtex or Biblatex or anything - but how can I check it?)


title: How to handle special characters in URLs while using \href

text: Special characters like `%` throw `href` off. What package, if any, gives a work around? Would there be a side effect to changing the URLs from `%` to `\%`? EDIT On a second try, on a different computer, I do not see any problems except that TeXworks editor does treat items in a `href` after `%` as a comment (and actually so does this web site!) On the first computer I got an error message too. I'll post if I can reproduce it.               \documentclass{article}     \usepackage{hyperref}          \begin{document}     % the original URL     {\href{http://wims.unice.fr/wims/wims.cgi?session=1I6D03A2E6.5&+lang=en&+module=tool%2Fanalysis%2Ffunction.en}{ App 0.1 }}     % the modified URL     {\href{http://wims.unice.fr/wims/wims.cgi?session=1I6D03A2E6.5&+lang=en&+module=tool\%2Fanalysis\%2Ffunction.en}{ App 0.1 }}          \end{document}


title: Change of cj.bst sytle bibtex

text: I recently began to use Latex and bibtex. I would like to know, What I need doing to edit the `cj.bst` style (is the most closest style that I found to write my undergraduate career final project). I need to change several things on it. 1.) I need that all authors (books, journals, inbook, proceedings, etc) have been separated by `,` and not an `and` when bibtex write the last author. For example: (before) > Sorenson, J., Hura, G., Glaeser, R., and Gordon, H. (2000) “What can x-ray > scattering tell us about the radial distribution functions of water?”. J. > Chem. Phys., 113, 9149–9161. (later) > Sorenson, J., Hura, G., Glaeser, R., Gordon, H. (2000) “What can x-ray > scattering tell us about the radial distribution functions of water?”. J. > Chem. Phys., 113, 9149–9161. 1.1) When a book have two or more authors, I need to separate authors by `;` and that @book, @inbook or @incollection tittles doesn't appear emphasized . For example: (before) > Robinson, G. W., Zhu, S.-B., and Evans, M. (1996) _Water in > Biology,Chemistry and Physics. Experimental Overviews and Computational > Methodologies_. World Scientific. (later) > Robinson, G. W.; Zhu, S.-B.; Evans, M. 1996 Water in Biology,Chemistry and > Physics. Experimental Overviews and Computational Methodologies. World > Scientific. 2) The last that I need is that years of publications (books, journals, inbook, proceedings, etc) doesn't appear whit parenthesis. For example: (before) > Franks, F. (2000) Water: A Matrix of Life. Royal Society of Chemistry. (later) > Franks, F., 2000. Water: A Matrix of Life. Royal Society of Chemistry. I hope that your can help me. PD: Sorry if my English is not well writed.


title: changing the position of a caption

text: I have a code for putting a figure:               \begin{figure}     \includegraphics{some_narrow_and_tall_image.pdf}     \caption{caption of the figure which can be pretty long}     \end{figure}      The page format is single-column. Right now the caption appears below the image, as expected from this code. I would like to set it up so that the caption is on the right hand-side of the image. Is that possible?


title: Spacing within equation

text: I've got the following equation:               \begin{align*}     y_{i} &= f(x_{i}) + \epsilon_{i} \nonumber \\     &\approx \underbrace{f(x_{0})}_\text{=$\beta_{0}$} + (x_{i}-x_{0})\underbrace{f^{'}(x_{0})}_\text{=$\beta_{1}$} + (x_{i}-x_{0})^{2}\underbrace{\frac{f^{''}(x_{0})}{2!}}_\text{=$\beta_{2}$} + \ldots + (x_{i}-x_{0})^{l}\underbrace{\frac{f^{(l)}(x_{0})}{l!}}_\text{=$\beta_{l}$}  +  \epsilon_{i}  \nonumber \\     &= \beta_{0} + \beta_{1}(x_{i}-x_{0}) + \beta_{2}(x_{i}-x_{0})^{2} + \ldots + \beta_{l}(x_{i}-x_{0})^{l}  +  \epsilon_{i} \ .      \end{align*}      However, on the second line the `\epsilon_{i}`part doesn't have a space after the '+'. I'm not sure why that is. Is there way I can have a space after the '+', i.e. 'proper' spacing? Thanks!


title: How do I get the width of \hfill?

text: In my LaTeX document, I have a first line with a given spacing obtained using \hfill, then a paragraph, and then a third line in which I would like to use the same spacing as in the first line. The first line is something like:               a\hfill b\hfill c\hfill d      How do I use the same spacing between the elements of my third line as what `\hfill` does between the elements of my first line? The following example does not work, but shows the idea of what I am trying to achieve:               \newlength{\lengthofhfill}     a\hfill b\hfill c\hfill d\setlength{\lengthofhfill}{\widthof{\hfill}}          This is another paragraph.          e\hspace{\lengthofhfill}f\hspace{\lengthofhfill}g      I am guessing that there must be a variable that "knows" the length of an `\hfill` somewhere, I just cannot figure out what it is or how to use it. As a side question: Is there any resource on these kind of low-level problems with TeX? I never know where to look to solve them, beside Google. I'd love to know a place in which I can see for myself roughly how `\hfill` is implemented, for instance, at a level in-between the LaTeX documentation and the source level.


title: Begin Align - Text Gaps

text: I have a quick question about blocks of the following type:               \begin{align*}     CODE HERE     \end{align*}      After any one of these blocks I always get this huge gap. In the uncompiled document I have one space between a block like this and another paragraph, but when compiled it leaves about half a page of space. Is there a quick fix to this issue that still leaves all the formatting in the block (and ideally in the rest of the document) the same, without the gaps? Edit: I am now in fact having another issue where blocks like this               \begin{align*}                                                                                a&=b                                &=b                                                   &=b                                                        &=b                                                 &=b                             &=b                                                                          \end{align*}      Are not being read in vertically, and instead are being read across the page in a very awkward way. Is this a problem with align or is more code needed to decide?


title: TeXStudio and TortoiseSVN

text: I'm guessing that `TortoiseSVN` is the most common Subversion client on Windows. It has a very nice point and click interface integrated into Windows Explorer. The TeXStudio editor (which we recommend to new users) has build in `svn` support, but I do not think this has been tested with `TortoiseSVN` as it has a rather odd CLI interface and thus the CLI calls that TS is trying to perform to communicate with the SVN server, fails. Has anyone any ideas as to how one can get TS to work with TortoiseSVN?


title: Determine if within a PGF axis environment

text: Is there an easy way to test whether a macro is called from within an PGF `\begin{axis}...\end{axis}` environment? One solution would be to define a new environment myself that sets a flag at `\begin{axis}` and clears it as `\end{axis}`, but I'd prefer not to have to do that.


title: PSTricks error, but package not loaded

text: I am working on a textbook, with a looming deadline, so I admit I did not do an exhaustive search for a solution to this situation. I was hoping someone would see this and say, "This is a duplicate of..." and direct me there. I just upgraded to MacTex 2011, and when I compile the textbook documents, the console always pops up with... "LaTex Error: You have run the document with pdflatex, but PSTricks requires..." Ok...we don't load the PSTricks package at all, and before the upgrade this error wasn't showing up at all. I should say that if I simply hit "Return" the compiler happily forges ahead and compiles the documents just fine. Anyone know what the deal is? Thanks! Update: Sorry for the delay. Work has been a little crazy. I tracked down the culprit, but I don't know why the error is occuring in the MacTex 2011. Here is the MWE:               \documentclass{report}     \usepackage{boites,boites_exemples}     \begin{document}     Filler Text Goes Here     \end{document}      To be honest, I didn't add this package in, my co-author did, so he must need the functionality. The full list of packages hasn't changed much over the past year, so it isn't that this was added and then the break-down occurred.


title: Remove Indentation for a Single Paragraph

text: Is there a way to remove the indentation at the beginning of a paragraph _for a single paragraph_. I know I could do               \setlength{\parindent}{0cm}     This is my paragraph.  Blah blah blah.     \setlength{\parindent}{default}      Where `default` is whatever the default indentation is for the document class I am using (part of the problem is that I don't know what this default value is). I feel as if there should be a better way to accomplish this than by the above method. I am looking for a solution of the form:               \noindent     This is my paragraph.  Blah blah blah.      Is there a way to do this, or will I have to resort to the former method? If I have to resort to the former method, what is the default indentation value for the `amsart` document class?


title: How to add two force line breaks in cell

text: I would like to add two force line breaks in a cell. Using an answer from this question I can add one force line break. Can you help to add two line breaks using similar function like                  \newcommand{\specialcell}[2][c]{%        \begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}


title: Tex4ht options to convert beamer slides

text: I tried to used `tex4ht` utility to convert beamer-latex presentation to OpenOffice ODT, and I'm really not happy with the results. Please find below the snapshots of PDF and ODT files. ![pdf](http://i.stack.imgur.com/Wqkac.png) ![odt](http://i.stack.imgur.com/8kfnA.png) Please note, Word and Acrobat Reader place pages in a different order, anyway there are few important issues observed after conversion:   1. The page breaks are not inserted between the slides, and the title of the second slide appeared on the first one and so on.   2. The image size is not in accordance with `height` option to `\includegraphics`, furthermore the aspect ratio is changed.   3. One slide with plain list disappeared completely. The only purpose of this conversion is sharing with colleagues, so that they can copy-paste text and images. Therefore I do not expect one-to-one correspondence of PDF and ODT, but at least it should be possible to understand the content of the presentation. Could anyone suggest which options shell I use to achieve this? So far I used the following command:               mk4ht htlatex simple.tex "xhtml,ooffice" "ooffice/! -cmozhtf" "-coo -cvalidate"      And `simple.tex` file is below:               \documentclass{beamer}     \usetheme{default}          %% include pictures     \usepackage{graphicx}     \graphicspath{       {pics/}     }     \DeclareGraphicsExtensions{.png}          %%% title page     \title{Simple slides with beamer}     \author{John Smith}     \date{19 Jul 2013}          \begin{document}          \begin{frame}       \titlepage     \end{frame}               \begin{frame}{A frame with figure}{and subtitle}            \includegraphics[height=0.5\textheight]{simple_cos}            The PNG file has resolution of 640x480.          \end{frame}               \begin{frame}{A frame with plain list}            There is a plain list, nothing special:       \begin{itemize}       \item Important point       \item Another important point       \item And final important point       \end{itemize}          \end{frame}               \begin{frame}{A frame with overlays}            \framesubtitle<1>{sin(x) first}       \framesubtitle<2>{cos(x) first}            \includegraphics<1>[width=0.5\textwidth]{simple_sin}       \includegraphics<1>[width=0.5\textwidth]{simple_cos}       \includegraphics<2>[width=0.5\textwidth]{simple_cos}       \includegraphics<2>[width=0.5\textwidth]{simple_sin}            This note is shown on both overlays.          \end{frame}          \end{document}


title: Customizing \chapter command

text: Here is the picture: ![enter image description here](http://i.stack.imgur.com/FRbud.png) The code is from this post.               \documentclass[a4paper,12pt]{book}     \usepackage{graphicx}     \usepackage{lipsum}     \usepackage{fontspec}     \usepackage{titlesec}     \setmainfont{EB Garamond 12 Regular}     \newfontfamily\cmaiusc[LetterSpace=40,WordSpace=2,RawFeature={+swsh,+dlig}]{EB Garamond 12 SC}          % Environments     \usepackage{setspace}     \newenvironment{comment}       {\begin{spacing}{0.8}\itshape\scriptsize\hspace{-1em}}       {\end{spacing}}          \newcommand{\bbook}[4][]{%                             \makebox[\textwidth][c]{\includegraphics[width=6in]{#4}}                             \chapter[#1]{#2,\\\large #3\\\char"2766}                             \thispagestyle{empty}                             \begin{center}                             {\cmaiusc capitolo\ \roman{chapter}}.                             \end{center}     }          \titleformat{\chapter}[hang]%        {\centering\huge}%        {}%        {0pt}%        {}     \titlespacing*{\chapter}       {0pt}{0pt}{5pt}          \begin{document}     \tableofcontents     \cleardoublepage\noindent                                      % from here     \begin{minipage}{\textwidth}          \bbook{Analysis mathematica}{principia.}{genese_heading}     \begin{center}     \parbox{4.65in}{     \begin{comment}     comment     \end{comment}     }     \end{center}          \end{minipage}          \vspace{\baselineskip}                                         % to here          \lipsum[1-10]     \end{document}      Is possible replace the `\bbook` command in this code with the classic `\chapter` command but that incorporate all the code enclosed into the "from here" "to here" besides the commands of `\bbook`. So the "new" `\chapter` command should have four arguments, if is possible in the order shown below. In this example:               \chapter{genese_heading}{Analysis mathematica}{principia.}{comment}      I would that the "new" command `\chapter` goes into the headers and the `\tableofcontents` as the normal chapter command, but only with the second argument of it, in this example: "Analysis mathematica"


title: Interior product (contraction) symbol

text: In differential topology and linear algebra, there's an operator called the interior product, denoted `$\iota_X(\omega)$` or alternatively with some other "half box" like operator `$X_|\omega$`. Does anyone know how to markup that operator in LaTeX? Google has turned up nothing except for this thread: Symbol for contraction / interior product? That thread did receive an accepted answer, which was \invneg from the MnSymbol package, but the suggestion given there does not seem correct to me. Or at least, it does not match what I'm familiar with. That answer results in an inverted negation symbol, whereas the contraction operator should have a stroke down at the floor of the line, and a long stroke going up almost the full height of the line. It can be found in many texts, but why can I not find the correct LaTeX markup?


title: Numbers outside Math environment

text: Should numbers inside the text be placed inside a math environment? For example, if I am writing `...indent code by 4 spaces...`, should I write it this way or `...indent code by $4$ spaces...`? Perhaps the output is the same but semantically they are not and maybe LaTeX can treat them differently in some cases. Which is the right one? For instance, how does LaTeX treat the numbers in the counters it uses for numbering the sections or pages, etc? Does it treat them as numbers in a Math environment or as numbers inside text? Of course, if the output can never be different in any situation, then well, it just doesn't matter.


title: How to count the frequency of a token in a token list

text: Is it possible to count the number of a token in a token list?               \documentclass{article}          \usepackage{expl3}          \ExplSyntaxOn          \tl_new:N \tobi_list_tl     \tl_set:Nn \tobi_list_tl {foo~bar~baz}          \begin{document}     '\tl_use:N \tobi_list_tl'~contains~?~spaces.     \end{document}      * * * In a macro to typeset syllables and prosoidic symbols I need to count the number of spaces in a token list.               \cs_new_protected:Npn \tobi_metrics:nn #1 #2      {       \tl_set:Nn \l_tobi_words_tl { #2 }       % change spaces into -\q_tobi_space_marker-       \tl_replace_all:Nnn \l_tobi_words_tl { ~ } { - \q_tobi_space_marker - }       % split the (modified) second argument at -       \seq_set_split:NnV \l_tobi_syllables_seq { - } \l_tobi_words_tl       % split the first argument "at nothing"       \seq_set_split:Nnn \l_tobi_measures_seq { } { #1 }       % AT THIS POINT I WANT TO KNOW THE NUMBER OF SPACES                          <---------       % IN \l_tobi_words OR THE NUMBER OF \q_tobi_space_marker                  <------------       % IN \l_tobi_syllables_seq                                                   <---------       \int_zero:N \l_tobi_process_int       \seq_map_inline:Nn \l_tobi_syllables_seq        {         \int_incr:N \l_tobi_process_int         \tl_if_eq:nnTF { ##1 } { \q_tobi_space_marker }          {% we had a space, step back the counter and issue a space           \int_add:Nn \l_tobi_process_int { -1 }           \c_space_token          }          {% print the syllable with the metric marker           \tobi_print_syllable:n { ##1 }          }        }      }      See http://tex.stackexchange.com/a/124531/4918. I need the number to check whether there are enaugh symbols in the list to by combined with syllables, this is my test so far:               \int_compare:nT      {       \seq_count:N \l_@@_syllables_seq - 1 != \seq_count:N \l_@@_symbols_seq      }      {       ERROR      }      The `-1` must be replaced by the number of spaces. * * * Maybe I should add some information on the usage. This will be part of a macro                  \metrics{_    u  u  _   _  _  | _    _  u  u   _  _   _   }                {flos ve-te-ris vi-ni | meis na-ri-bus ob-iec-tust}      The first argument is a space separated list of metric symbols (accesd by abbreviations like `u` or `_`) and the second list contains hyphenated words. I need to check if there is a symbol for every syllable but `\seq_count:` doesn’t work here since spaces from the second list are treated specially. The test must be               # of symbols         = # of syllables     lengt of symbol list = lengthh of syllablelist – # of spaces       * * * This is the latest version of the complete processing macro:               \cs_new_protected:Npn \__metrix_metrics:nn #1 #2      {       \tl_set:Nn \l__metrix_words_tl { #2 }       \tl_replace_all:Nnn \l__metrix_words_tl { ~ } { - \q__metrix_space_marker - }       \seq_set_split:NnV \l__metrix_syllables_seq { - } \l__metrix_words_tl       \seq_set_split:Nnn \l__metrix_symbols_seq { ~ } { #1 }       \int_zero:N \l__metrix_process_int       \seq_map_inline:Nn \l__metrix_syllables_seq        {         \tl_if_eq:nnT { ##1 } { \q__metrix_space_marker }          { \int_incr:N \l__metrix_process_int }        }       \int_compare:nTF        {         \seq_count:N \l__metrix_syllables_seq -           \seq_count:N \l__metrix_symbols_seq = \l__metrix_process_int        }        {         \int_zero:N \l__metrix_process_int         \seq_map_inline:Nn \l__metrix_syllables_seq          {           \int_incr:N \l__metrix_process_int           \tl_if_eq:nnTF { ##1 } { \q__metrix_space_marker }            {             \int_add:Nn \l__metrix_process_int { -1 }             \c_space_token            }            {             \str_case:nnn { ##1 }              {               { |  } { \__metrix_l_break:  }               { || } { \__metrix_ll_break: }              }              {               \__metrix_print_syllable:n { ##1 }              }            }          }        }        {         \__metrix_error_msg:n { Numbers~of~symbols~and~syllables~mismatch. }        }      }      Every works except when one or both of the lists end with a space, so it would be great if all spaces could be cut from the right side before start processing the lists.


title: Nested subfloats with detailed caption control

text: I have four images, each with a corresponding magnified version of a small portion of it. I would like to arrange them so that the zoomed out versions are on one row side by side, and the corresponding zoomed versions are under them on a second row. Then, I'd like there to only be subfloat caption numbers (a,b,c...) under the lower row so that `a` refers to both the full view and zoomed view. I tried modifying Thorsten Donig's example from here: Suppress Numbering of Subfigures, with the result being the code below which DOES DO what I want. So, my question is, is my approach a smart way to do what I want, or is there a better way to get the effect of nested subfigs with granular caption control? Thanks.               \documentclass[11pt,a4paper,english]{article}     \usepackage[T1]{fontenc}     \usepackage[utf8]{inputenc}     \usepackage{babel}     \usepackage[includeheadfoot,margin=3cm]{geometry}     \usepackage[font=small,labelfont=bf,tableposition=top]{caption}     \usepackage{blindtext}     \usepackage{subfig}          \title{Two subfigures without a caption}     \author{Myx}          \begin{document}       \maketitle       \blindtext          \begin{figure}[!htbp]       \centering         \captionsetup[subfigure]{labelformat=empty} % Turn off label display. Label counter keep counting silently         % First row of figures (with no labels)         \subfloat[]{             \subfloat[]{                 \rule{6.4cm}{3.6cm}             }             \hspace{10pt}             \subfloat[]{                 \rule{6.4cm}{3.6cm}             }         }              % Second row of figures (with labels)         \subfloat[]{         \setcounter{subfigure}{0} % Reset label counter so next subfig starts at `a`         \captionsetup[subfigure]{labelformat=default} % Turn label display back on         \subfloat[]{             \rule{6.4cm}{3.6cm}         }         \hspace{10pt}         \subfloat[]{             \rule{6.4cm}{3.6cm}         }         }            \caption[Nested Subfloats]{Top row should have no captions, bottom row should start caption number at 'a'. }       \label{fig.nested}     \end{figure}                 \blindtext     \end{document}


title: Removing Headers, Keeping Page Numbers in the same time

text: I wrote my diploma in LaTeX using Lyx, but now I have big problem to fit the output to universities' standards. I need to remove Part/Section... title from header, I found that using:                \pagestyle{empty}      does the job, but it also removes page numbers, and I spent more than an hour trying to fit them together, especially that in some pages I need no page numbers, while in others has to start from some number, so I'm using:               \setcounter{page}{3}      which also conflicts with the first command. Any help will be highly appreciated, because I need to print it today, thank you in advance.


title: Problem with \hfill and hyphenation

text: When I use `\hfill` and in the previous line the last word is hyphenated, the `\hfill` doesn't work the same way as usual:               \documentclass[a4paper, 12pt]{book}     \begin{document}          Spellings attempt to transcribe the sounds of the language into      alphabetic letters, but phonetic spellings are exceptions   \hfill go to library          AA Spellings attempt to transcribe the sounds of the language into      alphabetic letters, but phonetic spellings  \hfill go to library          \end{document}      What should I write to get `\hfill` work like the first `\hfill` in the example?


title: Macros with # as the last parameter

text: Knuth hid a special rule for delimited arguments in exercise 20.5 of the TeXbook. > If the very last character of the parameter text is #, so that this # is > immediately followed by {, TeX will behave as if the { had been inserted at > the right end of both the parameter text and the replacement text. This means that a macro can be defined as,               \def\a#1#{#1}      calling it as `\a 10` will give a `runaway argument error` whereas calling it as `\a{12}`, will compile with no trouble. I struggled to find a practical application for such macros even after looking at TeX by Topic, TeXbook and LaTeX source. Here is my take on it, create some commands to typeset and do some calculations for fractions, as for example those found in basic arithmetic texbooks. You type this,               \[\FRAC ADD{3}{8}+{1}{7}\]     \[\FRAC SUB{5}{8}-{1}{7}\]     \[\FRAC MUL{5}{8}x{13}{1201}\]      and you get this: ![enter image description here](http://i.stack.imgur.com/yP9VZ.png) Here is the code,               \documentclass{article}      \begin{document}     %% macro factory     \def\FRAC#1#{\csname #1\endcsname}     %% add     \def\ADD#1#2+#3#4{%       \frac{#1}{#2}+\frac{#3}{#4}=       \frac{\the\numexpr(#4*#1)+(#3*#2)}{\the\numexpr#2*#4}     }     %% subtract     \def\SUB#1#2-#3#4{%ok top       \frac{#1}{#2}-\frac{#3}{#4}=       \frac{\the\numexpr(#4*#1)-(#3*#2)}{\the\numexpr(#2*#4)}     }     %% multiply     \def\MUL#1#2x#3#4{%       \frac{#1}{#2}\times\frac{#3}{#4}=       \frac{\the\numexpr(#1*#3)}       {\the\numexpr#2*#4}     }     %% testing     \[\FRAC ADD{3}{8}+{1}{7}\]     \[\FRAC SUB{5}{8}-{1}{7}\]     \[\FRAC MUL{5}{8}x{13}{1201}\]     \end{document}      **Are there any practical applications for such macros? Are there any special precautions one should take? Why would Knuth include this facility in the first place?**


title: LaTeX for word style divide?

text: In microsoft word equation, it's possible to write `a / b` in a format that `a` is slightly upper than normal text, the `/` can be entered using `\ldivide`. Is it possible to do so in LaTeX?


title: Position shift when adding label to 3D asymptote diagram

text: I have this strange issue with 3d asymptote diagrams. Without labels they act as a normal `figure`, but when I add label, the diagram moves to the edge off the page... MWE:               \documentclass[12pt,a4paper,addpoints]{exam}          \usepackage{asymptote}          \begin{document}     \begin{figure}     \begin{asy}     import solids;     import three;          size(5cm);          currentprojection=orthographic(0,-5,3);          triple start = (0,0,1);     real length = 5;     real radius = 1;     triple ax = (0,0,1);     revolution r = cylinder(start,radius,length,ax);     draw(r,black);          revolution downcone=cone(Z,1,-3);     draw (downcone,black);          draw((-1,0,7)--(1,0,7),Arrows3);          draw((1.5,0,1)--(1.5,0,6),Arrows3);          draw((1.5,0,1)--(1.5,0,-2),Arrows3);               \end{asy}     %label("2m",(0,0,7),N);     %label("5m",(1.5,0,3.5),E);     %label("3m",(1.5,0,-0.5),E)     \caption{Graansilo}     \end{figure}     \end{document}      When I add the commented `label` lines to the `asy`-environment, things start to go wrong... the diagram is no longer centered (or at least in the visible area of the page), but moves to the edge...   When trying with multiple diagrams on a page, they even appear on top of each other...   I tried altering the `label`-lines (adding `$`, numbers only, letters only), tried changing the perspective. still no clue... compiling .asy gives 'illegal token "\"', but that's all i have...


title: fontspec-example.tex on texlive 2010 and Ubuntu?

text: I try to run fontspec-example.tex through `xelatex` on my Ubuntu 10.10 installation, combined with texlive 2010. The package cannot find any of the fonts, e.g., TeX Gyre Pagella (error is that kpathsea does not like the font having a space in its name). What do I do wrong? (I do have /usr/local/texlive/2010/texmf-dist/tex/latex/tex-gyre on my system.) I tried using the tips in this question: What fonts are installed on my box?, but I am not sure I understand how to use the font names obtained there.


title: Importing Tabular Cells from Text File

text: Suppose I want to build a table which looks as follows:               \begin{tabular}{ccc}        1.23 & 2.98 & Apple \\       -3.78 & 4.01 & Banana \\       \end{tabular}      However, the numbers in the table are given in a separate text file, say "file.txt", with the content               1.23 & 2.98     -3.78 & 4.01      Is there a simple way to input the cells from "file.txt" into a larger table? I tried               \begin{tabular}{ccc}     \input{file.txt} & \multirow{2}{*}{Apple \\ Banana} \\     \end{tabular}      but this fails (unsurprisingly). I also tried to use minipages - this works in the above toy example but fails in more realistic ones (most importantly, I could not align inputs from different files). Any comments/suggestions welcome! **EDIT** Here's a MWE. The file "file.txt" is as mentioned above. "file2.txt" has the following contents:               1.23 & 2.98 \\     -3.78 & 4.01 \\      (obviously, both "file.txt" and "file2.txt" should be saved in the directory of the tex file). Code for MWE:               \documentclass{article}     \usepackage{multirow}          \begin{document}          % Approach using minipage (works, but looks ugly)     \begin{minipage}{0.4\textwidth}     \begin{tabular}{cc}     \input{file2.txt}      \end{tabular}     \end{minipage}     \begin{minipage}{0.2\textwidth}     \begin{tabular}{c}     Apple \\ Banana     \end{tabular}     \end{minipage}          % Approach mentioned above (fails)     \begin{tabular}{ccc}     \input{file.txt} & \multirow{2}{*}{Apple \\ Banana} \\     \end{tabular}          \end{document}


title: Can not insert a figure in the text

text: This may be a very rudimentary question, but I am new to LaTeX and trying to learn. When I want to inset a pdf image in LaTeX through the Insert menu in TeXnicCenter, I get the following warning:               File 'Directory of file' not fount on input line ...      However, The image appears in the output file, but the path to where the image is located is also appearing above the figure in the output file. Its really frustrating! please help.


title: Sourcecode on the left, Nassi–Shneiderman on the right (float?)

text: I’d like to place a Nassi-Schneiderman diagram into my LaTeX document but also to have the source code for the shown algorithm beside it. Drawing the diagram worked just fine using the `StrukTeX`package, showing the source code isn’t a problem either. The problem is: I can’t think of a way to have text (or in this case: the sourcecode) on the left and the diagram on the right (or vice versa). How do I solve this? Here is the part of my code that is necessary for this question:               \documentclass{scrartcl}     \usepackage[ngerman]{babel}     \usepackage[german,curves]{struktex}     \usepackage[usenames,dvipsnames]{xcolor}     \usepackage{listings}     \usepackage{courier}     \lstset{             basicstyle=\footnotesize\ttfamily, % Standardschrift             numbers=left,               % Ort der Zeilennummern             numberstyle=\tiny,          % Stil der Zeilennummern             numbersep=5pt,              % Abstand der Nummern zum Text             tabsize=3,                  %             extendedchars=true,         %             breaklines=true,            %             keywordstyle=\color{RoyalBlue}\textbf,             commentstyle=\color{ForestGreen},             frame=bottomline,              stringstyle=\color{WildStrawberry}\ttfamily, % Farbe der String              xleftmargin=17pt,              framexleftmargin=17pt,              framexrightmargin=5pt,              framexbottommargin=4pt,          }          \begin{document}     \begin{lstlisting}[language=Java]     int eingabe = 13;         int vrbeingabe = eingabe;         String ergebnis = "";              while(vrbeingabe > 0) {             if(vrbeingabe % 2 == 0) {                 ergebnis = ("0"+ergebnis);                 vrbeingabe = vrbeingabe / 2;             } else {                 ergebnis = ("1"+ergebnis);                 vrbeingabe = vrbeingabe / 2;             }         }              System.out.println("Die Dezimalzahl "+eingabe+" entspricht der Binaerzahl "+ergebnis);     \end{lstlisting}     \begin{struktogramm}(85,20)[Umwandlung dezimaler in binäre Zahlen]         \assign[10]{Eingabe $i$}         \assign[10]{bs $\gets \emptyset$}         \while[8]{solang $i > 0$}             \ifthenelse[15]{5}{6}                 {Rest bei $\frac{i}{2}$}{\sTrue}{\sFalse}                 \assign{bs $\gets$ "1" $+$ bs}             \change                 \assign{bs $\gets$ "0" $+$ bs}             \ifend                        \assign{i $\gets \frac{i}{2}$}                    \whileend         \assign[10]{Ausgabe bs}     \end{struktogramm}     \end{document}      So far, the output looks like this: ![output-of-code- above](http://i.stack.imgur.com/GCCuC.png) With the minipage environment suggested in one of the answers, it looks like this: ![minipage](http://i.stack.imgur.com/SQbjk.png) EDIT: Added the actual part of the code. Sorry for the inconvenience of my bad example.


title: TikZ: position text along path

text: I'm trying to position a piece of text at a certain position along a multi- part path. Here's what I have been trying so far.               \documentclass[tikz]{standalone}          \usepackage{tikz}     \usetikzlibrary{decorations.markings}          \begin{document}     \begin{tikzpicture}[inner sep=0pt, outer sep=0pt]       \path[fill=red,even odd rule, postaction={decorate},decoration={markings,mark=at position .2 with {\node (0,20) {my text};}}] (0,0) -- (5,5) -- (5,0);     \end{tikzpicture}     \end{document}      I would like the node to be rotated so that the text is aligned with the path at the position of the node. I can of course manually rotate the node, but I would like this to happen automatically. **Please Note:** I know about `decorations.text`, which could achieve what I'm trying to do. The problem here is that I would need to specify exactly at which relative position the text should appear (for example at 20% of the path length). If you know a way how to achieve this using `decorations.text` - please go ahead and compile an answer. Otherwise, I'll stick with this node marking hack.


title: Onecolumn vs. Twocolumn: spuriously different header spacing

text: In the following example, there's a spurious space in the one-column variant. The problem seems to be that in two-column mode, the `\section` command is at the "beginning of a column" and no space is inserted before, while in the one- column variant, there's a content before the `\section` which makes the standard before-section skip to be inserted. How to remove the space in the one-column case? (Remark: `multicol` is not an option.)               \documentclass{article}          \usepackage{lipsum}     \usepackage[latin]{babel}          \long\def\Xonecolumn#1{%     \vbox{\parindent0pt\relax#1\vspace{1ex}}%     }          \long\def\Xtwocolumn#1{\twocolumn[%     \vbox{\parindent0pt\relax#1\vspace{1ex}}%     ]}          \let\Xcolumn\Xonecolumn     %\let\Xcolumn\Xtwocolumn          \begin{document}          \Xcolumn{{\Large In the real case, here is a title, authors, an abstract and so on and so forth\par}     \rule[1ex]{\linewidth}{0.4pt}}          \section{My first section}          \lipsum          \end{document}


title: Would using LaTex instead of LibreOffice benefit me for writing my dissertation?

text: I am a complete LaTeX/TeX novice. I know nothing about it and have never used it. I have been reading about it today as it was been recommended to me but I can't work out if it is suitable for my use case. I am still in the planning stages of writing a dissertation for a Masters degree which will be between 10k and 15k words long. This will include various chapters (thusly a 'Contents'), many citations, and hopefully quite a few images/figures/tables for illustration, (likely an Appendix also). I am writing my proposal at present in LibreOffice, I have to submit it in a Microsoft Word format and LibreOffice can read/write using the MS Word file format. The same is true of the final dissertation document. LaTeX sounds amasing and I would like to use it for my dissertation (most notably I am under the impression it will manage my citation for me, so I don't have to keep renumbering them when inserting new ones). After reading this question and this question, in particular, all I am worried about before I potentially waiste a lot of time learning LaTeX only to find I can't use it is;   * Is it easy to export to an MS Word format?   * Apparently support for images is "flaky", can anyone quantify this, or has it improved?   * Can anyone think of anything I have potentially overlooked for writing such a large document? **UPDATE** The subject is computer networking. There will be some use of formulae and superscript but it will be minimal. I don't want to produce an overly- colourful multi-font document. I want it to be easy to read, one font, one consistent size, standard alignment throughout; Like an RFC document but with some bold text here and there for titles and the ability to insert images.