title: How to create such a chapter style

text: I've been trying to create the chapter style shown in the image using `memoir` class but no luck with that. Can anyone help me out?![enter image description here](http://i.stack.imgur.com/CF5jp.jpg)


title: Notation for multivariate normal

text: I would like to find a good notation and LaTeX way to depict a multivariate normal with a specific covariance matrix (ie. not a generic sigma). Here is my attempt, which compiles but does not look very pretty (although I do not know why specifically). Is there a better or more conventional way?               \documentclass[english]{article}     \usepackage[T1]{fontenc}     \usepackage[latin9]{inputenc}     \usepackage{amsmath}     \usepackage{babel}     \begin{document}          \begin{eqnarray*}     \begin{pmatrix}W_{1}\\     W_{2}\\     \epsilon     \end{pmatrix} & \sim & N\left[\left(\begin{array}{c}     0\\     0\\     0     \end{array}\right),\left(\begin{array}{ccc}     3 & d & d\\     d & 1 & d\\     d & d & 1     \end{array}\right)\right]\\     Z & = & W_{1}^{3}+\epsilon     \end{eqnarray*}          \end{document}      It compiles as follows: ![enter image description here](http://i.stack.imgur.com/3txts.png)


title: Aligning vdots with terms in a system of equations

text: I am attempting to write a system of linear equations that looks like this:               A_{11}x_1 + A_{12}x_2 + \cdots + A_{1n}x_n = y_1     A_{21}x_1 + A_{22}x_2 + \cdots + A_{2n}x_n = y_2     \vdots      \vdots               \vdots      \vdots     A_{m1}x_1 + A_{m2}x_2 + \cdots + A_{mn}x_n = y_m      where the vdots are centered on the terms rather than the equal sign. Here is my attempt:               \documentclass{report}     \usepackage{amsmath}     \begin{document}          \begin{align*}     &A_{11}x_1& + &A_{12}x_2& + \cdots + &A_{1n}x_n& = &y_1& \\     &A_{21}x_1& + &A_{22}x_2& + \cdots + &A_{2n}x_n& = &y_2& \\     &\vdots&  &\vdots& &\vdots& &\vdots& \\     &A_{m1}x_1& + &A_{m2}x_2& + \cdots + &A_{mn}x_n& = &y_m& \\     \end{align*}          \end{document}      Anyone have an elegant solution? EDIT. Here is a second attempt, using the better-suited `array` environment. It looks better, but still unnatural.               \documentclass{report}     \begin{document}          \[\begin{array}{ccccccccc}     A_{11}x_1 & + & A_{12}x_1 & + & \cdots & + & A_{1n}x_n & = & y_1 \\     A_{21}x_1 & + & A_{22}x_2 & + & \cdots & + & A_{2n}x_n & = & y_2 \\     \vdots    &   & \vdots    &   &        &   & \vdots    &   & \vdots \\     A_{m1}x_1 & + & A_{m2}x_2 & + & \cdots & + & A_{mn}x_n & = & y_m \\     \end{array}\]          \end{document}      Is there any way to have the vdots aligned like this but make the equations look normal?


title: Need help with multicolumn error

text: I am having difficulties with what I assume to be a simple issue. I'm in the process of learning LaTeX, and currently having STATA output most of my LaTeX code, which I then insert into TeXworks in order to generate PDFs. Whenever I try to output this specific code, I receive the error: > "File ended while scanning use of \multicolumn." Here is the code I am using:               \documentclass{article}     \begin{document}     \begin{table}[htbp]\centering     \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}     \caption{Closing Date Effects}     \begin{tabular}{l*{1}{cc}}     \hline\hline                         &\multicolumn{2}{c}{(1)}           \\                             &\multicolumn{2}{c}{Voter Turnout (%)}\\     \hline     Registration Closing Date&      -0.226\sym{**} &     (0.001)\\     Southern State      &      -8.900         &     (0.142)\\     Close x South (Interaction)&      0.0928         &     (0.674)\\     Constant            &       77.20\sym{***}&     (0.000)\\     \hline     Observations        &          51         &            \\     \hline\hline     \multicolumn{3}{l}{\footnotesize \textit{p}-values in parentheses}\\\     \multicolumn{3}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \                  (p<0.001\)}\\     \end{tabular}     \end{table}     \end{document}      My best guess has been that I'm missing some braces in the `\multicolumn` sections, but I can't find where. I thought perhaps on the last line:               \multicolumn{3}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \                      (p<0.001\)}\\      But no matter the number of braces I use, it still errors out.


title: Vertical alignment of text within a table cell

text: How can I move the text in the following table closer to the upper rule (or closer to the lower rule) without changing row height:               {\halign     {#\cr     \hrulefill\cr     \font\f=cmr8\f(bla bla bla)\cr     \hrulefill\cr}}      ![enter image description here](http://i.stack.imgur.com/w7vkh.png) I'm looking for a solution with plain TeX. **UPDATE** (what I am trying to achieve) I am trying to center a couple of words in the right-hand side of the text area of a page, below row baseline and in tiny font size (7-8pt is OK). To accomplish this, I set up a table with two columns where each column takes up half of the text area, decreased font size and centered the text in the right half of a row. (I am using a table because there are other texts above and below this one which should start at the middle of the row. Also, there are texts that should start at the beginning of certain lines but none of these texts need to go beyond the middle of the page. All this was easy to achieve with a table.) Next, I thought the area right below the baseline was probably not enough for 7-8pt letters so I decided to put the tiny text in the upper part of next row, preferably without changing the height of this row. I tried `\vskip` but I was not able to make it do what I want. I have not examined all suggestions yet but `\raise` does not seem to be what I am looking for, as it changes row height. **UPDATE 2** (details and a sketch) Grey lines in the sketch below mark cell borders; they are only shown as a hint at document layout and should not exist in the final document. Black horizontal lines indicate fill-in blanks and should exist in the final document at the baseline (actually, I will decide whether I want them at the baseline or slightly below it but for now let's assume they are at the baseline). Texts in parentheses indicate what is to be filled-in in the blanks above them. What I am trying to achieve is to place each of the parenthesized texts below the corresponding fill-in blank, centered according to the length of the blank. P.S. For the curious, "дата" means date, "гр." stands for city, "декларатор" means declarant, "подпис" means signature, "име и фамилия" means first and last name. ![enter image description here](http://i.stack.imgur.com/C5h49.png)


title: Moving minipage on page to flush right with text

text: I would like to place a box on _every_ page of my LaTeX document that does not interfere with the typesetting of the rest of the document, and found that the watermark packages are suitable for the task; e.g., xwatermark. Specifically, I would like to insert a framed minipage such that its right border coincides with the right border of the text body. Considering the LaTeX page layout, I tried               \documentclass{article}          \usepackage{lipsum}          \newlength\xshift     \setlength\xshift{0.5\paperwidth}     \addtolength\xshift{-\marginparwidth}     \addtolength\xshift{-\marginparsep}     \addtolength\xshift{-1.0in} % half the minipage width     \addtolength\xshift{-1pt} % frame width          \usepackage{xcolor}     \usepackage[printwatermark]{xwatermark}     \newwatermark[     pages=1,     color=black,     scale=1,     xpos=\xshift,     ypos=0.0in     ]{%       \fbox{%       \begin{minipage}{2.0in}\normalsize%         my awesome minipage\\         my awesome minipage\\         my awesome minipage       \end{minipage}%     }%     }          \begin{document}          \lipsum[1-4]          \end{document}      which results in ![wrong flushing](http://i.stack.imgur.com/EjVpK.png) What might be the cause of the problem? Is there another package that is better suited?


title: Trying to make japanese characters appear in the title of a section

text: I have the following in my TeX:               \subsection{Buch 1 問題の日本語}      In my Table of Contents it is correctly displayed but in the subsection itself you can only see `1.1 Buch 1`. I guess this is because the subsection title is bold in the main text and the Table of Contents text is not. Some kind of solution to this to force the `問題の日本語` part not to be **bold**? Minimal working example: (use XeLatex)               \documentclass[12pt]{scrartcl}          \usepackage{xltxtra}      \usepackage[ngerman]{babel}     \usepackage{setspace}     \onehalfspacing     \setmainfont[ItalicFont=Arial Kursiv]{Arial Unicode MS}           \begin{document}     \tableofcontents          \section{bla}     \subsection{Buch 1 問題の日本語}          \end{document}


title: Presentation using beamer

text: Using `beamer` I have prepared the following slide. I want to display the theorem in a box or like that for better presentation. Also title heading is left align. Is it ok or not?               \begin{frame}{Chinese Remainder Theorem(CRT)}          \begin{theorem}           Let $r, s$ be integers such that gcd$(r, s)=1$.      Given integers $a,b$, there exists unique      $x <rs$ such that           \vspace*{5pt}     \begin{enumerate}     \item $x \equiv a \bmod r$      \item $x \equiv b \bmod s$     \end{enumerate}          \end{theorem}           \end{frame}


title: Tikz, Tree without overlaps

text: I'm trying to get a nice tree without the overlaps, can anyone help me to improve my code?               \documentclass{standalone}     \usepackage{amssymb}     \usepackage{amsmath}     \usepackage[utf8]{inputenc}     \usepackage[T1]{fontenc}     \usepackage{dsfont}     \usepackage{tikz}     \usetikzlibrary{shapes}     \usetikzlibrary{graphs}          \begin{document}           \begin{tikzpicture}[baseline,level/.style={level distance=20mm, sibling distance =35mm/#1},scale=1]             \node [ellipse split, draw] {$s_1<s_2$\nodepart{lower}\tiny $(s_1,s_2,s_3,s_4)$}                 child{ node [ellipse split, draw] {$s_1<s_2$\nodepart{lower}\tiny $(s_1,s_2,s_3,s_4)$}                     child{ node [ellipse split, draw] {$s_1<s_2$\nodepart{lower}\tiny $(s_1,s_2,s_3,s_4)$}                         child{ node [rectangle, draw] {$(s_1,s_2,s_3,s_4)$}}                         child{ node [ellipse split, draw] {$s_1<s_2$\nodepart{lower}\tiny $(s_1,s_2,s_3,s_4)$}                             child{ node [rectangle, draw] {$(s_1,s_2,s_3,s_4)$}}                             child{ node [ellipse split, draw] {$s_1<s_2$\nodepart{lower}\tiny $(s_1,s_2,s_3,s_4)$}                                 child{ node [rectangle, draw] {$(s_1,s_2,s_3,s_4)$}}                                 child{ node [rectangle, draw] {$(s_1,s_2,s_3,s_4)$}}                             }                         }                     }                        child{ node [ellipse split, draw] {$s_1<s_2$\nodepart{lower}\tiny $(s_1,s_2,s_3,s_4)$}                         child{ node [ellipse split, draw] {$s_1<s_2$\nodepart{lower}\tiny $(s_1,s_2,s_3,s_4)$}                             child{ node [rectangle, draw] {$(s_1,s_2,s_3,s_4)$}}                             child{ node [ellipse split, draw] {$s_1<s_2$\nodepart{lower}\tiny $(s_1,s_2,s_3,s_4)$}                                 child{ node [rectangle, draw] {$(s_1,s_2,s_3,s_4)$}}                                 child{ node [ellipse split, draw] {$s_1<s_2$\nodepart{lower}\tiny $(s_1,s_2,s_3,s_4)$}                                     child{ node [rectangle, draw] {$(s_1,s_2,s_3,s_4)$}}                                     child{ node [rectangle, draw] {$(s_1,s_2,s_3,s_4)$}}                                 }                             }                         }                         child{ node [ellipse split, draw] {$s_1<s_2$\nodepart{lower}\tiny $(s_1,s_2,s_3,s_4)$}                             child{ node [rectangle, draw] {$(s_1,s_2,s_3,s_4)$}}                             child{ node [ellipse split, draw] {$s_1<s_2$\nodepart{lower}\tiny $(s_1,s_2,s_3,s_4)$}                                 child{ node [rectangle, draw] {$(s_1,s_2,s_3,s_4)$}}                                 child{ node [ellipse split, draw] {$s_1<s_2$\nodepart{lower}\tiny $(s_1,s_2,s_3,s_4)$}                                     child{ node [rectangle, draw] {$(s_1,s_2,s_3,s_4)$}}                                     child{ node [rectangle, draw] {$(s_1,s_2,s_3,s_4)$}}                                 }                             }                         }                     }                 };         \end{tikzpicture}     \end{document}


title: Can I specify the path to biblatex annotation files

text: The `biblatex` package allows you to write annotations to your bibliography as external files. I use those annotations to keep notes associated to the papers I read for my thesis. Unfortunately, since the annotation of each bibliography entry has to be in a separate file, my TeX source directory gets quite cluttered. It would therefore be preferable if all annotations were in a separate directory but I cannot find a way to tell `biblatex` where to look for them. So my question is the following: Is there any way to tell `biblatex` to look for the annotation files in a directory different from the current one?


title: The quote environment and the typographically correct notation of reference

text: This is a typography and latex related question. I have seen various examples of how the `quote` environment and the belonging reference to the quote are used. What is correct in the following minimum working example:               \documentclass{article}               \usepackage{natbib}     \expandafter\def\expandafter\quote\expandafter{\quote\small}          \begin{document}               \begin{quote}     I'm a fuel-injected suicide machine! I am a rocker, I am a roller,      I am an out-of-controller! \citep[p.~123]{Nightrider1979}     \end{quote}          or          \begin{quote}     I'm a fuel-injected suicide machine! I am a rocker, I am a roller,     I am an out-of-controller \citep[p.~123]{Nightrider1979}!     \end{quote}          or          \begin{quote}     I'm a fuel-injected suicide machine! I am a rocker, I am a roller,     I am an out-of-controller! \citet[p.~123]{Nightrider1979}     \end{quote}          or          \begin{quote}     I'm a fuel-injected suicide machine! I am a rocker, I am a roller,     I am an out-of-controller!      \end{quote} \citep[p.~123]{Nightrider1979}          or          \begin{quote}     I'm a fuel-injected suicide machine! I am a rocker, I am a roller,     I am an out-of-controller!      \end{quote} \citet[p.~123]{Nightrider1979}               \bibliographystyle{plainnat}     \bibliography{./quote}               \end{document}      Please use the following bibtex file saved as quote.bib in the same directory:               @ARTICLE{Nightrider1979,       author = {Crawford "Nightrider" Montizano},       title = {Member of Toecutter's gang},       journal = {Mad Max},       year = {1979}     }      I think whether an author wants to indent the whole `quote` environment, change the font size or put the quote in quotation marks is up to the individual style. I just wondered about the punctuation and the position and style of the reference.


title: 11pt option messes up figure put in with bpchem in articleclass nih

text: I am working on a proposal for a class. I am using the documentclass `nih`. I put in figures of chemical structures using `bpchem` (see example). When I just use `\documentclass{nih}`, everything works fine, but the font is tiny. If I use `\documentclass[11pt]{nih}`, the structuctures are messed up (see screenshots). How can I fix this/ is there a workaround?               \documentclass[11pt]{nih}      \usepackage[runs=2]{auto-pst-pdf}     \usepackage{bpchem}     \usepackage[journal=rsc, tracking=bpchem]{chemstyle}     \usepackage[version=3]{mhchem}          \begin{document}          \begin{figure}         \begin{center}             \schemeref[TMP]{spermine}             \schemeref[TMP2]{cb6}             \includegraphics{structures.eps}         \end{center}     \end{figure}          \CNlabelnoref{spermine}     \CNlabelnoref{cb6}          \end{document}       What it looks like with `[11pt]`: ![11pt](http://i.stack.imgur.com/yGthv.png) What it is supposed to look like/ looks like with only `\documentclass{nih}`: ![without 11pt](http://i.stack.imgur.com/x04kX.png)


title: Proper use of \mathchoice

text: I am trying to learn how to use `\mathchoice`. Before the solution was posted for Non-invasive replacement for \fbox?, I attempted to use `mathchoice` to adjust the size of the parameter before measuring its height, depth and width. To simply things, I first defined:               \newcommand{\SetHeightDepthWidth}[1]{%                   \settoheight{\fillbox@height}{#1}%            \settodepth{\fillbox@depth}{#1}%              \settowidth{\fillbox@width}{#1}%          }%      Then adjusted the beginning of the `\fillbox` macro as:               \newcommand{\fillbox}[1]{%       \ifmmode%                                                      \mathchoice%                                                     {\SetHeightDepthWidth{$\displaystyle#1$}}%                   {\SetHeightDepthWidth{$\textstyle#1$}}%                      {\SetHeightDepthWidth{$\scriptstyle#1$}}%                    {\SetHeightDepthWidth{$\scriptscriptstyle#1$}}%        \else%                                                         \SetHeightDepthWidth{#1}%                                  \fi%                                                        Before these changes, the output was: ![enter image description here](http://i.stack.imgur.com/A6kgN.png) But with the above changes I get: ![enter image description here](http://i.stack.imgur.com/TpTEE.png) So, what happened? To me it appears to be some problem related to the grouping due to the extra brace groups required to pass in the four parameters to `\mathchoice`, but don't know how to fix it. Does `\mathchoice` behave differently than many of the other types of conditional macros such as `\iftoggle{condition}{code if true}{code if false}` from the `etoolbox` package? ## Code: The new code is marked and the old code is left commented to simplify comparison.               \documentclass{article}     \usepackage{tikz}          \makeatletter       \newlength\fillbox@height%       \newlength\fillbox@depth%       \newlength\fillbox@width%       \newcommand{\SetHeightDepthWidth}[1]{%   new           \settoheight{\fillbox@height}{#1}%   new           \settodepth{\fillbox@depth}{#1}%     new           \settowidth{\fillbox@width}{#1}%     new       }%            \newcommand{\fillbox}[1]{%       \ifmmode%                                             new         \mathchoice%                                        new             {\SetHeightDepthWidth{$\displaystyle#1$}}%      new             {\SetHeightDepthWidth{$\textstyle#1$}}%         new             {\SetHeightDepthWidth{$\scriptstyle#1$}}%       new             {\SetHeightDepthWidth{$\scriptscriptstyle#1$}}% new       \else%                                                new         \SetHeightDepthWidth{#1}%                           new       \fi%                                                  new       %\ifmmode%       %  \settoheight{\fillbox@height}{$#1$}%       %  \settodepth{\fillbox@depth}{$#1$}%       %  \settowidth{\fillbox@width}{$#1$}%       %\else%       %  \settoheight{\fillbox@height}{#1}%       %  \settodepth{\fillbox@depth}{#1}%       %  \settowidth{\fillbox@width}{#1}%       %\fi%       \raisebox{-\fillbox@depth}{%         \begin{tikzpicture}[scale=1]         \pgfsetfillcolor{yellow!90!red}         \pgfsetfillopacity{0.5}         \pgfsetrectcap         \fill (0,-\fillbox@depth) rectangle (\fillbox@width,\fillbox@height);         \pgfsetfillcolor{yellow!50!black}         \pgfsetfillopacity{1}         \fill (0,-\fillbox@depth)               rectangle (\fillbox@width,-\fillbox@depth+.1pt);         \fill (0,\fillbox@height)               rectangle (\fillbox@width,\fillbox@height-.1pt);         \fill (0,-\fillbox@depth)               rectangle (.1pt,\fillbox@height);         \fill (\fillbox@width,-\fillbox@depth)               rectangle (\fillbox@width-.1pt,\fillbox@height);         \end{tikzpicture}%         \kern-\fillbox@width%       }%       #1%     }     \makeatother          \begin{document}          \vskip1em     $\fillbox{p}_{\fillbox{x}}       \mathrel{\stackrel{\fillbox{_{~+}}}{\fillbox{\leftarrow}}}       \fillbox{(}\fillbox{\frac{\fillbox{1}}{\fillbox{2}}}\fillbox{\cdot}       \fillbox{a}_{\fillbox{x}}\fillbox{\cdot}%       \fillbox{\Delta}\fillbox{t}^{\fillbox{2}}\fillbox{)} \fillbox{+}       \fillbox{(}\fillbox{v}_{\fillbox{x}}\fillbox{\cdot}%       \fillbox{\Delta}\fillbox{t}\fillbox{)}$\fillbox{;}\par     $\fillbox{v}_{\fillbox{x}}       \mathrel{\stackrel{\fillbox{_{~+}}}{\fillbox{\leftarrow}}}       \fillbox{a}_{\fillbox{x}}\fillbox{\cdot}%       \fillbox{\Delta}\fillbox{t}$\fillbox{;}\par     %         %            This section is not relevant to the problem here.     %\vskip1em     %$p_x \mathrel{\stackrel{_{~+}}{\leftarrow}}     %  (\frac{1}{2}\cdot a_x\cdot\Delta t^2) + (v_x\cdot\Delta t)$;\par     %$v_x \mathrel{\stackrel{_{~+}}{\leftarrow}} a_x\cdot\Delta t$;\par     %     \end{document}


I would like to implement macros to generate multiple tables in a document. Some inspiration comes from here: usage-of-longtable-or-equivalent-and- pgfplotstabletypeset The input `csv` file and generated tables should contain `chars` and `floats`. A non-macro implementation works ok, for instance to generate a single table I can do the following without a problem:               \documentclass{article}           \usepackage{pgfplotstable}     \usepackage{array}     \usepackage{booktabs}     \usepackage{longtable}     \usepackage{etoolbox}          \begin{filecontents*}{test.csv}         A,B,C         0,0,T         1,1,T         2,2,T         3,3,T         4,4,T         5,5,T     \end{filecontents*}     \pgfplotstableset{         begin table=\begin{longtable},         col sep=comma,         string type,         columns={A,B,C},         columns/A/.style={int detect,column name=A},         columns/B/.style={int detect,column name=B},         columns/C/.style={int detect,column name=C},         every head row/.style={before row=\toprule,after row=\midrule\endhead},         every last row/.style={after row=\bottomrule},         end table=\caption{\mycaption}\end{longtable}     }     \begin{document}     \pgfplotstabletypesetfile{test.csv}     \end{document}      The alternative macro route works if the csv file contains only integer/float data, but not when chars are present:               \documentclass{article}           \usepackage{pgfplotstable}     \usepackage{array}     \usepackage{booktabs}     \usepackage{longtable}     \usepackage{etoolbox}     \begin{filecontents*}{test.csv}      A,B,C      0,0,T      1,1,T      2,2,T      3,3,T      4,4,T      5,5,T     \end{filecontents*}          \newrobustcmd{\strtable}[2]{         \pgfplotstableset{         begin table=\begin{longtable},         end table=\caption{#2}\end{longtable}         }         \pgfplotstableset{columns={A,B,C}}         \pgfplotstableset{columns/A/.style={int detect,column name=A}}         \pgfplotstableset{columns/B/.style={int detect,column name=B}}         \pgfplotstableset{columns/C/.style={int detect,column name=C}}              \pgfplotstableread[col sep=comma, string type]{#1}\strtable              \begin{center}             \pgfplotstabletypeset[                 every head row/.style={before row=\toprule,after row=\midrule\endhead},                     every last row/.style={after row=\bottomrule},                 ]\strtable         \end{center}     }     \begin{document}        \strtable{test.csv}{test}     \end{document}      Unfortunately when I run the preceding macro things grind to a halt:               ! Package PGF Math Error: Could not parse input 'T' as a floating point number,      sorry. The unreadable part was near 'T'..      For some reason the csv file is parsed differently in the two cases and trouble arises in the second. I've experimented with the placement of the terms and looked through the `pgfplotstable` documentation without much luck. How to implement the macros style with mixed chars and floats in a csv file?


title: epigraph using \textit

text: I have created epigraph in my book using the latex command `\epigraph`. I would use `\textit` style but I got an epigraph that not follow the margin. when I use `\textit` it became squeezer This is what I mean: ![enter image description here](http://i.stack.imgur.com/Xn5aA.png) I would that epigraph should be big as the line


title: How to left align a set of equations.

text: I wanted to left align a set of equations. I've tried the solution provided in aligning to the left. It worked. But, I wanted to have a single equation number for the entire `flalign` in order to refer to it later. Like in case of `equation+split`. While using `equation+align`, I am able to get it. But, if I use `equation+flalign` the equations are still being centered. Is there a way to do it? Example using `equation+align`,               \begin{equation}          \begin{align}           \mbox{Minimize } & x_1+x_2+x_3 \\           \mbox{Subject to} & \\            & x_1+x_2 \leq 10 \\            & x_2+x_3 \leq 8 \\            & x_1+x_3 \leq 5           \end{align}     \end{equation}      I would like to do this while the equations are left aligned. It will be even better if the equations can be spaced a little (for example, 1 cm) from the left margin instead of starting from the left margin. Thanks in advance


title: Aligning equations to the left in latex

text: I am writing some equations in latex with               \begin{dmath}     equation     \end{dmath}      By default the equations are centered. I want to align the equations to start from the left of the page. How can I do it?


title: how to left-align equations

text: > **Possible Duplicate:**   >  How to left align a set of equations. I want to write an equation in latex , the code is :                  \begin{align*}       \log (\sigma_{t}(X)) =&\log( \prod_{x \in X} \frac{1}{1-xt}) \\                 &= \sum_{x \in X} log(\frac{1}{1 - xt}) \\                 &= - \sum_{x \in X} log(1 - xt) \\                 &= - \sum_{x \in X} \sum_{n \geq 1} (-1)^{n+1} \frac{(- xt)^{n}}{n} \\                 &= \sum_{x \in X} \sum_{n \geq 1} \frac{x^{n}t^{n}}{n} \\                 &= \sum_{n \geq 1} \sum_{x \in X}  \frac{x^{n}}{n} t^{n} \\                 &= \sum_{n \geq 1} \frac{P_{n}(X)}{n} t^{n}      \end{align*}      How to align left the equation ?


title: Automatically shrinking a matrix

text: I'm wondering about a way to automatically shrink down a matrix. I can think of `\arraycolsep` command for the column width but I am not aware of an equivalent command for the height of the lines? Should the whole matrix environment be redefined to allow this?


title: Alphabetically display the items in itemize

text: I am wondering whether it is possible to display the items alphabetically regardless of the order we type on the backend? For example I am using itemize as follows:               \begin{itemize}         \item ISDYNSTP:  Is dynamic time step used?         \item ISCDCA:         \item MVAR         \item IS2TL_     \end{itemize}      But I want to display the items in the alphabetical order. I don't know whether it is possible or not. I have like hundreds of itemize items. Actually I am trying to create a glossary for the different parameters.


title: Supress space introduced by drawing borders of nodes with tikz

text: When borders around a rectangular node is drawn, some space is also added, as can be seen by the example below.               \documentclass{article}     \usepackage[papersize={70mm,34mm}]{geometry}     \usepackage{tikz}          \tikzset{       boxdraw/.style={very thick,rounded corners,fill=yellow!30, },     }          \newcommand{\firstline}[1]{%       \noindent       \begin{tikzpicture}         \node[text width=\linewidth](p){#1};         \draw[boxdraw] (p.south west) -- (p.north west) -- (p.north east) -- (p.south east);         \node[text width=\linewidth]{#1};       \end{tikzpicture}%       \newline     }          \newcommand{\middleline}[1]{%       \noindent       \begin{tikzpicture}         \node[text width=\linewidth,fill=yellow!30](p){#1};         \draw[boxdraw] (p.north west) -- (p.south west) (p.north east) -- (p.south east);       \end{tikzpicture}%       \newline     }          \newcommand{\lastline}[1]{%       \noindent       \begin{tikzpicture}         \node[text width=\linewidth](p){#1};         \draw[boxdraw] (p.north west) -- (p.south west) -- (p.south east) -- (p.north east);         \node[text width=\linewidth](p){#1};       \end{tikzpicture}%     }          \splittopskip 0pt     \baselineskip 0pt     \lineskiplimit 0pt     \lineskip 0pt          \begin{document}          \firstline{This is the first line}     \middleline{and this is my second line}     \middleline{followed by another middle line}     \lastline{followed by this one last line.}          \end{document}      ![with spaces](http://i.stack.imgur.com/1jyEZ.png) Look at the space between the lines. If the line                   \draw[boxdraw] (p.north west) -- (p.south west) (p.north east) -- (p.south east);      (which draws the border around the rectangle node) is commented out in the definition of `\middleline`, the space between middle lines are not present. ![without spaces](http://i.stack.imgur.com/QCubD.png) How can these spaces be completely removed while keeping the borders? EDITED: **A brief explanation of the purpose of these macros** I am trying to write a package for boxes that may break across pages. I know there are already some packages for that (like `mdframed` and `tcolorbox`), but most of them fail to break inner boxes in nested boxes. With nested boxes, only the outermost box can be breakable. That is due to the algorithm they implement for breaking boxes. I want to overcome this issue by using a different splitting algorithm, based on the one employed by the `boites` package. The algorithm I am going to use first gets the contents of the breakable box into a `vbox`. Then the `vbox` is split into its individual lines. Then each line receives a background colour and a frame. The macros `\firstline`, `\middleline` and `\lastline` would be used to give a background colour and a frame to each of those lines. Because of framing, I will need one macro for the first line of the breakable box, one for middle lines, and one for the last line.


title: Modifying labels on some enumerated items

text: In an `enumerate` environment, I want a few (not all) of the items to have asterisks which appear _before_ the number (I don't feel strongly about whether the number or the asterisk is horizontally aligned with the other numbers). Is there a less crufty way to do this than, say, using multiple lists (or -- horrors -- numbering manually)? I'm already using `enumitem` for an unrelated purpose, if that helps, although I didn't find a solution after a quick skim of its manual.


title: Insert a symbol before the item

text: I'm preparing a guide for my students and I want to put a symbol before the item’s symbol in the enumeration of the exercises for indicate that this exercise is more difficult, very similar that the math's books. For example:   1. blah   2. blah (*)3. blah


title: different labels for enumerate environment?

text: How can I use enumerate environment to generate something like this: 1) some text 2*) some text 3) some text


title: \newline in p-column with extra vertical space?

text: I need to add some vertical space between two lines in a `p`-column of a `tabular`. Outside of a table I'd use `\\\\[1ex]`, but inside of a table I have to use `\newline` which doesn't have an optional argument for extra vertical space. So how can I get the vertical space?


title: How to install "TeX Gyre Schola" font for MiKTeX?

text: I've followed the guide: http://www.tug.org/fonts/fontinstall.html and downloaded the font files from: http://www.ctan.org/tex-archive/fonts/tex- gyre/ Now there are 72 `.map` files under the `map` folder of `tex-gyre` folder. What is the correct `.map` file should I use for `Map newfont.map` * * * Second question is: For some fonts, there is only one `.map` file, so I didn't have problem to run `initexmf` command. But after follow all the steps in tug's guide, it still does not work properly. Is there anything besides the guide? (All font files I downloaded contains "tex" and "fonts" two folders, I just put it in a single folder and renamed it after the font's name. Then update the MiKTeX follows the guide. (Anything wrong so far?) The font installation really drives me crazy...


title: How can I get gedit to compile pdf on mac

text: I just got a macbook air (the version right before the current one) and I have MacTex installed and I have the latex plugin for gedit. How can I get gedit to compile pdf for me? Before on ubuntu I just hit ctrl + alt + 1 and it worked but nothing is happening now. Though, I can use texshop but I prefer gedit due to the black background.


title: Creating several rulers with TikZ

text: I am trying to draw 14-meters worth of centimeter-scale rulers, one meter at a time. I hope to print these in adhesive paper to measure something, but that's neither here nor there. So far I have this code running (MWE) which yields one-meter worth of ruler. I've attached an image of about 22-cm of lenght.               \documentclass[12pt]{standalone}          \renewcommand*\familydefault{\sfdefault}                \renewcommand\familydefault{\sfdefault}      \usepackage[T1]{fontenc}          \usepackage{tikz}               \begin{document}          \begin{tikzpicture}           % \foreach \i in {0,100,...,130}            % Draw Minor tick lines            \foreach \x in {99,97,...,1}       \draw [color=red, line width=6mm](\x cm,0cm) -- (\x cm ,1.5cm)        node[color=red, rotate=90, anchor=west] {\x};               \foreach \x in {100,98,...,0}       \draw [color=black, line width=6mm](\x cm,0cm) -- (\x cm ,1.5cm)        node[color=black, rotate=90, anchor=west] {\x};            Draw Major tick lines            \foreach \x in {100,90,...,0}       \draw [color=black,line width=6mm] (\x cm,4cm) -- (\x cm ,0cm)       node[anchor=north] {\Huge \textbf{\x}};                 \foreach \x in {95,85,...,5}       \draw [color=red, line width=6mm] (\x cm,4cm) -- (\x cm ,0cm)       node[anchor=north] {\Huge \textbf{\x}};           % Draw main axis     %  \draw [line width=6mm](0cm, \i cm) -- coordinate (x axis mid) (100cm,\i cm);        \draw [line width=6mm](0cm, 0 cm) -- coordinate (x axis mid) (100cm, 0 cm);                     \end{tikzpicture}                \end{document}      I am facing a few problems.   1. I need the numbers to increase from right to left. Right now they are increasing from left to right, despite my specifying the `\foreach` sequence in decreasing order. How do I accomplish this?   2. The ends of the rulers are not mitered. I tried using the `join=miter` option in the `\draw` command, to no effect.    3. Finally, how do I use the `\foreach` command (if at all) to go from having a single ruler to having fourteen rules stacked vertically, with the right numbering. I managed to accomplish repeating the ruler axis (as you can see commented on the code) but kept getting horrible errors when I tried to do the same with the tick marks and nodes.  There are other things that I can live with, like having the overlapping minor tick mark numbers painted over by the major tick marks, but knowing how to specify the right conditionals to prevent this would be great. ![Centimeter-scale ruler](http://i.stack.imgur.com/l9Aas.png)


title: DeclareDocumentEnvironment: missing control sequence inserted -- \inaccessible

text: I'm setting up a skeleton CV package for a friend for him to customize, and I'd like to make it as user-friendly as possible. To effect this, I'm using `keyval` and `xparse`.               \begin{filecontents}{setup.sty}       \RequirePackage{xparse}       \RequirePackage{keyval}       \define@key{position}{title}  {\def{\position@title}  {#1}}       \define@key{position}{date}   {\def{\position@date}   {#1}}       \define@key{position}{company}{\def{\position@company}{#1}}       \define@key{position}{place}  {\def{\position@place}  {#1}}       \DeclareDocumentEnvironment{position}{m}{%         \begingroup         \IfNoValueTF{#1}         {\setkeys{position}{title={},date={},company={},place={}}}         {\setkeys{position}{title={},date={},company={},place={},#1}}              \begin{description}         \item[Title]   \position@title         \item[Date]    \position@date         \item[Company] \position@company         \item[Place]   \position@place         \end{description}         \endgroup       }{}     \end{filecontents}     \documentclass{article}     \usepackage{setup}          \begin{document}     \begin{position}{title=hello}       Hey     \end{position}     \end{document}      This, to me, seems like a fairly standard use of `xparse` and `keyval`, so I'm likely to be missing something rather plain and Read-The-Fine-Manual-y, but I can't find any errors and the error message is still cryptic to me -- I've never gotten it before. Here is the error message in all of its glory: > >     ERROR: Missing control sequence inserted. >   >     --- TeX said --- >     <inserted text> >                     \inaccessible >     l.55 \begin{position}{title=hello} >   >     --- HELP --- >     This is probably caused by a \newcommand, \renewcommand, \newlength, >     or \newsavebox command whose first argument is not a command name. >   What is going on here, and how can I make TeX happy again? By the way, if anyone would care to give the equivalent `xkeyval` solution in their answer, I'm always happy to learn something new :-). * * * I've been spoiled a little by AUCTeX; there are more errors available in the log file that are perhaps more helpful:               ... style imports ...     ! Missing control sequence inserted.     <inserted text>                      \inaccessible      l.56 \begin{position}{title=hello}          ! Missing control sequence inserted.     <inserted text>                      \inaccessible      l.56 \begin{position}{title=hello}          ! Missing control sequence inserted.     <inserted text>                      \inaccessible      l.56 \begin{position}{title=hello}          ! Missing control sequence inserted.     <inserted text>                      \inaccessible      l.56 \begin{position}{title=hello}          ! Missing control sequence inserted.     <inserted text>                      \inaccessible      l.56 \begin{position}{title=hello}          ! Undefined control sequence.     \environment position code ...le] \position@title                                                        \item [Date] \position@dat...     l.56 \begin{position}{title=hello}          ! Undefined control sequence.     \environment position code ...ate] \position@date                                                        \item [Company] \position@...     l.56 \begin{position}{title=hello}          ! Undefined control sequence.     \environment position code ...] \position@company                                                        \item [Place] \position@pl...     l.56 \begin{position}{title=hello}          ! Undefined control sequence.     \environment position code ...ce] \position@place                                                        \end {description} \endgroup l.56 \begin{position}{title=hello}     ... see transcript file for additional information, etc. etc. ...


title: Sinuous arrow between nodes

text: I want to draw a sinuous arrow between two nodes. Following the first answer in this thread Easy curves in TikZ I have tried the following code, but the arrow head points to the opposite side... how could I solve it? Thanks!               \documentclass{article}          \usepackage{tikz}          \begin{document}     \begin{tikzpicture}         \node (A) at (0,0) {\includegraphics[scale=.1]{images/presentation/2/cell.png}};         \node (B) at (8,-1) {\includegraphics[scale=.1]{images/presentation/2/cell2.png}};         \draw[->, >=latex, blue, line width=6pt] (A.east) to (B.west);         \draw [->, cyan, line width=3pt] plot [smooth, tension=1] coordinates{ ([yshift=.5cm]A.east) (2,2.5) (4,2) (6,3) ([yshift=.5cm]B.west)}; %this arrow head should point to the other side          \end{tikzpicture}     \end{document}


title: Writing a formula below a matrix

text: I have a matrix environment:               \begin{bmatrix}           ...          \end{bmatrix}      How can I write below that matrix? I tried with `substack`, so I wrote `\end{bmatrix}_{\substack{...}}` That doesn't work as it does with, for example, a sum. How can I write a formula exactly below the matrix? EDIT: Okay, I found out how to do it myself now by using the array environment               \documentclass[a4paper,12pt, oneside]{article}     \usepackage{amsmath,amsfonts,amssymb,amsopn,amscd}          \begin{document}          \begin{equation*}     \begin{array}{c}     A : =     \begin{bmatrix}     x \\     y \\     z \\     a     \end{bmatrix} \\     x=0     \end{array}     \end{equation*}          \end{document}


title: Dynamically applying formatting to regular expressions

text: One useful tool I find in InDesign are the Grep styles. With them, one can define character styles (e.g., boldface in small caps) for whatever expression matches the grep pattern. I know this is quite easy to _statically_ carry this out with the help of most modern text editors — viz., searching for a regex pattern and replacing all matches with the desired code (e.g., `{\bfseries\scshape. . .}` or whatever). But can this be done _dynamically_ in LaTeX? For instance, I would like to tell LaTeX something like the following:               \newregexstyle{^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$}{\bfseries\scshape}      so that all matching expressions (in this case, syntactically valid email addresses) are dynamically formatted in the desired manner. (Yes, I know — there would be a problem here with chars `%`, `@`, `$` and the like. But this is just an example. The syntax should conform to `l3regex`'s rules.) The good thing about dynamically sorting this out is (1) that the coded text looks cleaner (and easier to edit), (2) that when writing the text I should care not for these expressions' styles, and (3) that I can easily change (or even remove) the format at any time without much editing. (I'm thinking here of complex documents with many `\include` and `\input` commands.)


title: Wrapfigure "wrap box" continues onto next page

text: I'm using the wrapfigure environment. When the wrapfigure goes to the bottom of the page, there is blank space included on the next page where the figure would be. The problem is illustrated in the attached figure and mwe. How do I fix this? ![The problem: the caption goes to the end of the page \(fine\), but blank space continues onto the next page \(not cool\)](http://i.stack.imgur.com/n4jZz.png) I have prepared a mwe, but it's not very minimal (needed to be multiple pages to show the problem). If you want to compile this, you'll need to replace the .pdf file with some figure of your choice.               \documentclass[11pt]{article}     \usepackage{placeins}     \usepackage{wrapfig}     \usepackage{graphicx}          \begin{document}          "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur,     adipisci velit..." "There is no one who loves pain itself, who seeks after it     and wants to have it, simply because it is pain..."                    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque et dui quis     velit sollicitudin egestas. Phasellus dictum, libero sed pellentesque pulvinar,     lectus arcu fermentum libero, vel ultricies augue eros vel ligula. Proin tempor     velit id dolor sollicitudin pharetra. Duis consectetur metus et quam congue     commodo vitae et velit. Quisque laoreet nibh ac lorem porta id vulputate lorem     vestibulum. In condimentum nulla convallis orci commodo sit amet scelerisque     tortor dapibus. Nam rhoncus, ipsum ut adipiscing ullamcorper, libero odio     vehicula neque, ut sagittis turpis velit vitae velit. Ut sit amet ipsum ac leo     cursus dictum vel eget augue. Proin non sapien felis. Aenean nec volutpat est.     Morbi feugiat velit sed leo laoreet mattis.          Etiam blandit metus ut dui posuere vehicula. Donec id eros at enim vestibulum     feugiat. Duis quam est, malesuada sagittis porttitor pretium, lacinia vel     augue. Aliquam at eros purus, eu tempus sem. Ut iaculis, augue et accumsan     tempus, sem tortor rhoncus massa, at imperdiet tellus elit eget urna.     Pellentesque risus leo, congue in imperdiet id, interdum id ante. Pellentesque     convallis varius mattis. Suspendisse potenti. In auctor faucibus rhoncus.     Vestibulum scelerisque malesuada metus, eu ultricies urna posuere vel. Etiam in     sem eu mi semper condimentum at eget quam. Nullam libero dolor, tristique eget     tristique id, gravida ut nisi. Nam ornare mi et est hendrerit gravida fringilla     sapien suscipit. Etiam erat purus, porttitor nec bibendum venenatis, elementum     ac urna.          Praesent pulvinar imperdiet ipsum in placerat. Ut euismod purus quis libero     iaculis egestas. Integer vel erat eros, tincidunt viverra orci. Integer ante     risus, consectetur quis lacinia at, varius ut lorem. Lorem ipsum dolor sit     amet, consectetur adipiscing elit. Vestibulum porttitor orci in ligula     imperdiet id lobortis nulla viverra. Nulla eget enim vitae purus placerat     malesuada. Maecenas tincidunt mattis magna, sit amet gravida mi feugiat eu.     Vestibulum sed diam nulla. Proin velit augue, posuere vitae cursus non,     lobortis sed nibh. Nullam aliquet molestie ante, at dictum libero posuere eget.     Fusce a libero ac odio vestibulum malesuada. Curabitur luctus nunc in leo     sagittis ut pretium leo egestas. Morbi vel ligula ligula. Donec nulla ipsum,     placerat id posuere ut, condimentum sit amet augue.          Nunc vitae venenatis felis. Ut orci eros, commodo vitae rutrum vel, ultrices id     orci. Aliquam egestas velit eget tortor dignissim eu aliquam neque viverra.     Morbi sodales rhoncus feugiat. Ut ac erat et nisl adipiscing ornare porttitor     fringilla est. Donec eleifend metus et nulla ultricies ultricies suscipit quam     euismod. Suspendisse potenti. Nullam eget tristique erat. Fusce sed vestibulum     quam. Vivamus aliquam, urna vel mattis dapibus, nisi lacus hendrerit est, vitae     venenatis ipsum nisi vitae lectus. Integer laoreet enim non metus aliquet     sagittis. Nam semper consequat eros, id ultricies risus placerat non.          Donec risus nunc, porttitor id placerat sit amet, varius nec libero. Cras vel     dolor magna. Aenean dui ante, posuere in vehicula sed, mattis viverra mi.     Integer quis orci et eros gravida consequat nec quis metus. Donec dictum augue     quam. Praesent neque urna, laoreet eget lobortis quis, pretium sit amet neque.     Donec egestas molestie neque, vel egestas enim luctus eu. Nullam diam magna,     suscipit ac ornare vel, vehicula et lectus. Ut eu mi mi. Morbi blandit, leo in     tincidunt posuere, ante nisl dictum justo, vitae feugiat erat sapien quis dui.     Duis lacus libero, fermentum nec malesuada sed, elementum eu nisl. Integer     aliquam metus a lacus tincidunt condimentum. Pellentesque pulvinar porttitor     tristique. Cras ante dui, volutpat vel lacinia iaculis, accumsan a tellus.     Etiam risus quam, sodales volutpat feugiat vel, euismod ut odio.          Duis porttitor lacus urna, vel blandit turpis. Vivamus gravida ultrices nulla     in viverra. Aliquam vulputate posuere ipsum, ut porta quam consequat eget.     Etiam pulvinar, quam sed auctor semper, metus sapien consequat dolor, id     interdum ante nisi id tellus. Nulla iaculis augue quis lacus hendrerit quis     euismod mauris gravida. Fusce eu neque et tellus aliquet vulputate nec ut     magna. Aenean pharetra molestie lacus nec aliquam. Cras at ultrices augue. Sed     venenatis, risus vel gravida accumsan, metus dui blandit enim, nec sollicitudin     magna ligula at nibh. Sed elementum ipsum vitae odio facilisis feugiat. Vivamus     ac felis est. Etiam massa nunc, imperdiet in porttitor non, placerat sit amet     felis. Sed elit urna, scelerisque non rhoncus id, consequat id tortor.          Quisque adipiscing fermentum dui, in vehicula nibh facilisis convallis. Cras     condimentum adipiscing eros, nec tempor justo consectetur placerat. Sed     accumsan, lacus id rhoncus consectetur, libero orci euismod erat, non     sollicitudin arcu orci quis velit. Curabitur vitae sollicitudin diam. Duis     hendrerit augue sit amet orci dictum in mattis augue volutpat. Vivamus nec     sagittis tellus. Etiam felis felis, pretium sed luctus ac, euismod vitae nisl.     Phasellus vestibulum, odio sed condimentum ultrices, enim ante interdum nisi,     id sodales augue lectus vitae massa. Curabitur non convallis velit. Etiam eget     diam et nisi euismod vehicula. Donec dignissim, nisi vitae porta scelerisque,     felis leo sodales mauris, quis condimentum purus turpis dapibus arcu. Mauris     molestie fermentum risus sit amet lacinia. Maecenas sollicitudin mollis purus     ut consectetur. Maecenas et ligula quam. Morbi eget diam nisi, sed luctus arcu.          Praesent id libero ante, nec dapibus dolor. Vivamus egestas, nunc id malesuada     mollis, nisl neque condimentum lorem, non accumsan enim lorem ac neque. Morbi     in ligula magna, vehicula interdum metus. Sed eget lorem nec nibh ornare     suscipit eu nec nunc. Nulla est diam, tempus vitae egestas vitae, egestas vel     dui. Integer ac libero diam. Mauris sit amet arcu eu neque feugiat iaculis.     Aenean non nulla eu erat malesuada fringilla sed non justo. Curabitur non     libero orci, et egestas elit. Sed gravida est sit amet ligula pretium non     volutpat purus dictum. Quisque eros leo, consectetur vulputate hendrerit vitae,     semper sed est. Sed malesuada luctus massa sed posuere. Quisque blandit orci     nec libero placerat varius. Donec luctus nulla eu sapien consectetur sit amet     scelerisque turpis hendrerit. Fusce sed mi augue.          Donec tristique, ante nec rhoncus auctor, sapien lacus varius metus, eu     vulputate metus sem ac justo. Pellentesque arcu orci, tempor consequat luctus     pretium, elementum quis augue. Fusce tincidunt varius molestie. Nam ac velit ut     est fermentum porttitor. Etiam vel lobortis justo. In aliquet consequat elit     eget rutrum. Mauris non eros ligula, eget ultrices sapien.          Quisque egestas, libero eu venenatis faucibus, orci massa molestie ante, et     aliquet enim nisi vitae elit. Suspendisse ultricies sagittis mauris. Vestibulum     ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;     Nam quis turpis at est imperdiet accumsan. Aenean sed venenatis magna. Morbi     viverra dui sed lacus semper sed convallis tortor eleifend. Vestibulum at erat     sapien. Donec eget sagittis neque. Vestibulum in interdum urna.          \begin{wrapfigure}{l}{0.5\textwidth}         {\includegraphics[scale=0.4,angle=0,width=3.5in]{MassiveStarHR.pdf}}         \caption{blah blah blah blah blah blah blah blah blah blah blah blah blah blah         blah blah blah blah blah blah blah blah blah blah blah blah blah          blah blah blah blah blah blah blah blah blah blah blah blah blah          blah blah blah blah blah blah blah blah blah blah blah blah blah          blah blah blah blah blah blah blah blah blah blah blah blah blah          blah blah blah blah blah blah blah blah blah blah blah blah blah          blah blah blah blah blah blah blah blah blah blah blah blah blah          blah blah blah blah blah blah blah blah blah blah blah blah blah }         \label{fig:hr}     \end{wrapfigure}               Nullam cursus bibendum magna. Aliquam id nisi nisi. In lobortis ultrices sapien     id suscipit. Vestibulum ut arcu id lectus pretium eleifend. Duis dui urna,     aliquam id malesuada eget, dictum ut ligula. Phasellus venenatis odio a ligula     dictum ut pellentesque tellus tincidunt. Cras sed feugiat nulla. Curabitur     varius vestibulum nisi. Nulla sit amet purus sed eros euismod vulputate.     Suspendisse faucibus risus turpis, ut aliquet purus.          Aenean a erat at mi mollis elementum semper sit amet magna. Donec pretium     mauris at lorem pulvinar elementum. Suspendisse in quam ut turpis cursus     imperdiet eu et justo. Curabitur iaculis nulla ac magna semper luctus. Lorem     ipsum dolor sit amet, consectetur adipiscing elit. Etiam nec eros orci, et     egestas tortor. Nullam ac odio sit amet est volutpat lacinia. Suspendisse leo     nibh, fringilla ac lacinia sit amet, tincidunt sed lorem. Mauris eu lacus et     lectus pellentesque blandit in eget purus. Proin vel dui erat, ut aliquet quam.     Pellentesque vitae elit vel mi venenatis tempus.          Vivamus id augue diam. Sed consequat aliquam risus, id accumsan turpis suscipit     a. Pellentesque habitant morbi tristique senectus et netus et malesuada fames     ac turpis egestas. Maecenas fringilla odio at dui accumsan consectetur.     Maecenas non risus vel mi pulvinar bibendum quis ac magna. Mauris et hendrerit     enim. Sed et sem id felis eleifend ornare.          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam a sagittis enim.     Donec ac erat ac nulla mollis mollis. Curabitur urna turpis, porta nec     elementum sed, ornare nec leo. In facilisis ipsum nunc, eget suscipit odio.     Vestibulum tincidunt velit nec magna sodales fringilla faucibus eget eros.     Curabitur pulvinar ante interdum turpis dignissim dapibus. Donec ultricies     suscipit enim ac blandit. Nunc eu lectus vel metus volutpat bibendum. Sed a     purus est. Mauris faucibus nulla eu mi convallis vel suscipit nibh dignissim.          Nulla porttitor iaculis sodales. Praesent convallis arcu quis magna suscipit     suscipit. Curabitur congue tortor eget ligula consequat in commodo tellus     pharetra. Vestibulum neque erat, gravida non faucibus non, ultricies a nibh.     Mauris sem lacus, varius in imperdiet et, sollicitudin ut nisl. Sed porttitor,     velit ut posuere mattis, odio purus condimentum urna, id aliquet nisl nulla ut     mi. Sed vulputate porttitor purus et pretium. Fusce rutrum convallis nibh,     varius fringilla lectus ullamcorper a. Morbi purus odio, tristique aliquet     vestibulum sed, iaculis vel quam. Quisque dictum, nunc quis aliquam iaculis,     lorem est fermentum nibh, eget luctus nibh lorem sed sapien. Sed in commodo     ligula. Suspendisse tempus nisi ac massa aliquam blandit. Vestibulum libero     augue, scelerisque eget rutrum fringilla, euismod non nibh. Nullam venenatis     velit non erat tempus sit amet pulvinar ligula tristique. In vulputate dapibus     est a convallis.               \end{document}


title: How to add a sequential number on the right hand of a mathematical formula?

text: I often use $$...$$ to write mathematical formulae. I would like to know how to add a sequential number on the right hand of the formulae. I want them to be right adjusted at the right edge of the page. Also, it would be great if the numbers could be automatically generated. Could anyone help? Thank you very much!


title: How to set tikzmarks with \noalign at the edge of tabular rows

text: I'm trying to improve the lines in a tabular with colored rows (lines above a colored row can disappear in the adobe reader at some zoom levels) by redrawing the line above a row after the row itself has be created. I have p-columns so I can't use David's solution here http://tex.stackexchange.com/a/129835/2388. So I thought to use tikzmark (or some other mark) but can't figure[1] out how to find the right edge. Whatever I do the right mark is at the right side of the page:               \documentclass[]{article}          \usepackage{tikz}     \usetikzlibrary{tikzmark}          \begin{document}     \renewcommand\arrayrulewidth{4pt}          \begin{tabular}{l}     abc    \\\noalign{\hrule height \arrayrulewidth}     blub   \\\noalign{\pgfmark{testa}\hfill\pgfmark{testb}}     abc\tikz [remember picture] \draw [overlay,->] (pic cs:testa)--(pic cs:testb);     \end{tabular}          \end{document}      Is there anyway to put the marks in the \noalign so that they respect the size of the tabular box like `\hrule` does it? [1] I naturally can find the edge by putting a mark at the right end of some cell and then calculate the intersection but this is cheating ;-).


title: How to automatically align subfloat captions to xlabel of PGFplots?

text: Subfloat captions are not usually aligned with their corresponding xlable in PGFplots. ![enter image description here](http://i.stack.imgur.com/Oxv03.png) ![enter image description here](http://i.stack.imgur.com/AtgGl.png) One way is to manually move the captions horizontally to align them. For example, (copied from here)               \documentclass{article}     \usepackage{subfig}     \usepackage[demo]{graphicx}     \begin{document}     \begin{figure}       \centering       \captionsetup[subfigure]{oneside,margin={2cm,0cm}}       \subfloat[]{\includegraphics[width=4cm]{test1}}       \hspace{1cm}       \subfloat[]{\includegraphics[width=4cm]{test1}}       \caption{Caption text}     \end{figure}     \end{document}      However, this process would be tedious if there are too many figures in the document each requiring separate alignment. Is there any possible way to automatically align subcaptions to (detect if any and) center to their x axis o PGFplots? **EDIT:** Using `tikzscale` to resize the figures.               \documentclass{article}     \usepackage{subfig}     \usepackage{pgfplots}     \usepackage{tikzscale}     \begin{document}     \begin{figure}       \centering       \captionsetup[subfigure]{oneside}       \subfloat[]{ %         \includegraphics[width=5cm,height=4cm]{plot1.tikz}       }%       \hspace{1cm}       \subfloat[]{%         \includegraphics[width=5cm,height=4cm]{plot2.tikz}       }       \caption{Caption text}     \end{figure}     \end{document}      where _plot1.tikz_ is:                 \begin{tikzpicture}[]       \begin{axis}[         xlabel=$x$,         ylabel={$f(x) = x^2 - x +4$}       ]       \addplot {x^2 - x +4};       \end{axis}       \end{tikzpicture}%      and _plot2.tikz_ :                 \begin{tikzpicture}[]       \begin{axis}[         xlabel=$x$,         ylabel=$\sin(x)$       ]       \addplot {sin(deg(x))};       \end{axis}       \end{tikzpicture}%      The result will be: ![enter image description here](http://i.stack.imgur.com/nFuJ0.png)


title: Page position with pdfpages

text: Since I had problems `\include`-ing some .tex to my project I tried using the `pdfpages` package and the `\includepdf` command, but the pages are included displaced and I don't understand the `pdfpages` documentation (how to use the delta or what logical pages are). My code is simple:               \documentclass[11pt,a4paper,final,twoside,twocolumn,notitlepage]{article}     \usepackage{pdfpages}          \includepdf[pages=-]{file1}     \includepdf[pages=-]{file2}     \includepdf[pages=-]{file3}     \includepdf[pages=-]{file4}


title: How to remove the extra blank line in algorithm2e

text: I want to add a right aligned comment in LaTeX after `\For` command, but it adds an undesired blank line. Please help me. CODE:               \For(\tcp*[r]{Incremental calculation of edges}){$i \gets 1$ \textbf{\upshape{to}} $n$}{     \If {$i=1$}     {     $currentCenter \gets MEAN(x_{R'[2]},\ldots,x_{R'[k_{min}+1]})$\;     $currentSSE \gets SSE(x_{R'[2]},\ldots,x_{R'[k_{min}+1]})$\;     }}      SNAPSHOT: ![enter image description here](http://i.stack.imgur.com/63RHz.png)


title: Write information on aux file when using include to build document

text: This may be an odd question, but I'm having trouble writing information on the main `.aux` file when I split my documents through more than one `.tex`. Here is the deal: I'm trying to calculate the size of the widest TOC label so that I can align all chapter/section names in the TOC based on this measure. Someone has already told me how to do this measuring, but I need to write this info in the `.aux` file so that in the first pass I calculate the size and in the second pass I make use of it. What is troubling me is that the command that I'm using is not working, and I believe the reason is the said modularization of the document, since when I try it in a single-file document it works ok. Here is the part of the code that should write the info:               \AtEndDocument{         \protected@write\@auxout{}%         {\string\global\string\setlength{\string\widesttoclabel}{\the\widesttoclabel}}     }      With `\widesttoclabel` being the macro that holds the length I've calculated. But when I check the `.aux` file, that entry is not anywhere around, neither in the "master document's" aux nor in the others'. Am I missing something? **OBS** : I know I could workaround and replace `\include`s with `\input`s, but this would be terrible, since my document has very many pages... So this shouldn't be an option if I could choose.


title: Divided list of figures

text: I am using this solution to divide my list of figures and tables into chapters, however, I have a section heading on its own at the bottom of a page and then the table captions are on the next page. What I want to do is force a new page when this happens (i.e when less than 2 figures are in the list say). The original thread is here - http://tex.stackexchange.com/a/68340/51337 I am sure the same could be down with the Table of contents to ensure that it doesn't look strange either, but I've no idea how. I know you can force a new page in the table of contents by adding \addtocontents{toc}{\protect\newpage} before the \chapter{} command, but this isn't really what I am after                   \documentclass{book}         \usepackage{etoolbox}              \makeatletter         \def\thischaptertitle{}         \apptocmd{\@chapter}{\gdef\thischaptertitle{#1}}{}{}              \newcommand{\DeclareDividedList}[1]%           {\newcounter{#1@chapter}\setcounter{#1@chapter}{0}}              \pretocmd{\addcontentsline}%           {\ifltxcounter{#1@chapter}%            {%              \ifnumgreater{\thechapter}{\value{#1@chapter}}{%                \setcounter{#1@chapter}{\thechapter}%                \addtocontents{#1}{\protect\contentsline{chapter}%                  {\protect\numberline {\thechapter} {\thischaptertitle}}{}{} }              }{}%            }{}%           }{}{}         \makeatother              \DeclareDividedList{lof}         \DeclareDividedList{lot}              \begin{document}              \tableofcontents         \listoffigures         \listoftables              \mainmatter              \chapter{Introduction with no Figures}              \chapter{Test Chapter with Figures but no Tables}         \begin{figure}         \caption{caption text}         \end{figure}         \begin{figure}         \caption{caption text}         \end{figure}              \chapter{Test Chapter with Tables but no Figures}         \begin{table}         \caption{caption text}         \end{table}         \begin{table}         \caption{caption text}         \end{table}              \chapter{Test Chapter with Figures and Tables}         \begin{figure}         \caption{caption text}         \end{figure}         \begin{table}         \caption{caption text}         \end{table}         \begin{figure}         \caption{caption text}         \end{figure}         \begin{table}         \caption{caption text}         \end{table}         \begin{figure}         \caption{caption text}         \end{figure}              \end{document}


title: How to make a perfect colour filled threeparttable table?

text: A three line table is used for my report. I want to fill `lightgray` background color to the whole table, but there is white space between rows, how to eliminate this issue?   1. Without `\addlinespace`: there is still white space around rules ![enter image description here](http://i.stack.imgur.com/yqzMl.png)   2. With `\addlinespace`: this is ideal spacing between rows, but how to fill colour as well for these white spaces? ![enter image description here](http://i.stack.imgur.com/ggIy6.png) * * *                 \usepackage{colortbl}       \definecolor{Lightgray}{RGB}{235,235,235}      Code:                 \begin{table} [htpb]       \centering       \begin{minipage}[b]{0.9 \textwidth}       \centering       \begin{threeparttable}[b]            \caption{Size and shape distribution for a sampled rock riprap}        \label{tab:size_shape}       \begin{tabular} { p{0.15 \textwidth}  p{0.10 \textwidth} p{0.10 \textwidth} p{0.10 \textwidth} p{0.15 \textwidth}  }        \toprule       \rowcolor{Lightgray}& Small    &  Medium &  Large & Shape fraction \\        \cmidrule{1-5}  \addlinespace       \rowcolor{Lightgray}Compact    & 10\% &  44\% & 7\% & 61\% \\ \addlinespace       \rowcolor{Lightgray}Flat       & 4\%  &  10\% & 4\% & 18\% \\ \addlinespace              \rowcolor{Lightgray}Elongated  & 5\%  &  12\% & 4\% & 21\% \\ \addlinespace       \midrule       \rowcolor{Lightgray}Size fraction  & 19\% & 66\% & 15\% & 100\% \\       \bottomrule       \end{tabular}       \end{threeparttable}       \end{minipage}       \end{table} `      **Edit 1:** Using `\renewcommand{\arraystretch}{1.3}` gets proper spacing between rows without `\addlinespace`. The remaining issue is: how to get ride of the whihte space for rules? **Edit 2:** The solution of Professional-looking tables with alternating row colors still could not eliminate white space after `midline` or `cmidrule`. Hence `white` colour is used for the row after `midline` to `hide` the white space. If wrong please correct me. See the table created by the new commands of that solution: ![enter image description here](http://i.stack.imgur.com/95rNH.png)                  \begin{table} [htpb]        \centering        \begin{minipage}[b]{0.9 \textwidth}        \centering        \begin{threeparttable}[b]             \caption{Size and shape distribution for a sampled rock riprap}         \label{tab:size_shape}        \begin{tabular} { p{0.15 \textwidth}  p{0.10 \textwidth} p{0.10 \textwidth} p{0.10 \textwidth} p{0.15 \textwidth}  }         \topline        \headcol & Small  &  Medium &  Large & Shape fraction \\% \cmidrule{1-5}          \midline        \rowcol Compact    & 10\% &  44\% & 7\% & 61\% \\         \rowcol Flat       & 4\%  &  10\% & 4\% & 18\% \\ % \cellcolor{lightgray}          \rowcol Elongated  & 5\%  &  12\% & 4\% & 21\% \\         \midline        \rowcol Size fraction  & 19\% & 66\% & 15\% & 100\% \\        \bottomlinec  %\bottomrule        \end{tabular}        \end{threeparttable}        \end{minipage}        \end{table}      Besides, if you enlarge the table and look carefully, you will see few thin white lines in the heading row! Is that normal? See below: ![lines](http://i.stack.imgur.com/gKunH.png)


title: \dot{\vec{\hat{x}}}} fails to compile with svjour3

text: The title says it all. I would like to typeset the time-derivative of a vector whose symbol shall be `\hat{x}`. The documentclass svjour3 is used in Springer journals. The following MWE reproduces the behaviour in the article class:               \documentclass{article}     \if@mathematic        \def\vec#1{\ensuremath{\mathchoice                          {\mbox{\boldmath$\displaystyle\mathbf{#1}$}}                          {\mbox{\boldmath$\textstyle\mathbf{#1}$}}                          {\mbox{\boldmath$\scriptstyle\mathbf{#1}$}}                          {\mbox{\boldmath$\scriptscriptstyle\mathbf{#1}$}}}}     \else        \def\vec#1{\ensuremath{\mathchoice                          {\mbox{\boldmath$\displaystyle#1$}}                          {\mbox{\boldmath$\textstyle#1$}}                          {\mbox{\boldmath$\scriptstyle#1$}}                          {\mbox{\boldmath$\scriptscriptstyle#1$}}}}     \fi          \usepackage{amsmath}          \begin{document}     \begin{equation}         \dot{\vec{\hat{x}}}  % Failure         \vec{\dot{\hat{x}}}  % OK         \dot{\hat{\vec{x}}}  % OK     \end{equation}     \end{document}      Pdflatex output contains               ! Undefined control sequence.     \macc@adjust ->\dimen@ \macc@kerna                                         \advance \dimen@ \macc@kernb \kern -\dimen@       How can I typeset such a vector in the svjour3 class?


title: TikZ/PGF - how to draw a node as a line (rectangle with zero height)?

text: I want to a sequence of nodes, finished by a line. I tried this:               \documentclass{article}     \usepackage{tikz}     \tikzstyle{st1}=[circle, inner sep=1.5pt, draw]     \tikzstyle{st2}=[rectangle, inner xsep=2pt, inner ysep=0pt, draw]      \begin{document}         \begin{tikzpicture}[grow=down, level distance=10pt, every node/.style={st1}]             \path node{} child {node{} child {node[st2]{}}};         \end{tikzpicture}     \end{document}      but this gives ![TikZ_ex_nodes_v1](http://i.stack.imgur.com/WwiVO.png), i.e. the node has some height. Is there some (simple) way to make the last node into a line? If possible using definition of `st2`, so it it simple to use. The closest thing I managed is:               \documentclass{article}     \usepackage{tikz}     \tikzstyle{st1}=[circle, inner sep=1.5pt, draw]     \tikzset{st2/.style={rectangle, inner sep=-2pt, draw=none}}     \begin{document}         \begin{tikzpicture}[grow=down, level distance=10pt, every node/.style={st1}]             \path node{} child {node{} child {node[st2]{\textbf{--}}}};         \end{tikzpicture}     \end{document}      but this is more a dirty hack. In addition, it needs needs having `\textbf{--}` in every such node .. and it won't work if I ever need the sequence to be horizontal. Thanks.


title: Book style page numbering with ConTeXt

text: 1. I would like to set the numbering like     * Cover page = show no page number      * TOC = roman page numbers      * Body= arabic page numbers  Many people have previously asked similar question like Page numbers (Roman number and Arabic numerals) in ConTeXt, however the answers seems to work with when we rely on default page numbering style. However when I modify the template shown in the above example with `\setupfootertext`, the numbering stops working. Below is the `tex` file.   2. Looking to hide the footer till I reach the body   3. Have footer, with alternative pages showing the title and the chapter name. Both pages with arabic numbers.  .               % Template from the line provide above     \definestructureconversionset [frontpart:pagenumber] [] [romannumerals]          \startsectionblockenvironment [bodypart]       \setcounter [userpage] [1]     \stopsectionblockenvironment               %=========================ADDITION====================================     \setuppagenumbering[location=,alternative=doublesided]          \setupfootertexts[\setups{text right}][][][\setups{text left}]          \startsetups[text right]       \rlap{}       \hfill       \bf {\sl Title goes here }       \hfill       \llap{\pagenumber}     \stopsetups          \startsetups[text left]       \rlap{\pagenumber}       \hfill       \bf \cap{ Chapter \getmarking[chapternumber] }  \getmarking[chapter]       \hfill       \llap{}     \stopsetups     %=========================ADDITION END====================================     \starttext       \startstandardmakeup         Cover page       \stopstandardmakeup       \startfrontmatter         \completecontent       \stopfrontmatter            \startbodymatter              \section[production]{Production}           Production is a two part process.         \section[background]{Background}            \stopbodymatter          \stoptext


title: latex figure figure* order

text: I am writing a journal which has two column. I am using {figure} as well as {figure*} to place the figures in one column as well as stretch across two columns. My problem is the order of the figures are not correct. e.g. their order of appearance is:                               Figure 1.                     Figure 2.                     Figure 5.                     Figure 3.                     Figure 4.      What should I do to make them appear in order?


title: Inserting two file with different preambles

text: Is it possible to insert a LaTeX file into another file without the same preamble?


title: Unable to access "Helvetica Neue Ultralight Italic" font

text: I want to put some parts of my document in **Helvetica Neue UltraLight _italic_**. I use :               \fontspec{Helvetica Neue Ultralight} \selectfont        \emph{...} ...      or :               \textit{...} ...      But none of 2 solutions seems to work, as the result is in **Helvetica Neue LIGHT _italic_** I checked that the font I want exists on my computer, in a whole `HelveticaNeue.dfont` package.


title: How to generate document with 6 grid images, chapter header and table of contents

text: I am trying to generate a booklet with a grid of 6 or less images in a grid, and a text caption below it. I would like each page to display the chapter in the header, and have the table of contents link to the first page of the chapter. This is the basic idea of what I'm after (it doesn't need to match the exact color scheme or anything): ![enter image description here](http://i.stack.imgur.com/4cVOh.png) This is my attempt at doing this:               \documentclass[12pt]{scrreprt}     \usepackage[final]{pdfpages}     \usepackage{hyperref}     \usepackage{fancyhdr}     \usepackage{graphicx}     \usepackage{subfigure}     \usepackage[letterpaper, margin=1in]{geometry}          \pagestyle{fancy}     \lfoot{\today}     \rfoot{\thepage}     \cfoot{}     \rhead{}     \lhead{\leftmark}          \begin{document}\thispagestyle{empty}     \clearpage\phantomsection     \tableofcontents          \clearpage\phantomsection     \addcontentsline{toc}{chapter}{Chapter 1}     \begin{figure}[htbp]     \subfigure[t=0]{\frame{\includegraphics[width=150px]{569J-12}}}     \subfigure[t=10]{\frame{\includegraphics[width=150px]{80_Gas_Furnace}}}     \subfigure[t=20]{\frame{\includegraphics[width=150px]{90_Gas_Furnace}}}\\     \subfigure[t=0]{\frame{\includegraphics[width=150px]{569J-12}}}     \subfigure[t=10]{\frame{\includegraphics[width=150px]{80_Gas_Furnace}}}     \subfigure[t=20]{\frame{\includegraphics[width=150px]{90_Gas_Furnace}}}     \end{figure}          \includepdfset{pagecommand=\thispagestyle{fancy}}     \end{document}      The following is what I get with this code: ![actual result](http://i.stack.imgur.com/8lYwi.png)


title: File size generated from Pdflatex is too big

text: My instructor demands a maximum size of submitted assignment of 50kb in PDF- format. Whenever I try to build from PDFLatex the files exceed this limit. I expected the problem to be related to bitmap encoding of fonts and tried to update my `cm-super` package, but this did not work. I then cross checked with different font encodings using `\usepackage[T1]{fontenc}` and `\usepackage[OT1]{fontenc}` but nothing seems to make the PDF smaller. My minimal working example is               \documentclass[10pt,a4paper,oneside]{article}     \usepackage[utf8]{inputenc}     \usepackage[T1]{fontenc}     \usepackage{amsmath}     \usepackage{amsfonts}     \usepackage{amssymb}     \usepackage{lipsum}          \title{Test}     \author{John doe}     \begin{document}          \maketitle          \section{This is a test}          \lipsum          \end{document}      This produces a PDF of 48.5 kB, which would be okay if my submissions for the assignments were this small. I expect the generated PDF to be a lot smaller since the `.tex` file is 295b. I use Tex Live 2013 on Ubuntu 14.04 and the `cm-super` package is in the newest version. Please help me.


title: Default value for a key defined with pgfkeys

text: Hereafter is a simple macro with keys `nom` and `prenom` defined with `pgfkeys.               \documentclass[a4paper]{article}          \usepackage{tikz}          \pgfkeys{         /test/pgf/.cd,         nom/.store in = \nom,         nom/.default = toto,         prenom/.store in = \prenom,         prenom/.default = titi,     }          \newcommand{\qui}[1][]{         \pgfkeys{/test/pgf/.cd,#1}         I am \prenom{} \nom{} !     }          \begin{document}     \qui[prenom = toto, nom = titi]     \end{document}      The issue is that if you use macro `\qui` without the key `\nom` or `\prenom` you get an error message saying `! Undefined control sequence.` I think that when I execute the macro with `\qui[nom = titi]` LaTeX does not know the macro `\prenom` and thus gives me an error message. I do not understand why I got this error since I give a default value to all keys with the `.default` handler. I tried also the `.initial` handler but if you want the macro to work you have to replace `\prenom` and `\nom` by `\pgfkeysvalueof{prenom}` and `\pgfkeysvalueof{nom}`. PGF Keys differences between .initial and .default But the following code works. You can use macro `\qui` without any keys. But again I do not understand why the `.default` handler does not do this job ?               \documentclass[a4paper]{article}          \usepackage{tikz}          \pgfkeys{         /test/pgf/.cd,         nom/.store in = \nom,         nom = toto,         prenom/.store in = \prenom,         prenom = titi,     }          \newcommand{\qui}[1][]{         \pgfkeys{/test/pgf/.cd,#1}         I am \prenom{} \nom{} !     }          \begin{document}     \qui[prenom = toto, nom = titi]     \end{document}


title: Including graphic outside bounding box using graphicx and pdflatex

text: I am including graphics from .pdf files into my latex document using the graphicx package. Some objects in the graphics files extend beyond the pdf page area, which is used as the bounding box for \includegraphics. I would like to use the bbox for uniform positioning/sizing of all my graphics, but occasionally have objects extend beyond the bbox onto the page. The graphicx documentation states > If * is omitted, then any part of the graphic that is outside the specified > ‘bounding box’ will over-print the surrounding text. ... which is exactly what I'd like, but the .pdf file generated by pdflatex crops the images to the bounding box, even if I explicitly use               \includegraphics[clip=false]{inkclip}      I have this problem with .pdf files generated in CorelDraw as well as Inkscape, both of which show each others files having objects extending beyond page border, so I am sure the information about these objects is included in the pdf files. Edit: I've played around some more and it seems to be a problem related to pdflatex. Using latex and then going dvi->ps->pdf, things work the way I want them to. I've attached an EPS file for use with latex and a PDF file for use with pdflatex to show the difference: Inkscape-generated PDF Inkscape-generated EPS


title: How to to set a padding around the page body, draw a frame/border around it, and then add some margin?

text: What if I want to set a padding around the page body (on all pages), draw a frame/border around it, and then add some margin? The `geometry` package doesn't seem to have an option for this among its basic options because it doesn't separate padding and margin. (I'm asking this question about the whole page body, rather than about a box explicitly coded in the sources. I'm dealing with LaTeX.) What I want to achieve -- each page is printed like this:               >outer margin< | >left<  >mpwidth< >text body< >right< | >outer margin<                    |                     ......            |                    |                    Text text          |                             |         marginpar  Text text          |                             |                    Text text          |                             |                     ......            |      Then, I'd also like to change the color of the frame depending on the text (with a command from the text). The frame/border style could be fancier than just a plain rule/line. The piece inside the frame is like a complete customizable page layout: a custom left margin width, a custom right margin width, and a custom marginpar width. This doesn't cross the frame. The frame is at a fixed distance from the edge of the paper ("outer margin").


title: Diagram with stacks

text: So this is what I would like to have (please don't mind my awful paint skills): ![enter image description here](http://i.stack.imgur.com/H0WAx.jpg) And this is what I got out of tikz: ![enter image description here](http://i.stack.imgur.com/dKaUx.jpg) Using this code:               \documentclass{article}          \usepackage[english]{babel}     \usepackage{tikz}     \usetikzlibrary{shapes,arrows}          \begin{document}          \tikzstyle{depot}=[circle, draw, fill=red]     \tikzstyle{station}=[circle, draw, fill=green]     \tikzstyle{customer}=[circle, draw, fill=yellow]     \tikzstyle{line}=[draw, -latex']          \begin{tikzpicture}[node distance=2cm]       \node[depot](s) {$s$};       \node[station, right of=s](p1) {$p_1$};       \node[rectangle, draw=black, right of=p1](c1) {\begin{tabular}{c} $c_1$\\\hline $d_1$\\\hline $d_2$ \\\hline $d_3$ \\\hline $\vdots$ \\\hline $d_{m(i)}$\end{tabular}};       \node[station, right of=c1](p2) {$p_2$};       \node[rectangle, draw=black, right of=p2](c2) {\begin{tabular}{c} $c_1$\\\hline $d_1$\\\hline $d_2$ \\\hline $d_3$ \\\hline $\vdots$ \\\hline $d_{m(i)}$\end{tabular}};       \node[depot, right of=c2](t) {$t$};     \draw[thick, ->] (s) -- node[yshift=.2cm] {$t_{sp_1}$} (p1);     \draw[thick, ->] (p1) -- node[yshift=.2cm] {$t_{p_1c_1}$} (c1);     \draw[thick, ->] (c1) -- node[yshift=.2cm] {$t_{c_1p_2}$} (p2);     \draw[thick, ->] (p2) -- node[yshift=.2cm] {$t_{p_2c_2}$} (c2);     \draw[thick, ->] (c2) -- node[yshift=.2cm] {$t_{c_2t}$} (t);     \end{tikzpicture}          \end{document}      As I'm new to tikz, I'm not sure how to resolve the remaining issues:   1. The horizontal lines in the table have white space on both sides, and the table is too wide.   2. The arrows should point at specific entries in the table, not just to the middle of the table.   3. The table colors (color of top cell must be different from remaining cells). Btw, I'm open minded towards a prettier color scheme and a cleaner overall look :).   4. If possible, the rounded table top, but that's just bonus. Any suggestions are highly appreciated.


title: Is PDF capable of conditional display and, if so, how can I achieve it with pdfTeX/friends?

text: Most of the time, we (or more conservatively, _I_ ) think of PDF as a static format fit for printing. I've been surprised in the past at how versatile it is -- how dynamic and interactive it can be -- so I've decided to ask the following. I'd like to create a multi-lingual document where the language can be determined at run-time. That is, the user could select from a drop-down / radio button group to choose a language, and the relevant content would be appropriately substituted throughout the document. If this _is_ possible, my ideal interface/MWE would be:               \documentclass{whatever}     \usepackage{mwe} % just for \kant and \lipsum          \DeclareLanguageChoices{kant={One of Kant's Books},                     psuedo-latin={Classical gibberish used in typesetting.}}          \begin{document}     \dochoices          \begin{LanguageChoice}          \BeginLanguage{kant}     \kant     \EndLanguage{kant}          \BeginLanguage{psuedo-latin}     \lipsum     \EndLanguage{psuedo-latin}          \end{LanguageChoice}     \end{document}      The syntax above is LaTeX, but solutions in pdfTeX, XeTeX, ConTeXt, and LuaTeX are all most welcome; just adapt it to the format of your choice. :-) With this syntax, the produced PDF would display some sort of control at the top (at `\dochoices`) using the display text (that which is in `{}`) and, depending on the selected key, display the appropriate content. * * * ### Thoughts on Potential Solutions   * I don't think the format can re-flow itself even vertically, so just taking the maximum box size would be necessary and sufficient.   * More as I / the comments think of them.


title: Why are my dimension calculations so far off?

text: I've got some macros storing information about various dimensions. When I start dividing by dimensions, though, I'm getting answers that don't make sense.               \documentclass{article}     \usepackage[landscape]{geometry}     \makeatletter     \def\aetopmargin{0.85in}%%     \def\aebotmargin{0.5in}%%     \def\aeworkspacetopsep{4ex}     \def\aeworkspacerulesep{0.65cm}     \edef\aeworkspaceheight{\dimexpr\paperheight-\aeworkspacetopsep-\aetopmargin-\aebotmargin}     \typeout{==>Work space height===>\strip@pt\dimexpr\aeworkspaceheight}     \typeout{==>Work space rule: ===>\strip@pt\dimexpr\aeworkspacerulesep}     \typeout{==>Their quotient is===>\strip@pt\dimexpr \dimexpr\aeworkspaceheight\relax / \dimexpr\aeworkspacerulesep\relax \relax}     \makeatother     \pagestyle{empty}     \begin{document}     empty     \end{document}      When I run this I get the following output on the terminal:               ==>Work space height===>499.5079     ==>Work space rule: ===>18.49411     ==>Their quotient is===>0.00041      Shouldn't I be getting something more like               ==>Their quotient is===>27.00902...


title: Difference between Typeset Superscript vs. Unicode Symbol for Superscript

text: For a Unicode font, is there any difference in height, placement, etc. between rendered text of `^{superscript}`, when compared to the Unicode character for `superscript` itself? For instance: will the TeX output of `^2` be identical to `²` (\u00B2) in e.g. XeLaTeX -- or a WYSIWYG document, for that matter?


title: How to write a permutation ?

text: How to write a permutation like this ? ![permutation](http://i43.tinypic.com/fnbf3m.png)


title: Rescale a character to fill a complete A4 page

text: I am maybe looking for the wrong keywords. But I do not find any answer about how to scale a letter to fill the entire A4 page. My first intuitive step was to use the option `scale` of the package `geometry` but this failed due to the margins. Argument: `scale` works properly only for values below one if I am right. Currently I do not want to use `tikz`, as I thought it must work much simpler than scaling it graphically.


title: Setting document width in Lyx

text: When I view my document in a PDF with pdflatex, my stuff is squished into like only 60% of the page, leaving the rest an ugly, unused whitespace. How do I fixed this (preferably in Lyx)?


title: Customize line-spacing and indentation of a list in LyX

text: I am currently using a list with bullet-points; however, I think the lines are spaces too far apart and they're indented way too much. I don't see any way to correct this in LyX, however.


title: Vertical align a marginpar with the *first* line of a 2-line statement

text: I have an article in which I'd like to use margin notes near some text (some minor headings, equivalent with a subsubsubsection). In some cases that text runs on two lines. I'd like the margin note to be vertically align with the first line of those two, not the second (as it happens now as seen in the screenshot). ![alt text](http://i.stack.imgur.com/SZlPc.png) Is it possible? Many thanks in advance.               \usepackage{mparhack}     \reversemarginpar          % <snip>     \textbf{Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}      \marginpar{\sc{\small{Case~1}}}


title: Can't find “kpsewhich” on PATH. Textmate+mactex

text: > **Possible Duplicate:**   >  "kpsewhich" error when trying to build from Textmate Most manuals I have seen on textmate claims that command+B is compiling LaTeX documents, however this command seems to just add \textbf{}. Some other manual claims that command+R is the way to compile, however this command yield the following result: > Can't find “kpsewhich” on PATH. What does this mean, and what is the solution? I have downloaded textmate and mactex. I'm not sure if I need the mactex.zip. I'm new to both text mate and Mac. (Have used LaTeX on Ubuntu for 2 years, however)


title: Creating a tabular data in latex

text: I want to create a tabular data something of the sort in the figure. It's empty. But it has some contents filled. How can I do it in latex. It's like I have a row title and its contents inside the body. ![enter image description here](http://i.stack.imgur.com/mpLNm.png)


title: Making variations of \boxed

text: I have to typeset certain formulas, and the notation involves stretchable boxes, pretty much like `\boxed{X}` makes, but occasionally I need to add a hat below and/or above, as the picture shows: ![A fancy box](http://i.stack.imgur.com/3zEdd.png) (Symbols in this fancy box should be on the baseline.) I usually find anything I want in "The Comprehensive LaTeX Symbol List", but this time I think it's too special. Any ideas how I can implement this? Thank you for suggestions!


title: bad boxes made by picture

text: I got bad boxes (3pt too high), It because of picture. I need it in multirow environment, I want it to be in the middle of all rows (5). How can I achieve this without bad boxes?               \documentclass[article, 12pt, oneside]{memoir}     \setstocksize{297mm}{210mm}     \settrimmedsize{297mm}{210mm}{*}     \settrims{0mm}{0mm}     \setlrmarginsandblock{10mm}{*}{1}     \setulmarginsandblock{20mm}{*}{1}     \checkandfixthelayout     \usepackage{polyglossia}     \setdefaultlanguage{english}     \usepackage{microtype}     \usepackage{fontspec}     \defaultfontfeatures{Ligatures=TeX}     \setmainfont{TeX Gyre Schola}     \usepackage{xcolor}     \usepackage{colortbl}     \usepackage{multirow}     \usepackage{tabu}          \begin{document}     \tabulinesep=2mm          \begin{center}              \begin{tabu} to \linewidth {p{5.5cm}p{8cm}X[r,p]}         \arrayrulecolor{red}             \multicolumn{3}{l}{ \textcolor{red}{ \textit{ \textls[100]{bla bla} } } } \\             \toprule             a   & aa    & \multirow{5}{*}{ \parbox[m]{2cm}{ \includegraphics[width=2cm]{pict.jpg} } } \\             b   & bb    & \\             c   & cc    & \\             d   & dd    & \\             e   & ee    & \\         \end{tabu}          \end{center}          \end{document}


title: XeTeX problem: no italics with i+tilde

text: When I use `\emph{\~\i}` to create an i with tilde in XeTeX (using Linux Libertine), the i is not typeset in italics. Does anyone know a workaround? You can see a MWE here:               \documentclass[11pt]{article}     \usepackage{fontspec}     \setmainfont{Linux Libertine}          \begin{document}          \emph{G\~\i k\~uy\~u}     \end{document}      Any help would be greatly appreciated! Thanks in advance! Thomas


title: Command defined inside standalone file appears unavailable in main document

text: In the file producing my `tikz`-graphic, I define a new command that creates a `tikzpicture` using particular arguments (left out in MWE below because the problem reproduces without those). I use the `standalone` class for the figure, so that I can more quickly develop the figure without recompiling my entire article, and without cluttering my directory with small files `\input`-ing the different figures. However, when I `\input` the standalone- file in my main document, I cannot execute the new command defined inside the standalone-file. My standalone figure MWE file (called `stafig.tex`):               \documentclass{standalone}     \usepackage{tikz}     \begin{document}          \newcommand{\examplefig}[0]{%     \begin{tikzpicture}      \draw (0,0) rectangle (2, 1) node [midway] {Example};     \end{tikzpicture}%     }          \onlyifstandalone{      \examplefig      \examplefig     }          \end{document}      I include it in my MWE main article like this:               \documentclass{article}     \usepackage{standalone}     \usepackage{tikz}     \begin{document}          \begin{figure}      \input{stafig}      \examplefig      \caption{Yes, a test}     \end{figure}          \end{document}      The standalone-file compiles fine and has the expected result. However, compiling the main file fails with:               ! Undefined control sequence. l.8  \examplefig      In my real case, I want to use this macro to create four plots in different subfloat-environments with different parameters. My questions:   * Why is compilation of the main file failing? Is this expected?   * How could I approach this instead?   * How would I do if I additionally use `pgfkeys`?


title: \textbf{} not working inside Breakurl \burlalt

text: Below is my code,               \documentclass{article}     \usepackage[breaklinks]{hyperref}     \usepackage{breakurl}     \usepackage{url}     \hypersetup{     pdfpagemode=none,%     colorlinks,%     citecolor=blue,%     filecolor=blue,%     linkcolor=blue,%     urlcolor=blue     }          \begin{document}          If you have any questions, at \burlalt{www.goooooggggggle.comssss}{32, 396, (1964)}          If you have any questions, at \burlalt{www.goooooggggggle.comssss}{\textbf{32}, 396, (1964)}          If you have any questions, at have any questions, at have have \burlalt{www.goooooggggggle.comssss}{32, 396, (1964)}          L.~A.~Anchordoqui, H.~Goldberg, and G.~Steigman, Phys.     Lett. B     \burlalt{http://dx.doi.org/10.1016/j.physletb.2012.12.019}{718, 1162 (2013)}.               \end{document}      when i use \textbf{} inside \burlalt, it throws some error, is it possible to use those commands inside \burlalt, please guide me, i am new to latex


title: How can I fill a line from the left?

text: I am fiddling with various ways of filling a line with a vertically centered line and experimenting with the answers here: http://stackoverflow.com/questions/2553392/latex-rule-filling-the-line and here: Vertically centered horizontal rule filling the rest of a line?. Now, I would like the line to fill the beginning (left) of the line - not the rest. It seems "fill" commands do not do anything unless the line contains "something" before the fill part. How can I do this so that I can fill the line with a rule like this: ----------------------------------------------- Text Where the text is flush right?


title: enumerate bibliography items

text: I'm using `bibtex`, the package `apacite` and               \bibliographystyle{apacite}     \bibliography{tesis}      I'm sorting the bibliography aphabetically (author-year) and everyting's ok except that I want to enumerate the bibliography items (just in the bibliography). I found this, but it's for `biblatex` and I can't make it work in my case. Any help will be apreciated!


title: Using Asymptote with pdfLaTeX

text: I have recently started using LaTeX and have found it amazing. I now use LaTeX for all my documents :). However, now that I need to include some graphs and diagrams in my documents, I have found the `Asymptote` package, and seen that it is very powerful. I am having some issues using it though. Firstly I would like to know the syntax for embedding asymptote code into LaTeX, and secondly if there is any convenient way to compile the whole document, in one command, I used to do my diagrams in mathematica, where I would import the picture and compile the whole document with a single `pdflatex` command.


title: How can I use one column in the proc document class?

text: I'm making a 5 pages report about this year's activities. Using the proceedings document class I managed to get very close to the format I've been required to use, but I just can't make it to work with only one column! How can I make a one column document using the proc document class? if I use:               \documentclass[letterpaper,10pt,onecolumn]{proc}      I get this error:               ! Class proc Error: Option `onecolumn' not supported.      the beggining of the document is:               \documentclass[letterpaper,10pt]{proc}     \usepackage{fancyhdr}          \pagestyle{fancy}     \fancyhead{}     \fancyfoot{}     \fancyhead[C]{my header}       \fancyfoot[C]{\thepage}          \renewcommand{\headrulewidth}{0.5pt}          %opening     \title{ bla bla bla }          \author{ me }          \begin{document}     \onecolumn          \maketitle          document bla bla bla


title: Do people use LaTeX or InDesign (or something else) for a technical report / book?

text: I was wondering how people write / layout a technical report / book. I have the following requirements:   * main text is two columns   * each chapter contains many graphs / figures / tables that span both columns   * bibliography at the end of most chapters (but these references are not cited in the main text)   * I receive all of the source documents in Word. I would naturally do this with LaTeX and the `memoir` class, however after spending only a day at this task, I'm facing the following problems:   * copy & pasting text is slow   * forcing figures and tables to show up at a certain position and spanning two columns is way too hard - it basically never works (maybe I'm doing something wrong) and figures end up always at the end of a section / chapter.    * I don't feel like I could delegate this job to someone without LaTeX knowledge.    * You constantly need to recompile because if you don't do it, you'll never find the problems. Again, maybe I'm doing something wrong here and I'm open for any suggestions and advice. **EDIT:** regarding the contents / design that I'm looking for, I guess the following pdfs might be a good example   * almost ideal example http://www.mpe.mpg.de/Highlights/FB2010/JB_07_09_final_g.pdf   * not ideal example, since they have a figure @ the end of every page http://www.fischer.de/PortalData/1/Resources/fixing_systems/connectit/_documents/10/2008-10-11.pdf   * good example http://www.for.gov.bc.ca/rco/research/mamu/tr029.pdf


title: Bibliography in table of contents

text: \begin{document}       \tableofcontents       \include{chapter1}       \bibliographystyle{plain}       \bibliography{biblio}      \end{document}      The bibliography does not appear in the table of contents, have you an idea please? If I add this:               \usepackage[nottoc,numbib]{tocbibind}      the bibliography will appear as a chapter in my document!!


title: How to limit hyphenation in a multicol environment?

text: I have a LaTeX document (compiling with `pdflatex`), with the `multicols` and `microtype` package enabled. The document is using two cols using the `\begin{multicols}{2} ...\end{multicols}` environment. `microtype` already does a great job with kerning. But still I have quite a lot of hyphenated words. Often times I have three or even more hyphenated 'lines' in a row. Is there a way to add a penalty in LaTeX, to only have two hyphenated 'lines' in a row?