title: How can I set a color for the title rule?

text: I'm writing a document which uses titlesec, and I'd like to set the title rule to a different color. How can I do that? This is what I currently have, which produces section titles with black rules:               \titleformat{\section}     {\Large\sffamily}     {\thesection.}{.5em}{}[\titlerule]      Note: I want to change the color of the rule that appears below a section title.


title: Large braces to specify condition in a set

text: How do I define this in LaTeX - I am writing a description of a set, and I need huge braces because I have lot of clauses to fit in, and it will take more than 1 line. For example: `A = \{ (x,y,z) : \exists ... \forall ... (big definition of a graph)\}`


title: Modify the \textwidth of all subsubsections compatible with adjustbox

text: I have a very simple document which is a succession of tables within subsubsections of the document.               \usepackage{geometry}     \geometry{verbose,landscape,a4paper,lmargin=1cm,rmargin=1cm}      This is my header and it works fine. But when I insert a table using `\begin{adjustbox}{max size={\textwidth}{\textheight},keepaspectratio}`, the table is indented to the left with regards to the title. How can I temporarily modify the `\textwidth` property so it is taken into account by the `adjustbox` package ? I have tried several solution so far (`titlesec`,`pagechng` and `fullwidth`) but to no avail. It is worth mentioning that I do not want to only expand the table : the `keepaspectratio` property of the `adjustbox` package is crucial to me. Thank you for your help. Here is a reproductible example :               \documentclass[english]{article}     \renewcommand{\familydefault}{\sfdefault}     \usepackage[T1]{fontenc}     \usepackage[latin9]{inputenc}     \usepackage{geometry}     \geometry{verbose,landscape,a4paper,lmargin=1cm,rmargin=1cm}     \usepackage[table]{xcolor}     \usepackage[open,openlevel=2,atend]{bookmark}     \usepackage{adjustbox}     \usepackage{fancyhdr}     \pagestyle{fancy}     \lfoot{}     \cfoot{\thepage}     \rfoot{}     \setcounter{secnumdepth}{5}     \setcounter{tocdepth}{5}     \usepackage{Sweave}     \begin{document}                         \section{bla}     \subsection{blabla}     \subsubsection{blablabla}     \begin{center}     \begin{adjustbox}{max size={\textwidth}{\textheight},keepaspectratio}      \begin{tabular}{rrrrrrrrrrrrrrrrrrrrrr}      \hline     b & b & b & b & bb & b & b & b & b & b & b & b & b & b & b & b & b & b & b & TOTAL &         Theta & Carry \\      \hline     \textbf{\cellcolor{lightgray}  BLA}  &  \textcolor{red}{ \ -8,629}  &  \textcolor{red}{ \ -27,295}  &  \textcolor{red}{ \ -17,019}  &  \ 2,076  &  \textcolor{red}{ \ -45,148}  &  \ 695,726  &  \ 670,926  &  \textcolor{red}{ \ -1,174,496}  &  \textcolor{red}{ \ -167,597}  &  \ 116,890  &  \textcolor{red}{ \ -35,396}  &  \textcolor{red}{ \ -135,900}  &  \ 11,481  &  \textcolor{red}{ \ -2,634}  &  \ 26,003  &  \textcolor{red}{ \ -324,524}  &  \textcolor{red}{ \ -13,759}  &  \ 707  & \textbf{\cellcolor{lightgray}  \textcolor{red}{ \ -428,589}}  & \cellcolor{yellow}  \ 2,890  & \cellcolor{yellow}  \ 88,646  \\      \hline      \hline      \end{tabular}     \end{adjustbox}     \end{center}          \end{document}


title: How to put a LaTeX project (template) under a license

text: This is mostly off topic, but related to LaTeX. I have a template which contains about 40 files in different folders. And additionally some packages (`.sty` files) which shall be published soon. The packages contain the typical copyright statement and _LaTeX Project Public License_ lines. Are these also necessary in the `.tex` files which contain the docs or can I create a `licence.txt` file for the whole folder? For the template I also wonder if I can put everything under a license with a single file. Putting 10-30 lines of license statement in each file is something I want to avoid.


title: Undefined \pgfsetpath: is tikz or Miktex update responsible

text: I run the following simple example using `MikTeX` 2.9 (complete installation) that is regularly updated (this is one of the first examples in TikZ manual):               \documentclass{article}     \usepackage{tikz}     \usetikzlibrary{arrows,calc,intersections}     \begin{document}     \begin{tikzpicture}      \path [name path=onek, draw] (2,0) -- (2,4);      \path [name path=twok, draw] (0,0) -- +(30:4);     \draw [name intersections={of=onek and twok, by=x}]     [very thick,red] (2,0) -- (x);     \end{tikzpicture}     \end{document}      and get the error message:               ! Undefined control sequence.     <recently read> \pgfsetpath           l.44 ...me intersections={of=onek and twok, by=x}]          ?       Here is the result of `\listfile`:                *File List*      article.cls    2007/10/19 v1.4h Standard LaTeX document class       size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)         tikz.sty    2008/02/13 v2.00 (rcs-revision 1.27)          pgf.sty    2008/01/15 v2.00 (rcs-revision 1.12)       pgfrcs.sty    2008/02/20 v2.00 (rcs-revision 1.21)       pgfrcs.code.tex      pgfcore.sty    2008/01/15 v2.00 (rcs-revision 1.6)     graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)       keyval.sty    1999/03/16 v1.13 key=value parser (DPC)     graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)         trig.sty    1999/03/16 v1.09 sin cos tan (DPC)     graphics.cfg    2007/01/18 v1.5 graphics configuration of teTeX/TeXLive       pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX     infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)      ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)       pgfsys.sty    2008/02/07 v2.00 (rcs-revision 1.31)       pgfsys.code.tex     pgfsyssoftpath.code.tex    2008/01/23  (rcs-revision 1.6)     pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)       xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)        color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive      pgfcore.code.tex     pgfcomp-version-0-65.sty    2007/07/03 v2.00 (rcs-revision 1.7)     pgfcomp-version-1-18.sty    2007/07/23 v2.00 (rcs-revision 1.1)       pgffor.sty    2007/11/07 v2.00 (rcs-revision 1.8)      pgfkeys.sty          pgfkeys.code.tex       pgffor.code.tex         tikz.code.tex     supp-pdf.mkii      I guess some of my PGF files must out-dated, and I am puzzled why my frequent updates using MikTeX update tool have not worked.


title: How can I change margins in "elsarticle" document class?

text: I am using "elsarticle" document class for my Elsevier paper and I want to change the margins in all side to 2.5cm. How can I do this? I used the code below:               \documentclass{elsarticle}          \usepackage{amssymb}          \doublespacing          \begin{document}          \begin{frontmatter}          \title{...}          ....          ....          \nocite{*}          \bibliographystyle{elsarticle-harv}          \bibliography{pose}          \end{document}      I used the code below to control the margins, but the height of the text is not proper.               \oddsidemargin = 0cm     \topmargin = 0cm     \textheight = 25cm     \textwidth = 16cm      because A4 paper is 21*30cm and I reduced 5cm and wrote 15*25 without any excess margin. What is the solution? regards.


title: Draw a Cyclic State Machine with xypic

text: I want to draw the following diagram : ![enter image description here](http://i.stack.imgur.com/ijKXV.png)               \documentclass[11pt,twoside,a4paper]{book}     \usepackage[margin=0.45in]{geometry}     \usepackage[all]{xy}               \begin{document}          \begin{figure}[ht]      \[\xymatrix{&&&&& n+1 \ar[r]^{\sigma} & \dots \ar@{..}[dd]\\     0 \ar[r]_{\sigma} & 1 \ar[r]_{\sigma} & 2 \ar[r]_{\sigma}  \cdots &  n-1     \ar[r]_{\sigma} & n \ar[ru]^{\sigma} & &\\     &&&&&   n+m-1\ar[lu]^{\sigma}  & \ar[l]^{\sigma}\dots      }\]     \caption{Cyclic State Machine}     \end{figure}          \end{document}          This produces :   ![enter image description here](http://i.stack.imgur.com/yL1ra.png) Which is not like I want. How can I draw my desired figure ?


title: Multiple TeXlive installations

text: I'm using Lubuntu 11.10. I have TeXlive 2011 full insttaled. I've just installed TeXlive 2013 running `install-tl` script. Everything was fine. I choose the small scheme. No problem. So according to the guide we should do this: > After the installation finishes, you must add the directory of TeX Live > binaries to your PATH—except on Windows, where the installer takes care of > this. For example: > > `PATH=/usr/local/texlive/2013/bin/i386-linux:$PATH` > > Use the syntax for your shell, your installation directory, and your binary > platform name instead of i386-linux. No problem until here. I changed my `$PATH` and when executing `pdflatex --version` on the terminal I got > pdfTeX 3.1415926-2.5-1.40.14 (TeX Live 2013) kpathsea version 6.1.1 But I'd like to know how to take care of the last suggestion: > If you have multiple TeX installations on a given machine, you need to > change the search path to switch between them. How to do that?


title: lstlisting in a tabular enviroment

text: I am following Adding C++ code in Latex for adding C++ code to the document. What I have is a table with the following format:               \documentclass[12pt,a4paper,final]{report}     \usepackage[utf8]{inputenc}     \usepackage[english]{babel}          \usepackage{booktabs}     \usepackage{xcolor}     \usepackage{listings}     \lstset { %         language=C++,         backgroundcolor=\color{black!5}, % set backgroundcolor         basicstyle=\footnotesize,% basic font setting     }          \begin{document}       \begin{table}[H]         \caption{C++ DIC class functions.}         \centering         \begin{tabular}{l c c c}         \toprule[0.2em]              \textbf{Function in C++} & \textbf{Input} & \textbf{Output} & \textbf{Document corresponding chapter}\\              \midrule         \multicolumn{4}{c}{Main setup and API functions. Public functions.}\\         \begin{lstlisting}          initialize()          \end{lstlisting}          &sdf & df&f \\         \bottomrule              \end{tabular}         \end{table}     \end{document}      My problem is that when I use the lstlisting envirometn there I only want the "gray" background in the first column, not in the whole line. How can I do that?


title: Drawing of Sun–Earth–Moon system

text: Is there a package (or packages) for drawing the Sun–Earth–Moon system with either PSTricks, TikZ, or some other vector graphics language to illustrate Lunar and Solar eclipses, the phases of the Moon, and the seasons on the Earth? I know of `pst-solarsystem` but it is not what I'm looking for; here, it is 'only' possible to draw the planets moving in circular orbits around the Sun.


title: How to share selected options between different nodes in TikZ?

text: (I didn't find a better title for the question. Suggestions are welcomed.) I have created some new shapes in TikZ and I would like to put one of them below another one when a certain key is passed to this last node. I'll show better what I mean with an example using two rectangles:               \documentclass{article}          \usepackage{tikz}     \usetikzlibrary{patterns,calc}          \tikzstyle{ground}=[append after command={;\node[draw=red,rectangle,anchor=north] (B) at (\tikzlastnode.south){a}}]               \begin{document}     \begin{tikzpicture}       \node[draw,rectangle,ground,rotate=10] (A) at (0,0){a};% not good       \begin{scope}[shift={(1,0)}]         \node[draw,rectangle,rotate=10] (B) at (0,0){a};         \node[draw=red,rectangle,anchor=north,rotate=10] (C) at (B.south){a};% OK       \end{scope}     \end{tikzpicture}     \end{document}      ![stacked nodes](http://i.stack.imgur.com/MPDkv.png) As you can see, I've created a style that appends to the first node the creation of the second one referred to it correctly. Everything works fine, but, if I need to, for example, rotate both shapes together, I can't find a solution because only the first rectangle is rotated (left). The only way I achieved the desired result has been the one shown in the code, where I had to manually draw the second node and pass to it the `rotate` option. So, there is a way to achieve the desired result (on the right) but using the syntax of the first example (on the left)? Notice that both the real shapes involved has been drawn by me so if they need to be customized it is ok.


title: How to make sure numbers is in upright

text: How to define a function, say `\makenumberup`, when it apply to simple strings, it makes all numbers (not math!) in upright? So `\makenumberup{Year 2010.}` will equivalent to `Year \textup{2010}.`


title: How can I made the final column in a table paragraph formatted (line breaks), while still being constrained by the total table width?

text: I have a table that will have substantial amounts of text in the final 2 columns, and I can't figure out how to define the columns in a way that works for that. My original attempt was as follows:               \begin{tabulary}{\textwidth}{ | c | c | c | c | p{2.5 in} | l | }      This has the result of making the final column not break, and extend well past the edge of the page (does not conform to `\textwidth`). I _could_ do something like this:               \begin{tabulary}{\textwidth}{ | c | c | c | c | p{2.5 in} | p{2.5 in} | }      I dislike that, because then the original `\textwidth` definition is being totally overridden, meaning I need to hard code widths for the first 4 columns as well, and I miss out on LaTeX's ability to juggle widths dynamically to make stuff look nice. For reference, leaving all widths undefined and using "L" for both of the final columns crushes the second to last column down in a way that looks awkward, because the final column has a lot more text in it.


title: Indent a code listing in LaTeX

text: For a little LaTeX document I am writing I would like to insert source code fields (in SQL) into my paper. I found out that I can use the listings package for this, which works well so far:               \usepackage{color}     \definecolor{light-gray}{gray}{0.95}          \usepackage{listings}      \lstset{numbers=right,                      numberstyle=\tiny,                      breaklines=true,                     backgroundcolor=\color{light-gray},                     numbersep=5pt}      \lstset{language=SQL}       This works well so that I can insert code listings like:               \begin{lstlisting}{insert}     INSERT INTO Tabelle (Spalte1, Spalte2, Spalte3) VALUES (Wert1, Wert2, Wert3);     \end{lstlisting}      What it shows me are light-gray boxes containing the code, but they start at the beginning of the line, just like the text. I now would like to have code listings automatically being **indented a bit**. So that the gray box doesn't start at the level of the text. Can anybody tell me how to achieve this? I am quite a beginner at working with LaTeX... would be great if anyone could help!


title: How to use TODO and FIXME in Latexila?

text: I am using Latexila 2.4 on Ubuntu 12.10. In the GUI there is an option to view TODO and FIXME (green tick on my screenshot), but I have no idea how I can mark up text in the source so it would show up there. I could not find any reference on the web either. How to use TODO in Latexila? ![enter image description here](http://i.stack.imgur.com/1jyko.png)


title: beamer: grouping elements together

text: I am using beamer for creating my presentation. Sometime I create elementary objects (like geometrical shapes and arrows) by using tikzpicture and I place them in the slide by using textblock. I would like to know if there is a way of bonding different elements together (like text, equations and geometrical objects), so that I can move them easily around the slide as one piece.


title: Simultanious use of relative positioning and "of" notation

text: A rather high node has a not so high node on its rigth side. I like the positioning and sizes, but i want both node to share the same Y-Axis of their north border.               \tikzstyle{big}  =[rectangle, draw=blue, text centered, minimum height=60]     \tikzstyle{small}=[rectangle, draw=black, text centered, minimum width=60]          \begin{tikzpicture}          \node[big]   (l) {Left  High};     \node[small] (r) [right of = l, anchor = west] {Rigth  Low};          \end{tikzpicture}      Here is a brute force example where only the Y-Axis alignes the way i would like it.               \node[big]   (l) at (0,0) [anchor = north] {Left High};     \node[small] (r) at (3,0) [anchor = north] {Right Low};      My goal is to still use the `[right of = l]` notation and also use reference `l.north` somehow to set `r.north = l.north`.


title: Too much time spent in compilation

text: I have created my thesis and I have a problem enough annoying. I have created the appendix of my thesis and put into all tables. I used as font `mathptmx`. When I try to compile it takes so much time about 40 minute. This is a part of my main file:               ...          \usepackage{mathptmx}          ...          \begin{document}       \input{appendix}     \end{document}      When I comment that line or use another font, I got a fast compilation. I don't know the reason. The problem is I can't post all the appendix because there are too many table. What do you suggest to solve the problem?I have to use `mathptmx` so I can't change font **EDIT** LOG FILE -> http://pastebin.com/yc0Fc3zd


title: Left numbered equation inside list environment

text: I use the `mathtools` package with the `leqno` option in the `memoir` class. When inside a `list` environment, the equation label is misaligned.               \documentclass{memoir}          \usepackage[leqno]{mathtools}          \begin{document}     \begin{enumerate}     \item Inside list:       \begin{equation}         x=y.       \end{equation}     \end{enumerate}          Outside list.     \begin{equation}       x\neq y.     \end{equation}          \end{document}      ![enter image description here](http://i.stack.imgur.com/U27Qr.png) Does anyone know a workaround to this? I've tried changing some list spacing lengths before the display environment but that did not work.


title: BibTeX error "inputenc Error: Unicode char \u8: not set up for use with LaTeX"

text: So I am trying to get BibTex to work and I run into the above error: . After a quick search in here I found that it is a problem with extra space in the BibTex file that could be solved by adding the `\DeclareUnicodeCharacter{00A0}{~}` to the preamble. So I did that but I still get the error. I have added the part of the preamble where I have added the line. Can anyone see where I'm going wrong? (Using Texmaker on mac)               \usepackage[Lenny]{fncychap}              \usepackage[english]{babel}       \usepackage[T1]{fontenc}              \usepackage[utf8]{inputenc}         \DeclareUnicodeCharacter{00A0}{~}     \usepackage{verbatim}                 \usepackage{shortvrb}                 \usepackage{courier}                  \usepackage{ae}                       \usepackage{booktabs}                 \usepackage{color}                    \usepackage{enumerate}                \usepackage{longtable}                       \usepackage{palatino}                    \usepackage{footmisc}                            \usepackage{eso-pic}     \usepackage[font={small}]{caption}


title: How to re-define the chapter-mark without changing the Appendix heading?

text: The document is `book` class and the Appendix is added by:                ...     \backmatter      \appendix     \chpater{Appendix A}       ...     \chpater{Appendix B}       ...      Using `fancyhdr`:               \usepackage[]{fancyhdr}     \pagestyle{fancy}     \fancyhf{}     \fancyhead{}           \renewcommand{\sectionmark}[1]{\markright{\thesection ~ \ #1}}     \renewcommand{\chaptermark}[1]{\markboth{ \chaptername\ \thechapter ~ \ #1}{}}           %head setting     \fancyhead[LE]{\textcolor{black} {\thepage}}     \fancyhead[RE]{\textcolor{black} {\itshape \nouppercase  \leftmark}}%higher level \scshape  \MakeUppercase     \fancyhead[LO]{\textcolor{black} {\itshape \nouppercase  \rightmark}}      \fancyhead[RO]{\textcolor{black} {\thepage}}   %odd page      The chapter-mark is expected to be re-defined like `Chapter 2 State of the art`, However, the `\chaptername` will appear in Appendix heading. So how to solve this issue? ![enter image description here](http://i.stack.imgur.com/xLD5W.png)


title: How to control mdframed on multiple pages?

text: > **Possible Duplicate:**   >  Conserve the frame in a mdframed box that spans more than one page I am using mdframed for writing citation information but citation list is too long which comes in 2-3 pages.Mdframed automatically spreads on multiple pages but with open box. How can i close box on each page dynamically. ![enter image description here](http://i.stack.imgur.com/HG6yH.png) Desired Output: ![enter image description here](http://i.stack.imgur.com/dbVfN.png)


title: In-line long division symbol (French style)

text: I am looking for long division symbol for inline use. For US style there are several choices. For displayed long division, French style, there is `xlop` package. I am looking for the inline version, French style, which, for `$x \div y$`, would look something like an `$x\ L y$` with `$y$` inside `$L$`.


title: TikZ: an arrow with two parts

text: I would like to reproduce the following picture using `TikZ`. The arrow is split into two halves, and each half has a particular color and text. The two colors I chose are not important. ![enter image description here](http://i.stack.imgur.com/nY7bC.png)


title: subimport including wrong file

text: I am trying to learn the _import_ package but I find it extremely unreliable - perhaps I am missing something? One case study I tried is as follows: Created 3 tex files:   * ./main.tex   * ./bla.tex   * ./X/bla.tex main.tex:               \documentclass{article}     \usepackage{import}     \begin{document}     \subimport{X/}{bla.tex}     \end{document}      bla.tex               BLA      X/bla.tex               XBLA      However, when compiled, in the produced pdf I see `BLA` instead of `XBLA` as I have expected. Only when I remove the file ./bla.tex (or change its name), the correct one X/bla.tex is included and `XBLA` appears in the pdf. What is going on? How can I make it work? In my real-life case scenario with much bigger file structure, I have some common file names in each directory, such as `config.tex` and cannot afford making each name unique.


title: How to use italic correction for slanted letters (\textsl)?

text: Is there italic correction specific to slanted letters (`\textsl`)? I always use `\textsl` for slanted letters (not `\slshape`), so would redefining `\slshape` to add an `\/` at the end be the easiest way of adding italic correction to slanted letters in my documents?


title: Problem formatting a subscript in math mode

text: $\nu_{\rm FWHM}$      prints FWHM too large. But when I try:               $\nu_{\mbox{\tiny FWHM}}$      the size is okay but the kerning looks wrong. What is the best way to make a compact little FWHM subscript tag on my variables? **Solution:**               $\nu_{\textsc{\tiny fwhm}}$          \newcommand{\FWHM}{{\textsc{\tiny fwhm}}}     $\nu_\FWHM$


title: Creating multiple output files, with content that depends on a variable

text: I'd like to write a template for a letter, which is meant to be sent to many people. Thus, the content should change slightly depending on who is the addressee. For instance, I imagine that the template could be something like the following:               \begin{letter}          if the addressee is A:       \opening{Dear A,}     if the addressee is B:       \opening{My dear B,}          ...          if the addressee is B:       By the way, I really miss you, B!          ...          \end{letter}      Then, I'd like to create one or many pdf files with the letters, specifying somehow the list of the addressees (also a Makefile or something else would be fine for the rendering, if you can explain how to pass the name of the addressee to pdflatex).


title: Drawing this directed graph in Latex

text: I am trying to draw a picture like the following in a Latex document file. I have tried to use Xfig, but when I want to draw a line it does not stop. I mean, there is no end point for the line (I use mac). My question is that is there a program, which is compatible with mac and the pictures can be be exported to a Latex file, to draw a pictures like the following? Or is there any way to draw it in xfig? ![Any Picture like this](http://i.stack.imgur.com/lhlrc.png)


title: Convex lens (flat end) with pst-optic

text: Is it possible to get each end of a convex lens to be flat, like this: ![enter image description here](http://i.stack.imgur.com/dZcCM.png) (I haven't been able to find anything regarding this in the manual.)


title: Finding the package of a Detexify Symbol

text: I was simply messing around on a website called: Detexify just drawing various math symbols, when I came across a cool and interesting symbol of a fax machine. The following command for it being: `\Faxmachine` My question was, does anyone know what **package** is needed to be able to compile with the command in the tex file because I keep getting undefined control sequence.


title: Calculate font metrics for glyphs inside MetaPost figures

text: I'm looking for a way to calculate the ascent and descent of a character glyph after it has been scaled and then drawn into a MetaPost figure. With TikZ, I can do this fairly easily by performing calculations on the bounding box of a node containing the character:               \usemodule[tikz]     \usetikzlibrary[calc,positioning]        \newdimen\yone     \newdimen\ytwo     \def\tikzmetriccalc#1#2#3{       \pgfextracty{\yone}{\pgfpointanchor{#1}{#2}}       \pgfextracty{\ytwo}{\pgfpointanchor{#1}{#3}}       \pgfmathparse{ \yone - \ytwo }       \yone=\pgfmathresult pt     }          \starttext         \starttikzpicture[char node/.style={       scale=10,text=black!40,inner sep=0pt,outer sep=0pt}]          \node[char node] at (0,0) (char) {g};          \draw[ultra thick] (char.base west) -- (char.base east)       (char.north west) -- (char.north east)       (char.south west) -- (char.south east);     \draw[color=red,ultra thick,<->,>=stealth] ([xshift=10pt]char.base west) --       ([xshift=10pt]char.north west);     \draw[color=red,ultra thick,<->,>=stealth] ([xshift=-10pt]char.base east) --       ([xshift=-10pt]char.south east);          \tikzmetriccalc{char}{north}{base}     \node[above=0.25em of char.north] {\bf Ascent = \the\yone};          \tikzmetriccalc{char}{base}{south}     \node[below=0.25em of char.south] {\bf Descent = \the\yone};          \stoptikzpicture     \stoptext      _Note that these example use ConTeXt. The latest version of PGF fromTLcontrib may be required in order to use TikZ with ConTeXt MKIV_ This gives the following output: ![Font metrics in TikZ](http://i.stack.imgur.com/LUnjN.png) I can also shortcut this by using the `width` and `depth` functions inside `\pgfmathparse` and multiplying the result by the scaling factor applied to the node. * * * Here is my attempt to reproduce the above figure using MetaPost:               \starttext         \startMPpage            picture c;       c := thelabel(btex g etex scaled 10, origin); draw c;            pickup pensquare scaled 1pt;       draw (ulcorner c -- urcorner c) withcolor red;       draw (llcorner c -- lrcorner c) withcolor red;       drawdblarrow (llcorner c -- ulcorner c) xshifted 10pt withcolor red;            h := (ypart ulcorner c) - (ypart llcorner c);       label("Height = " & (decimal h), up * (ypart ulcorner c + 10pt));            setbounds currentpicture to boundingbox currentpicture enlarged 2mm;          \stopMPpage        \stoptext      This gives the following output: ![MetaPost metric calculation attempt](http://i.stack.imgur.com/r33c9.png) Now, I have two problems:   1. I am only calculating the total height of the glyph because I cannot find a MetaPost equivalent to the TikZ `base` anchor that gives me the position of the baseline.   2. My measurement is not being returned in units of points as the double arrow has been right-shifted by 10pt and that is a far smaller distance than the overall height of the character. Could anyone suggest an appropriate method of calculating ascent and descent inside a MetaPost graphic? * * * ### Update Here's part of egreg's first example, re-worked to compile with ConTeXt MKIV:               \starttext     \startMPpage       picture c;       c := thelabel(btex g etex scaled 10, origin); draw c;            h := \the\fontcharht\font`g;       d := \the\fontchardp\font`g;            % Solve a linear equation to find coordinates of the baseline.       z1+(0,10h)=ulcorner c;       z2+(0,10h)=urcorner c;            pickup pensquare scaled 1pt;       draw (ulcorner c -- urcorner c) withcolor red;       draw (llcorner c -- lrcorner c) withcolor red;       draw (z1 -- z2) withcolor red;       drawdblarrow (z1 -- ulcorner c) xshifted 10pt withcolor red;       drawdblarrow (lrcorner c -- z2) xshifted -10pt withcolor red;            label("Ascent = " & (decimal 10h) & " pt", up * (ypart ulcorner c + 10pt));       label("Descent = " & (decimal 10d) & " pt", up * (ypart llcorner c - 10pt));            setbounds currentpicture to boundingbox currentpicture enlarged 2mm;     \stopMPpage          \stoptext      The output is exactly what I am looking for: ![Font metrics in MetaPost](http://i.stack.imgur.com/WfYxA.png) A key insight was using the eTeX primitives `\fontcharht` and `\fontchardp` to access the font metrics. These numbers can be assigned to variables in the MetaPost code when prefixed with `\the`. Another neat trick was using the ability of MetaPost to solve linear systems to calculate the coordinates of the baseline.


title: tikz dim all colors

text: In tikz, is there a way using a scope environment of some form to "dim" a group of elements? By "dim", I mean that for every color (be it stroke, fill, or font):               I want the color (R,G,B)!x to be mapped to (R,G,B)!(x/2)      Concrete examples:               black!100 => black!50;     blue!100 => blue!50;     blue!60 => blue!30;      Please let me know if there is anyway I can improve this question to meet standards.


title: Effort to make (La)TeX eBook-friendly

text: Does anyone know whether there is an organized effort to develop (La)TeX classes/packages specifically designed to create ereader-friendly PDFs? My question is not _how_ to create such PDFs using LaTeX, since Lev Bishop provides a fine summary of currently available methods in an answer to this question. Edit: Would it be feasible to generate usable epub (or [insert your favorite eBook format here]) documents using LaTeX? I'm not very familiar with how epub documents/readers manage font-scaling, etc. If so, is there a project to create a program that would do this? Also, I leave _ereader-friendly_ open to your interpretation, but some features I had in mind are   * ereader-specific page sizes (with small margins by default);   * increased minimum font size;   * a font thicker than CM (by default).


title: how to import multiple branch cases structure into LaTeX document.

text: Could I set up a structure for several cases so that I could get a TeX command branch say, behavior as below: * * * **if case A**   * if case A1 `\cmdAi{arg1}`   * elseif case A2 `\cmdAii{arg2}`   * elseif case A3 `\cmdAiii{arg3}`   * endif **elseif case B**   * elseif case B1 `\cmdBi{arg4}`   * elseif case B2 `\cmdBii{arg5}`   * end if **endif** * * * the case A1~case B2 is given in advance, say, from the ordered collection (maybe its form is `{\`a,\'a,\^a,`A,\^A}`). I knew the `ifthen` package, but it is too simple (or to complicated?) to use conveniently. A intuitive explain: this demand is related to the modal logic and semantics. Think about a given alphabetic chain of _n_ bit (n less than 16), say,               TxFxyxxTyxTFyT          zTyxTzzxxTyxF      etc. The character `T` denoted "True" or constant have value 1, the character `F` denoted "False" or constant have value 0, the other character `x`, `y`, `z`, and so on denoted variables whose value between 0 and 1 (not have to equal). After we assigned for the variables, I want to print the result like: > the chain given above has valuables [#1] (@1) times (or print which places > has [#1] appeared in), [#2] (@2) times, [#3] (@3) times, ... and their > weight sum is ... the [#1], [#2], [#3], etc. is the `x`, `y`, `z`, respectively; the (@1), (@2), (@3), , etc. mean as former.


title: Errors when trying to insert graphics file

text: I want to include a graphics called quadratic.pdf in my LaTeX document, which only contains the image show below. While compiling, I get the following errors:               Line 1: Fatal Error No output file produced           Line 5: !LaTeX error. File: 'quadratic.pdf.sty' not found.       Where am I going wrong? ![Quadratic.pdf](http://i.stack.imgur.com/pm10E.png)               \documentclass[oneside]{book}          \usepackage{graphicx}     \usepackage{quadratic.pdf}          \begin{document}          \chapter*{Basic Graphics}          \begin{figure}[h]     \centering     \includegraphics[width=0.5\linewidth]{quadratic}     \caption{The graphics file named \texttt{quadratic}.}     \end{figure}          \end{document}


title: Undefined control sequence at end{document}

text: I am a new latex user. I encountered an "Undefined control sequence at `\end{document}`, but I do not understand the problem as end{document} is supposed to be a normal function in latex. My code can be found: https://www.sharelatex.com/project/52da502aa5d18bc436000021#


title: Memoir page headers and minipage

text: I'm trying to work with a custom pagestyle. I want to have the chapter name and the section name in the odd page header... but I also need to use a mini page environment (or WANT to use one anyway) and latex is not recognizing a section in the minipage... I tried it with parbox as well and it also won't work. Any ideas other than abandoning the minipage.               \documentclass[12pt]{memoir}           \usepackage{lipsum}     \makepagestyle{teststyle}     \makeoddhead{teststyle}{}{\leftmark * \rightmark}{\thepage}      \makeevenhead{teststyle}{\thepage}{ book name}{}     \makepsmarks{teststyle}{%     \createmark{chapter}{both} {nonumber}{ }{. \ }     \createmark{section}{right} {nonumber}{ }{. \ }}          \pagestyle{teststyle}               \begin{document}     \chapter{Name of Chapter}               \noindent\begin{minipage}[t][][b]{0.25\textwidth}     \small This is on the Left     \end{minipage}     \begin{minipage}[b][][t]{.5\textwidth}     \section{Name of Section}     \end{minipage}     \begin{minipage}[t][][b]{0.25\textwidth}     \hfill \small This is on the right     \end{minipage}                    \lipsum     \lipsum     \lipsum          \section{Non Minipage Section}     \lipsum     \lipsum               \end{document}


title: What's the status of beamer's development?

text: As I understand it, maintenance of `beamer` was taken over by Joseph Wright. I am interested to know if a new version is planned, for when, which features are expected in it, and what's the proper way of submitting suggestions? Here are some of the things I would like to see, but I am far from being an expert, not even a seasoned user.   * Better control of overlays that would make it possible to design complex animations.   * Columns with automatic overflow from one column to the other   * Tighter integration with `tikz`, or perhaps more material in the manual to explain how graphics can be included.   * Built in support for pop-ups/callouts.   * User defined modes


title: MiKTeX created pdf looks too pale

text: I searched the web and saw that this is a well-known problem and there are some solutions recommended. One of them is that I found on this website. Most of the websites say that created pdf looks too dim because of font problem, by default it is given as such, and if we want to have better pdf's where the written things are more readable; we need to change this default property. So here comes my problem: They say that I should change `dvipsPreferOutline` true in `updmap.cfg` to false. However I cannot seem to change this cfg file. In this file, and the manual of MiKTeX, they say we can change this cfg file by running               initexmf --edit-config-file updmap.cfg         I have windows7, so I open "run" and write this comment there and it opens a text file named `updmap.cfg` that is empty. I tried to write there `dvipsPreferOutline false` and save but nothing changed. So here is my question; how can I edit `updmap.cfg` to get better looking pdf's?


title: Problem using enumerate environment in a proof newenvironment definition

text: I want to define a simple environment to enclose my proofs, actually I just wanted to put a little square right at the end. So, I made this new environment definition:               \newenvironment{Proof}{ \flushleft \textbf{PROOF}}{\rule{1ex}{1ex}}      When I use this environment to enclose simple text, then I get the little square right at the end, after the last character. The problem is when I enclose an `enumerate` environment because it adds a new line and put the little square at the beginning. In this case my problem is both I don't want the new line and also I need the square at the right ending of the margin. If I consider it this way               \newenvironment{Proof}{ \flushleft \textbf{PROOF}}{\begin{flushright} \rule{1ex}{1ex} \end{flushright}}      then a new line is always added.


title: In which order should I load inputenc and fontenc?

text: When I’m using pdfLaTeX, my preamble usually contains               \usepackage[utf8]{inputenc}      and               \usepackage[T1]{fontenc}      **Should these two be loaded in any particular order?** What problems could arise if they’re loaded in the “wrong” order? On a related topic, I know that `fontenc` should come _after_ font packages, as described in Should the fontenc package be loaded before or after font packages?, so I’d move font packages along with `inputenc` – unless there’s a catch as well, which would indicate something like   1) font package(s) 2) `inputenc` 3) `fontenc`?


title: Typesetting document with different custom titles

text: To begin with, I'm not even sure if tex has this functionality, but let me try to explain what I'm trying to do. So I'm keeping a work log in tex format, that I try to update every now and then. So far, I've been making a new section for every day I add things. So my sections look like               \section*{February 05, 2013}     % tables, figures, text, etc..     \section*{February 06, 2013}     % other tables, figures, text..      Although it is nice to keep chronological order when I'd like to go back to see when I did something, this messes up the contextual order of things. So equivalently, I may have a version of my log that looks like               \section*{Instrumentation}     % tables, figures, text, etc..     \section*{Ordered Parts}     % other tables, figures, text..      And, as you already guessed, the chronological order and the contextual order don't match. So what I'm trying to do is set up a way to typeset in my choice of order. I'd like to be able to specify that I want contextual order, and I want the compiler to extract information that belongs to the same contextual section from different chronological sections, and typeset accordingly. Like I said, I don't even know if this is possible with tex, but any help or suggestions on other platforms to do this would be appreciated.


title: How can I get a very wide table to wrap all three rows within the margins?

text: I have a series of tables that are going to be very (very!) wide, but with only 3 rows. Is there any way I can get the tables to wrap within my margins, without having to break the rows within the `.tex` file itself?


title: Dijkstra's handwriting font in LaTeX?

text: Does anyone know of a painless way of producing a LaTeX document using Dijkstra's handwriting font? EDIT: For those who would like more context on the above question, here follows a beautiful real-life sample of Edsger Dijkstra's penmanship. A truetype version of it can be found here.


title: Orthogonal direct sum

text: Several authors use a circled perpendicular sign to indicate orthogonal direct sums. What is the appropriate way to implement this, so you can use it like `\oplus` and `\bigoplus` ?


title: How to vertically center text in a table cell with multiple lines?

text: I want to vertically center "Apple iPad". Does someone here knows how to do that? ![enter image description here](http://i.stack.imgur.com/EyZXB.png) My code looks like this:               \begin{table}[H]       \noindent          \centering{}           \begin{tabular}{cc}           \hline                 \noalign{\vskip\doublerulesep}           Modellname & Display-Auflösung \\ ~ & (in Pixel)                 \tabularnewline[\doublerulesep]           \hline           Samsung Galaxy SIII & 1280x720                 \tabularnewline[\doublerulesep]                         Samsung Galaxy SII & 800x480                 \tabularnewline[\doublerulesep]                Apple iPad & 1024x768 (Standard)           \\ ~ & 2048x1536 (Retina)                 \tabularnewline[\doublerulesep]                         Samsung Galaxy Tab 2 (7.0) & 1280x720                 \tabularnewline[\doublerulesep]                         Samsung Galaxy Y & 320x240                 \tabularnewline[\doublerulesep]                         Sony Ericsson Xperia Arc HD & 1280x720                 \tabularnewline[\doublerulesep]                Amazon Kindle Fire & 1024x600                 \tabularnewline[\doublerulesep]                Google Nexus 7 & 1280x800                 \tabularnewline[\doublerulesep]                         SamsungGalaxy Tab 2 (10.1) & 1280x720                 \tabularnewline[\doublerulesep]                Motorola Droid Razr 4G & 960x540                 \tabularnewline[\doublerulesep]                                \hline           \end{tabular}     \end{table}


title: Differences and best practices: \onslide vs. \uncover, \onslide+ vs. \visible, \onslide* vs. \only?

text: Page 81 of the Beamer v3.20 user guide describes the behavior of the `\onslide` command. In particular, there are three forms when the optional text argument is given:   * `\onslide⟨overlay specification⟩{⟨text⟩}`,   * `\onslide+⟨overlay specification⟩{⟨text⟩}`, and   * `\onslide*⟨overlay specification⟩{⟨text⟩}`. According to the user guide, > If a ⟨text⟩ argument is present, `\onslide` (without a ⟨modifier⟩) is mapped > to `\uncover`, `\onslide+` is mapped to `\visible`, and `\onslide*` is > mapped to `\only`. This raises three questions:   * Is this mapping an exact correspondence?   * If so, what is the point of allowing `\onslide` to accept an optional ⟨text⟩ argument: why not just require users to use `\uncover`, `\visible`, and `\only` directly?   * Also, if so, is there any reason to prefer one form over the other as a best practice?


title: Natbib sorting and citation order by appearance

text: I've started writing my thesis using LaTeX (as recommended by the school) and as a complete novice at it, I've been stuck trying to figure out how to change the citation by order of appearance. I'm using the natbib package and a custom bibliography style that I found on the net, with my referencing going by the author-year (John et al., 2005) style as opposed to numeric [1,3]. I have done some searching but most of my results come up with people using the numeric system and being a complete beginner at this, I have yet to tinker around with something that works. The citation I have currently looks like this: (Frank et al., 2005; John et al., 2002; Matthew, 2008) I would like to sort it by year or turn off sorting so it will show up in the order I type it in the document. E.g.: (John et al., 2002; Frank et al., 2005; Matthew, 2008) The citing and bibliography itself are perfect, I'm only concerned with the citation order being unsorted (or sorted by appearance in the document), as currently it is sorting everything alphabetically by name. So my question is, how would one achieve sorting the references in the citation by appearance (or turning off alphabetical sorting) using natbib and a customized bibliostyle? And if that is not possible, could someone point me in the right direction on obtaining a similar effect? Thank you in advance for your time and help.


title: Typsetting UML class diagrams

text: What's the best way to draw UML class diagrams in LaTeX?


title: Is there any package to model use diagrams of UML?

text: > **Possible Duplicate:**   >  Typsetting UML class diagrams I need to model some diagrams UML, specially use cases, but I didn't find a good package to do this, I found **UML for LaTeX/MetaPost** however it doesn't have good results as I wanted. Do you have a package or template for this goal?


title: Converting to bibitem in LaTeX

text: For a conference I have to put the references in `\bibitem` format. After, Googling I came up with this solution by Web page: > Create a `refs.bib` file with all the BibTeX entries, which are easily > available from Google Scholar or similar > > Create a “dummy” `.tex` file with the following entries: >   >   >     \documentclass{article} >     \begin{document} >     \nocite{*} >     \bibliography{refs} >     \bibliographystyle{plain} >     \end{document} >   > > Now, do the following: >   >   >     $ latex dummy >     $ bibtex dummy >     $ bibtex dummy >     $ latex dummy >   > > You will see a `dummy.bbl` file containing all your BibTeX entries in > \bibitem format. but, the expected results was not observed for me. Any other solution or the problem with the mentioned process.


title: Right align chapter number to the chapter name when using memoir with veelo style

text: I am using the `memoir` document class and the `veelo` chapter style. I'm having trouble aligning the chapter number to the right so it has the same right margin as the section name. Because of the page margins the black rectangle on the right of the chapter number does not appear. Part of the code I am using:               \documentclass[a4paper,12pt,twoside]{memoir}     \chapterstyle{veelo}     \settypeblocksize{252mm}{165mm}{*}      \setlrmarginsandblock{25mm}{20mm}{*}      \setulmarginsandblock{20mm}{25mm}{*}      ...     \chapter{Introduction}      When I compile I get what is on the left of the image below and I want to obtain what is on the right side. ![Chapter style image](https://dl.dropbox.com/u/59732047/veelo.png) Thank you.


title: Space between two instances of a self-defined environment

text: I have created an environment for my excercises. The problem now is, that if I have different excercises (Excercise 1, Excercise 2 and so on) there is always a little space between them. I have a background color and this is interrupted, so it looks quite stupid. I want to have no interruption so the color is not interrupted. How can I do this? I do not know how to modify the definition of my environment to teach LaTeX to not do any spaces between it.... Here is my code:               \documentclass{book}     \usepackage{geometry}     \geometry{left=4cm,right=3cm, top=2cm, bottom=2cm}      \usepackage[ngerman]{babel}     \usepackage[final]{pdfpages}      \usepackage{xcolor,bookmark}              \usepackage{graphicx}       \usepackage{multicol}      \usepackage[bottom]{footmisc}     \usepackage{shadethm}     \usepackage{amsthm}     \usepackage{amsmath}     \usepackage{paralist}     \usepackage{amssymb}     \usepackage[framemethod=tikz]{mdframed}          \definecolor{aufgaben}{rgb}{0.9333,0.93333,0.933333}          \newtheoremstyle{mystyle2}       {\topsep}{\topsep}{}{}%       {\bfseries}{}{.5em}{}%          \theoremstyle{mystyle2}          \newmdtheoremenv[hidealllines=true,     backgroundcolor=aufgaben,skipabove=\topsep,     skipbelow=\topsep]{aufgabe}{Aufgabe}               \begin{document}     text\\ a lot of text\\     \begin{aufgabe}     the excercise     \end{aufgabe}     %no space here! please!     \begin{aufgabe}     the next excercise     \end{aufgabe}     text\\text\\text\\ really a lot of text\\ text\\ text\\text\\ text\\ text\\     \end{document}      (I know that LaTeX sets the excercises dependend on how much text there is, but also, if the page is full of text there is still a bit space between it, I do not want to have any space between it!)


title: File name autocompletion in \include for large latex projects

text: I am a very lazy person, so sorry in advance if my question seems a bit odd. Working on a thesis, I am splitting the content of the whole document into multiple .tex files, one for each chapter section – that’s a pretty standard approach for such case. The master .tex file simply gathers everything together:               ...      \chapter{Introduction}     \label{chap:introduction}     \include{ch01_01}     \include{ch01_02}     ...     \chapter{...}     ...      Correspondingly, the folder contains all required files:               ch01_01.tex     ch01_02.tex     ...     chXX_XX.tex     ...     thesis.tex      All works great except one one thing: it becomes rather hard to navigate to a particular section only by remembering its title. Section sequence (or even chapter sequence) shuffles over time, plus the table of contents is not a good source of the numbers since some sections might be commented in the main file to increase rendering speed. So what you have to do is previewing several .tex files in your folder before picking the right one. Obviously renaming the files into something like this will help:               ch01_01-motivation.tex     ch01_02-aims-and-objectives.tex     ...     chXX_XX-importance-of-stackexchange-for-phd-students.tex     ...      But such improvement also adds headache: you have to update every instance of `\include` every time you play with file names. Besides, for some strange reason latex silently passes non-existing files and carries on rendering the rest of the document, so it's quite easy to lose control of what you’re doing and just start wasting time. What could be a solution here is a function like `\smartinclude{ch01_01}`, that would scan the folder for files matching `ch01_01???.tex` and include one if there is no ambiguity. Ideally it would be also useful to get a fatal error in any other case. I know that something like this exists out there — you can omit the extension of an image in `\includegraphics` but still get what you want. Unfortunately my knowledge of latex is too narrow to suggest anything similar for my ‘problem’ so I would be grateful if someone suggested the solution to it. How can the function I’m looking for be implemented?


title: Multirow tabular: un-indent the first line

text: In pdfLaTeX, `tabular` environment, the first line of each `\multirow` cell is indented. No matter if I use `l`, `r` or `p` for column specifier. How to get rid of that?!? Here is the screenshot: ![enter image description here](http://i.stack.imgur.com/zHEDT.png) Here is my code:               \NeedsTeXFormat{LaTeX2e}     \documentclass[a4paper,10pt]{article}     \pagestyle{empty}          \usepackage{array}     \usepackage{multirow}     \usepackage{colortbl}     \usepackage{pbox}          \usepackage[polish]{babel}     \usepackage[utf8]{inputenc}     \usepackage[OT4]{fontenc}          \usepackage[lmargin=2cm,rmargin=2cm,tmargin=1.5cm,bmargin=1.5cm]{geometry}     \usepackage{graphicx}     \usepackage{sectsty}     \allsectionsfont{\underline}          \usepackage[pdftex]{hyperref}     \hypersetup{pdfborder={0 0 0 0},colorlinks=true,urlcolor=blue}          \fontencoding{T1}     \fontfamily{qpl}     \fontseries{m}     \fontshape{n}          \newlength{\rowA}     \setlength{\rowA}{3.5ex}     \newcommand{\strutA}{     \rule[-0.2\rowA]{0pt}{\rowA}     }          \newlength{\rowB}     \setlength{\rowB}{6.5ex}     \newcommand{\strutB}{     \rule[-0.55\rowB]{0pt}{\rowB}     }          \newlength{\rowD}     \setlength{\rowD}{6ex}     \newcommand{\strutD}{     \rule[-0.6\rowD]{0pt}{\rowD}     }          \newcommand{\vatexempt} {     \pbox[t]{2cm}{Nie podlega\\Exempt}     }          % table cell with dark background     \newcommand{\itg} {     \cellcolor[gray]{.8}     \setlength{\parindent}{0pt}     }     % table header     \newcommand{\ith} {     \cellcolor[gray]{.8}     \setlength{\parindent}{0pt}     }          \setlength{\parindent}{0pt}     \setlength{\parskip}{7.2pt}          \begin{document}     \begin{fussy}          \begin{tabular}{|r|p{4cm}|r|r|r|r|r|r|}     \hline     \ith\strutA No.&\ith&\multicolumn{1}{p{0.6cm}|}{\multirow{2}{0.6cm}{\ith Q-tity}}&\ith&\ith&\multicolumn{2}{c|}{\ith VAT}&\ith\\     \cline{6-7}     \ith\strutD&\multicolumn{1}{p{4cm}|}{\multirow{-2}{4cm}{\ith Service or commodity name}}&\ith&\multicolumn{1}{p{2cm}|}{\multirow{-2}{2cm}{\ith Net unit price (EUR)}}&\multicolumn{1}{p{2cm}|}{\multirow{-2}{2cm}{\ith Net value (EUR)}}&\multicolumn{1}{p{2cm}|}{\ith Rate (\%)}&\multicolumn{1}{p{1.2cm}|}{\ith Amount (EUR)}&\multicolumn{1}{p{2cm}|}{\multirow{-2}{2cm}{\ith Gross value (EUR)}}\\     \hline     \strutD 1 & screwdrivers 10 pack & 1 & 123 & 123 & \vatexempt & 0 & 123\\     \hline     \multicolumn{2}{l|}{} & \multicolumn{2}{l}{\itg\strutA SUMA / TOTAL:} & \itg 123 &\itg&\itg 0 &\itg 123\\     \cline{3-8}     \end{tabular}          \end{fussy}     \end{document}      I am using those `\multicolumn{1}` tweaks to have table body cell content aligned to the right (those are amounts) and header cell content justified BUT WITH NO INDENT! In fact, I would also be satisfied with header cell content flushed to the left BUT WITH HYPHENATION. That could be even better. (How to make that?) I am using `\multirow{-2}` to get the content painted over background, not below. :o)


title: How to automatically trim a URL up to a certain length measured from the right?

text: ## Current condition A long URL makes a bad look as follows. ![enter image description here](http://i.stack.imgur.com/hqmsI.png)               \documentclass{article}     \usepackage{xcolor,listings}     \lstset     {         language={[LaTeX]TeX},         backgroundcolor=\color{yellow!50},         breaklines=true,     }     \usepackage[colorlinks]{hyperref}          \def\InputCode#1#2{%     \lstinputlisting[caption=\href{#2}{#2}]{#1}}          \begin{document}          \minipage{0.5\linewidth}     \InputCode{\jobname.tex}{http://www.oakfurniturehouse.co.uk/userfiles/image/3B4K1820.jpg}     \endminipage          \end{document}      ## Expected Result I want to trim the left part up to a certain length measured from the right as follows. The trimmed part will be replaced by `...`. ![enter image description here](http://i.stack.imgur.com/TNtHy.png) How to do this automatically because the `minipage` width can vary throughout my document.


title: Left aligned section title

text: I use a LaTeX template which center aligns all section titles. I want to left align these section titles but I do not know how. I tried               \begin{flushleft}     \section{\textbf{Introduction and Background}}     \end{flushleft}      but it has no effect on the section title (i.e., it is still centered). I tried               \begin{flushleft}     \textbf{Introduction and Background}     \end{flushleft}      and it is left aligned the word "Introduction and Background" but it is no longer a section title and thus the numbering using section number are all messed up. I am new to LaTeX so please keep it simple.


title: Declare function for tikzpicture

text: I'd like to declare a function that will be part of the equation that I then want to plot. The equation that I want to plot is defined as               \frac{e^{-rT}N'(d_{2})}{S\sigma\sqrt{T}}      The function to be declared is the probability density function               N'\left (x  \right )=\frac{1}{\sqrt{2\pi}}e^{-x^2/2}      where x should equal to `d_2`, and `d_2` must also be declared by               d_{2}=\frac{ln(S/K)+(r-\frac{\sigma^2}{2})T}{\sigma\sqrt{T}})      If possible I'd like to be able to define K, r and sigma in advance, so that they can flow into above calculation as fixed values. For the values of S (x axis) and T (y axis) I want to take a different domains, e.g. for S a range 95 to 105, and for T a range 0.01 to 0.3. The overall result should be a surfaceplot where the results of the intial equation are on the z axis. Thanks a million, I hope so much that somebody can help me! ADDITION: the code that was provided by @percusse works very well but when I try to modify it following the logic of its structure I get an error. Here is the modified code:               \documentclass{article}     \usepackage{pgfplots}     \begin{document}           \begin{tikzpicture}[     declare function={ Nprime(\x)                 = 1/(sqrt(2*pi))*exp(-0.5*(pow(\x,2)));                         d1(\x,\y,\KK,\RR,\SIG)     = (ln(\x/\KK)+(\RR+(pow(\SIG,2)/2)*\y))/(\SIG*(sqrt(\y)));                        d2(\x,\y,\KK,\RR,\SIG)     = (ln(\x/\KK)+(\RR-(pow(\SIG,2)/2)*\y))/(\SIG*(sqrt(\y)));                        myfun(\x,\y,\KK,\RR,\SIG)  = - (exp(-\RR*\y)*d1*Nprime(d2(\x,\y,\KK,\RR,\SIG))/(\y*(pow(\x,2))*(pow(\SIG,2))));                      },     ]     \begin{axis}[ y domain=0.01:0.3, domain=95:105,view={25}{20},      ]     \addplot3[surf] {myfun(x,y,100,0,0.09)};     \end{axis}     \end{tikzpicture}     \end{document}       What am I doing wrong? ONE MORE ADDITION: I have tried to swap the \y and \SIG values. Here is the code that does not work               \documentclass{article}     \usepackage{pgfplots}     \begin{document}      \begin{tikzpicture}[     declare function={ Nprime(\x)                 = 1/(sqrt(2*pi))*exp(-0.5*(pow(\x,2)));                         d2(\x,\SIG,\KK,\RR,\y)     = (ln(\x/\KK)+(\RR-(pow(\SIG,2)/2)*\y))/(\SIG*(sqrt(\y)));                        myfun(\x,\SIG,\KK,\RR,\y)  = exp(-\RR*\y)*Nprime(d2(\x,\SIG,\KK,\RR,\y))/(\x*\SIG*sqrt(\y));                      },     ]     \begin{axis}[     y domain=0.01:0.09, domain=95:105, view={25}{20},      ]     \addplot3[surf] {myfun(x,SIG,100,0,0.04)};     \end{axis}     \end{tikzpicture}     \end{document}       What's wrong with it? Thanks a lot!


title: lots of overfull boxes in a custom subsection navigation with multicols

text: I hope this is not too localized... I need a vertical subsection navigation where the subsection names only consists in numbers (1, 2, 3, etc.) printed in a three columns layout. I managed to obtain what I need with the following code:               \documentclass{beamer}     \usepackage{multicol}     \usetheme[left,width=1.4cm]{Goettingen}          \makeatletter     \def\insertsubsectionnavigation#1{%       \hbox to #1{%         \vbox{{%           \usebeamerfont{subsection in sidebar}           \usebeamercolor[fg]{subsection in sidebar}           \vskip0.5625ex%           \beamer@currentsubsection=0%           \def\sectionentry##1##2##3##4##5{}%           \def\slideentry##1##2##3##4##5##6{\ifnum##6=\c@part\ifnum##1=\c@section%             \ifnum##2>\beamer@currentsubsection%             \beamer@currentsubsection=##2%             \def\insertsubsectionhead{##5}%             \def\insertsectionheadnumber{##1}%             \def\insertsubsectionheadnumber{##2}%             \def\insertpartheadnumber{##6}%              \beamer@link(##4){%                   \ifnum\c@subsection=##2%                     {\usebeamertemplate{subsection in sidebar}}%                   \else%                     {\usebeamertemplate{subsection in sidebar shaded}}%                   \fi\hfill}\par             \fi\fi\fi}%            \hspace{3pt}\begin{minipage}{1.1cm}\setlength{\parskip}{-3pt}%            \begin{multicols}{3}            \dohead            \end{multicols}            \end{minipage}            \space         }\hfil      }}}     \makeatother          \setbeamertemplate{sidebar left}{     \begin{beamercolorbox}[wd=1.4cm]{}     \insertsubsectionnavigation{1.4cm}     \end{beamercolorbox}     }               \begin{document}     \section{1}      \subsection{1}      \frame{content}      \subsection{2}      \frame{content}      \subsection{3}      \frame{content}      \subsection{4}      \frame{content}      \subsection{5}      \frame{content}      \subsection{6}      \frame{content}      \subsection{7}      \frame{content}      \subsection{8}      \frame{content}      \subsection{9}      \frame{content}       \end{document}      ![enter image description here](http://i.stack.imgur.com/MFSvr.png) The relevant part is the following snippet:               \hspace{3pt}     \begin{minipage}{1.1cm}       \setlength{\parskip}{-3pt}%       \begin{multicols}{3}          dohead       \end{multicols}     \end{minipage}      this produces the three columns layout to be called later inside the sidebar template, which is actually more complicated than the one showed in the MWE, but the other parts do not matter here. ## The problem Problem is that with this method I get nine overfull hboxes for each subsection. I.e., you'll get 81 overfull boxes if you compile my MWE. ## The question Is it ok in this case to add `\hfuzz=27pt` inside the minipage to suppress the badboxes? Or is there a better solution to achieve the same result without having to ignore badboxes?


title: \AddEverypageHook at end of page

text: `\AddEverypageHook` works at the start of a page. How can I add a hook to the every last part of a page right before a pagebreak? Essentially I want to watermark the pages BUT I want to do it after the page contents have been created but immediately before the pagebreak. The "watermark"(not a watermark but just similar concept) will depend on macro values set(like `\thepage`) so it can't happen at the very end of the document.


title: Filehook, with more included files

text: Based on my previous questions, I now have the following code (snippet):               \usepackage{currfile}     \usepackage{filehook}     \usepackage{environ}     \usepackage{amsmath}     \def\Introduction{Introduction}               \NewEnviron{introduction}{%           \expandafter\long\expandafter\xdef\csname \currfilebase \Introduction \endcsname{\expandafter\unexpanded\expandafter{\BODY}}%     }%               \AtEndOfIncludeFile{Fourier}{%       \section{\currfilebase}%       \subsection{Introduction}%       \csname \currfilebase \Introduction \endcsname%      }%      And then I use `\include{Fourier}` and this works. But how do I make this work for more than one file without copy-pasting the `\AtEndOfIncludeFile` part? If I do this _for all_ files I get quite strange behavior, so I would like to add the files manually. Preferably only in one spot, but you can't have it all :-). That is, I want to include more files, like `\include{Pie}` without having to use               \AtEndOfIncludeFile{Pie}{%       \section{\currfilebase}%       \subsection{Introduction}%       \csname \currfilebase \Introduction \endcsname%      }%      which would be just verbatim copying... **Edit:** I have an idea. Perhaps I can put all my includes in a folder `Includes` and then use something like How to iterate through the name of files in a folder. To include all files from that folder (there is no harm in doing that as they only provide content in environments which I print using my main file). The only problem is: the order. How do I set the order in that case?


title: Handling blank rows for use with multirow automatically when using datatool

text: The following example code is slightly adapted from Peter Grill's answer to "Table including rows of a master table". The problem I'm having is that if I have a multirow, then I need an extra blank line immediately after it. If I'm selecting an arbitary subset of rows, this is hard to do automatically. I thought I could add the blank line (something like `&&&&&&&\\`) to the csv file at the end of the `multirow` line, but `datatool` does not like it. Any other ideas?               \documentclass{article}     \usepackage{array}     \usepackage{multirow}     \usepackage{datatool}     \usepackage{filecontents}     \newcommand{\colhead}[1]{\multicolumn{1}{>{\bfseries}l}{#1}}     \newcounter{tabenum}\setcounter{tabenum}{0}     \newcommand{\nextnuml}[1]{\refstepcounter{tabenum}\thetabenum.\label{#1}}          \begin{filecontents*}{foo.dat}       Hammer001,   Hammer,    1 ,  0 , 1 , 10 , 1 , \multirow{2}{2in}{light (add some words here to wrap around)}\\       Hammer002,   Hammer,    2 ,  0 , 1 , 10 , 1 , heavy\\       Hammer003,   Hammer,    3 ,  0 , 1 , 10 , 1 , really heavy\\       Longsword001,Longsword, 1 , -1 , 2 , 75 , 2 , one-handed \\       Longsword002,Longsword, 2 , -1 , 2 , 75 , 2 , two-handed \\       Longsword003,Longsword, 3 , -1 , 2 , 75 , 2 , three-handed \\     \end{filecontents*}          \newcommand{\PrintDTLTable}[2]{%       % #1 = database to search       % #2 = list of rowIDs       \begin{tabular}{c c c c c c c p{3.0cm}}        & \colhead{Label} & \colhead{Cost} & \colhead{Weight} & \colhead{PropA} & \colhead{PropB} & \colhead{PropC} & \colhead{Description}\\\hline         \DTLforeach[\DTLisSubString{#2}{\RowID}]{#1}{%           \RowID=RowID,%           \Label=Label,%           \Cost=Cost,%           \Weight=Weight,%           \PropA=PropA,%           \PropB=PropB,%           \PropC=PropC,%           \Description=Description%         }{%           \nextnuml{\RowID} & \Label &\Cost & \Weight & \PropA & \PropB & \PropC & \Description         }%       \end{tabular}     }%          \begin{document}     % \DTLsetseparator{&}% Define separator of the data     \DTLloaddb[noheader,keys={RowID,Label,Cost,Weight,PropA,PropB,PropC,Description}]{myDB}{foo.dat}          % \DTLdisplaydb{myDB}% Usefule for debugging.          \PrintDTLTable{myDB}{Hammer001,Hammer003,Longsword003}          This is a reference to ~\ref{Hammer003}.          \end{document}


title: Remove the colored section box from moderncv

text: Using `moderncv` as follows;               \documentclass{moderncv}          \moderncvtheme[black]{casual}      I'd like to remove the coloured struts/rectangles/boxes, adjacent to section headings, from the output. Can someone please tell me how to do this? I have previously used latex only for article writing.


title: Get value of macro from lualatex directly

text: I need to get the value of a macro from lualatex directly and return it in a function call               function GetMacroValue(macro)         return macro.value     end      I've tried various things such as using tex.print to store the value in a temp value BUT since tex.print executes after the function call/luacode block it does not work               function GetMacroValue()         tex.print("\\directlua{value = tonumber('\\the\\"..macro.."')}")         return value     end      Would work except the tex.print line does not execute until after the fact in which case the previous value is returned. since `tex.execute` does not exist yet is there any other method? I've tried coroutines but it does not work for(or I can't get it to work).


title: How to delete a full stop on reference ending

text: According to APA rules, after each reference there must the digital object identification (doi). I use JabRef as a reference manager and for some reason, if I put an article doi on its "doi" field, it won't show up after the build on my editor, but if I put the doi on its "note" field it shows up. However, it's adding a period after the note field. I need a way to have the reference without an ending period. Here's the LaTex document. I use TexPad as my editor.               \documentclass[12pt,a4paper,oneside]{report}     \usepackage[utf8]{inputenc}     \usepackage[portuguese, english]{babel}     \usepackage[T1]{fontenc}     \usepackage{amsmath}     \usepackage{amsfonts}     \usepackage{amssymb}     \usepackage[sort, longnamesfirst]{natbib}     \usepackage[strings]{underscore}     \bibliographystyle{newapa}      \usepackage{sectsty}     \chapterfont{\fontsize{14}{15}\selectfont}     \sectionfont{\fontsize{12}{15}\selectfont}     \subsectionfont{\fontsize{12}{15}\selectfont}     \renewcommand\bibsection{\section*{Referências}}     \bibpunct[:\ ]{(}{)}{;}{a}{,}{,}          \title{}     \date{}     \makeindex          \begin{document}          \cite{aldous-newviewsgrandparents-1995}          \bibliography{/Users/Ricardo/Documents/Ricardo/library2.bib}          \end{document}      It produces this: > Aldous, J. (1995). New views of grandparents in intergenera- tional context. > Journal of Family Issues, 16(1), 104–122. doi: 10.1177/019251395016001006. I need that last period out. Thanks.


title: Bold row in table aligned with dcolumn

text: I am generating a bunch of TeX-tables (with Stata), in which one particular row has to be highlighted (bold). I can however only modify the first column in there, hence I want to place a command in the first cell of column to make it bold(or not) So far I've been using this "Make first row of table all bold", which does exactly what I want.               \documentclass[12pt]{standalone}     \usepackage{dcolumn}         \newcolumntype{X}{>{\rowstyle{\relax}}l}     \newcolumntype{Y}{>{\currentrowstyle}c}     \newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}}     \begin{document}     \begin{tabular}{XYY}     normal row & 1.1 & 2.2\\     bold row \rowstyle{\bfseries} & 1.1 & 2.2\\     \end{tabular}     \end{document}      Now, I decided to switch to `dcolumn`, which is great, but breaks the bold- workaround, as it wraps cells in mathmode. The solution David provided here (Decimals in table don't align with dcolumn when bolded) does not really work either, as it would require a `\multicolumn{1}{B}{...}` in every bold cell. Simply using `mathbf` instead doesnt seem to do the trick. Any suggestions are greatly appreciated.


title: How to disable links completely using hyperref package?

text: A have a LaTeX paper I want to submit to the EDAS system. EDAS doesn't want papers to have links and suggests to ' _remove the hyperref package from your file_ '. However, if I do that, my compilation breaks because of some hyperref options in my tex files (and also \url definitions, I think). **I want to keep everything as it is, and just disable the linking feature of hyperref to create a link-free version of my PDF. How can I do this?** Following the hyperref documentation I did `\usepackage[draft]{hyperref}`, and that seems to work. But that doesn't seem to be the official way. And I don't want to test multiple times if EDAS accepts it or not, because all authors get notified each time I submit a new version. Also, the [draft] option doesn't remove the PDF bookmarks either, which EDAS also doesn't want.


title: Modifying Table of Contents

text: I want to modify the Table of Contents by adding the words "CHAPTER NO", "CHAPTER NAME" and "PAGE NO" above the respective columns. Presently my ToC looks like this...                           Acknowledgement     i                 Abstract            ii          1           Introduction        1                 1.1 Some heading    2          2           Similar way         4      I want it to look Like ...               Chapter No  Chapter Name    Page No                      Acknowledgement     i                 Abstract            ii          1           Introduction        1                 1.1 Some heading    2          2           Similar way         4      Any way I could go about accomplishing this? Also the same for List of Figures and List of Tables.


title: Caption numbering breaking up an algorithm with algorithmicx

text: According to its documentation, `algorithmicx` package allows break up an algorithm inside a document, as follows: ![Breaking up an algorithm with algorithmicx](http://i.stack.imgur.com/RoiQi.png) Related tex code is:               \documentclass{article}     \usepackage{algorithm}     \usepackage{algpseudocode}     \begin{document}     \begin{algorithm}     \caption{Part 1}     \begin{algorithmic}[1]     \Procedure {BellmanKalaba}{$G$, $u$, $l$, $p$}     \ForAll {$v \in V(G)$}     \State $l(v) \leftarrow \infty$     \EndFor     \State $l(u) \leftarrow 0$     \Repeat     \For {$i \leftarrow 1, n$}     \State $min \leftarrow l(v_i)$     \For {$j \leftarrow 1, n$}     \If {$min > e(v_i, v_j) + l(v_j)$}     \State $min \leftarrow e(v_i, v_j) + l(v_j)$     \State \Comment For some reason we need to break here!     \algstore{bkbreak}     \end{algorithmic}     \end{algorithm}     And we need to put some additional text between\dots     \begin{algorithm}[h]     \caption{Part 2}     \begin{algorithmic}[1]     \algrestore{bkbreak}     \State $p(i) \leftarrow v_j$     \EndIf     \EndFor     \State $l’(i) \leftarrow min$     \EndFor     \State $changed \leftarrow l \not= l’$     \State $l \leftarrow l’$     \Until{$\neg changed$}     \EndProcedure     \end{algorithmic}     \end{algorithm}     \end{document}      It's easy to note that the caption number is incremented between the two pieces of code (Algorithm 3 for the first, Algorithm 4 for the second). Moreover, is it possible to have the same number for both? If yes, how can I do that?


title: Can \includeonlyframes be modified to take a wild card?

text: When working with a large beamer document, it is convenient to use `\includeonlyframes{foo, bar, baz}` to focus on a few specific slides at a time. However, one also needs to change it each time to include the labels of the slides that they want. Instead, is it possible to use a wild card to pick out the slides? For example, I prefix the labels for all my slides with `"SectionName"`, which is the section that slide is in. So a typical frame would look like:               \section{Introduction}     \begin{frame}[label=IntroSlide1]     ...     \end{frame}      I would like to be able to select all frames in the introduction section by doing something like `\includeonlyframes{Intro*}` (the syntax can be changed to suit ease of programming, as long as the functionality is possible). Is this possible, and if so, how should I go about implementing it?


title: Vertical separation between text and first item inside nodes not consistent

text: The appended code yield the following slide. ![enter image description here](http://i.stack.imgur.com/qbdDt.png) Although the code of the four rectangular nodes equals each other the vertical separation between the text and the first item within the rectangle is smaller in `Testbox 1` than in the other boxes. After spending a lot of time to isolate the mistake my tired eyes need finally some help. * * *               \documentclass[         handout     ]{beamer}     \usepackage{tikz}          \tikzset{        X/.style={rounded corners=5pt, line width=0.75pt,                   rectangle,text width=4.5cm, align=left,                   minimum height=3cm,draw},        T/.style={font=\small,text width=4.5cm,anchor=north west}     }          \newcommand\XBox[1]{%        \node[X,               append after command={                 node[T] at (\tikzlastnode.north west) {%                    #1                 }              }        ] {};      }          \begin{document}          \begin{frame}{Test slide}        \begin{center}           \begin{tikzpicture}                   \matrix[column sep=0.5cm, row sep=0.5cm, ampersand replacement=\&]{%                 \uncover<2->{%                    \XBox{%                       Testbox 1                       \begin{itemize}                          \item Test 1                       \end{itemize}                    }                 }                 \&                  \uncover<3->{%                    \XBox{%                       Testbox 2                       \begin{itemize}                          \item Test 2                       \end{itemize}                    }                 }                 \\                 \uncover<5->{%                    \XBox{%                       Testbox 4                       \begin{itemize}                          \item Test 4                       \end{itemize}                    }                 }                 \&                  \uncover<4->{%                    \XBox{%                       Testbox 3                       \begin{itemize}                          \item Test 3                       \end{itemize}                    }                 }                 \\              };           \end{tikzpicture}        \end{center}     \end{frame}          \end{document}


title: Add "Part" string to `\part` list in TOC

text: Following on my previous question here, I would now like to add the string "Part" to the TOC. Using a modified thesis style and `\documentclass{report}` which dictates how the TOC appears. I have tried other solutions presented in other questions, but these do not seem to work. I am currently using: `\usepackage{fmtcount} \renewcommand{\thepart}{\Numberstring{part}}` to change the `\part` numbering to a numberstring "One" "Two" etc. I would like the string "Part" to appear in the TOC. Instead of: One Some title here Is there a way to get the TOC listing to be: Part One Some title here ??


title: I want a "Go on to next page" arrow where text is inscribed in arrow

text: I was wondering how i can create an arrow that says embedded "Go on to next page" the arrow should be something like the implies arrow or the rightarrow.


title: Trouble with table borders

text: I want my table to look like the one below: ![enter image description here](http://i.stack.imgur.com/H8HRt.png) But this is what is turning out: ![enter image description here](http://i.stack.imgur.com/4nfg4.png) Here’s an MWE:               \documentclass{article}          \usepackage{multirow}          \begin{document}          \begin{tabular}{|c|c|c|}     \cline{1-3}     \multicolumn{1}{c}{} & \multicolumn{2}{c}{Treatment Received}\\ \cline{2-3}     & All Respondents & Prejudiced Respondents\\ \hline     Culturally Foreign &    25.6 & 44.4\\      Culturally Familiar & 20.0 & 19.0\\     Difference & 5.6 & 25.4*\\     (95\% Confidence Interval) & (-1.1 to 12.4) & (6.6 to 44.1)\\     p-value & 0.101  & 0.009\\ \hline     \end{tabular}          \end{document}


title: Enumerate labels in text circles

text: I am trying to get enumerations with the list labels surrounded by text circles for which I am using the following code:               \usepackage{tikz}     \newcommand*\mycirc[1]{%     \begin{tikzpicture}[baseline=(C.base)]     \node[draw,circle,inner sep=1pt](C) {#1};     \end{tikzpicture}}      I am trying to get the following code to work:                   \begin{compactenum}[{\mycirc{}A{}}]         \item         \end{compactenum}      but no luck yet. Note that `compactenum` comes from the `paralist` package. Any suggestions are very welcome.


title: How can I put a page of figures as the next to last page?

text: Right now, at the end of my document I have my bibliography and then I do `\clearpage` followed by my 4 figures which occupy a page in total. This figure page is the last page of my document. However, I want these figures to appear as the page before the last page of my paper (the page which has the bibliography and last several paragraphs of text on it). How can I achieve this?


title: How to get TikZ externalization to work with Sumatra and Texniccenter

text: I use externalization, as described in the TikZ manual, to obtain a PDF file that only contains a specific figure. This involves using the PDFLaTeX Option                --jobname=figure      when I create a build profile to accomplish this, it works in the sense that pdflatex creates a file `figure.pdf`. However, I cannot get this to work with Sumatra. I want it to open automatically when it is not open, and to refresh when it's already open. I tried instructing it to open "`figure.pdf`" instead of `%bm.pdf`, but it keeps opening new Sumatra windows each time I compile. When I enable forward- search, changing the instruction from `[ForwardSearch("%bm.pdf","%Wc",%l,0,0,1)]` to `[ForwardSearch("figure.pdf","%Wc",%l,0,0,1)]`, I get an error (cannot execute command). Viewer is set on do not close (as in the non-externalize case). Does anyone know how to get it working?


title: How to customize Tex/latex commands to perform system calls from shared libraries / dlls

text: Alright - let me make this simple and straight: > How can I take advantage of the tex/latex parsing mechanism in a custom > c/c++ application that need scripting/parsing support? I see two ways: one is extracting the parsing code and placing it in the custom application and go from there, or the second way of - tex/latex being extensible, write a new document style with commands defined to be place holders for the C/C++ calls. The background is like this: I have this CFugue music note parser that parses the music notes and plays them on MIDI. The basic note parser works fine in that CFugue. But, we need to add support for users to be able to define and extend their own commands (just like tex/latex allows its users). The other alternative scripting mechanisms - I dont like them. Nothing comes close to the simplicity and extensibility of this tex style of scripting. So, instead of reinventing the wheel, I want to reuse the existing tex framework so that the commands when parsed and executed, instead of computing layouts for paper or book, they do something else that I want (may be play a midi command on a device, or write midi note to a file on disk). In this sense, I am not sure the tex/latex code is modular enough to be placed directly into third party applications and reuse it directly by configuring the output device. So, seems the second alternative of defining custom commands is the way. For example, how to write a command that can load a shared library (dll on windows) and make a call to one of its methods?               \newcommand{Call_C_Method}[2]{\LoadSharedDll{#1}\GetProcAddress{#2}\SomeHowCalltheProc}          Call_C_Method{\usr\bin\shared.dll}{PlayMidi}      I know this is not something tex/latex is designed for from its usage point - but, as an opensource developer and architect I would expect the tex/latex code-design certainly to be capable of doing this if designed correctly. Is there any work already done / existing on these lines? Or no other way than to start digging into the tex code and see what can be done to redesign it to be modular enough to segregate the parsing from the input and output devices? In other words, how to make the tex/latex generate not the postscript commands onto a file, but some other commands understandable by some other device? Thanks.


title: Revealing LaTeX symbols as if I'm drawing them by hand

text: I will be creating a video that explains some simple mathematics concepts to high school students. I am fairly confident with LaTeX so intended to use it to typeset any mathematics I was talking about and show that in the video (instead of using a blackboard or something in the background). Ideally, instead of just displaying an entire formula on the screen I want my video to slowly trace out the LaTeX symbols as I talk, just as you would expect if you were to watch someone physically write the formula down in front of you (for example, the integral sign starts to display from top to bottom, then a little 1 gets drawn from top to bottom at the bottom of the integral sign, then a little 2 gets drawn from top to bottom at the top of the integral sign, and so on) Does something like this exist?


title: How to suppress glsgroupskip on pagebreak? (glossaries package)

text: I'm using the 'glossaries' package to build a list of abbreviations. I have my own style defined based on a standard longtable style (to easily see what's the matter I pick the 'longheaderborder' style). The problem occurs when the list of abbreviations spreads over a single page and you have a style where the value 'glsgoupskip' is greater than zero. In the used style this means, that the entries within the list are grouped based on the first letter and between each group there is a blank line in the longtable. If this groupskip coincide with a pagebreak (longtable pagebreak), naturally you get a blank line at the end of the first page or at the beginning at the second page. To clarify what is going on here's my Minimal Example:               \documentclass[]{scrbook}           \usepackage[english]{babel}      \usepackage[T1]{fontenc}      \usepackage[latin1]{inputenc}      % glossaries      \usepackage[%      acronym % use acronym functionality      ,section = section % use sections for all glossary lists      ]{glossaries}      % some acronyms      \newacronym{mimo}{MIMO}{Multiple Input Multiple Output}      \newacronym{miso}{MISO}{Multiple Input Single Output}      \newacronym{simo}{SIMO}{Single Input Multiple Output}      \newacronym{siso}{SISO}{Single Input Single Output}      \newacronym{cdma}{CDMA}{Code Division Multiple Access}      \newacronym{ofdm}{OFDM}{Orthogonal Frequency Division Multiplex}           % switch on glossaries      \makeglossaries           \begin{document}      \chapter{Notation}      \vspace{28\baselineskip}      % print list of acronyms      \glsaddall      \printglossary[type=\acronymtype,style=longheaderborder]      \end{document}       I've added the `vspace` to prevent me from typing too much abbreviations. :) To cut a long story short: How can one suppress the `glsgroupskip` if a `pagebreak` has occurred? * * * **edit** : To compile this document I do the following calls:   1. `pdflatex %`   2. `makeindex -s %.ist -t %.alg -o %.acr %.acn`   3. `pdflatex %` where % indicates the document file name.   When I run my example from above there is a groupskip (ie blank line) directly after the MISO entry. Right beneath this groupskip the pagebreak occurs so there is a blank line left at the bottom of the table on the first page. ![a groupskip \(blank line\) at the bottom of the table](http://i.stack.imgur.com/a9OS4.png) If you set the vertical skip to `29\baselineskip` this blank line will occur at the top of the table on the second page right beneath the table head. For the sake of completeness here's a MWE with my own defined style using `'tabu'` and `'booktabs'` package. To build this document I call the same commands as mentioned above. The aim is to set groupskip to `\addlinespace` (booktabs command) but the problem is more clearly with a full blank line ( `&\\` ).               \documentclass[]{scrbook}           \usepackage[english]{babel}      \usepackage[T1]{fontenc}      \usepackage[latin1]{inputenc}           % table packages      \usepackage{booktabs,longtable,tabu}      % glossaries      \usepackage[%      acronym % use acronym functionality      ,section = section % use sections for all glossary lists      ,nonumberlist % no page references in lists      ,nostyles % do not load  any style      ]{glossaries}           % define new style for acronyms      \newglossarystyle{my_acronymlist}{%      \renewenvironment{theglossary}%      {\begin{longtabu} to\linewidth {lX}}%      {\end{longtabu}}%      \renewcommand*{\glossaryheader}{\toprule Acronym & Description\\\midrule\endhead%      \toprule Acronym & Description\\\midrule\endfirsthead%      \bottomrule\endfoot}%      \renewcommand*{\glsgroupheading}[1]{}%      \renewcommand*{\glossaryentryfield}[5]{%      \glstarget{##1}{##2} & \glsentrydesc{##1}\\}%      %      \renewcommand*{\glossarysubentryfield}[6]{%      &%      \glssubentryitem{##2}%      \glstarget{##2}{\strut}##4 & ##6\\}%      %      %*** GROUP SKIP ***      \renewcommand*{\glsgroupskip}{&\\}%      %\renewcommand*{\glsgroupskip}{\addlinespace}%      %******************      }           % some acronyms      \newacronym{mimo}{MIMO}{Multiple Input Multiple Output}      \newacronym{miso}{MISO}{Multiple Input Single Output}      \newacronym{simo}{SIMO}{Single Input Multiple Output}      \newacronym{siso}{SISO}{Single Input Single Output}      \newacronym{cdma}{CDMA}{Code Division Multiple Access}      \newacronym{ofdm}{OFDM}{Orthogonal Frequency Division Multiplex}           % switch on glossaries      \makeglossaries           \begin{document}           \chapter{Notation}           \vspace{28\baselineskip}      % print list of acronyms      \glsaddall      \printglossary[type=\acronymtype,style=my_acronymlist]           \end{document}      With this style I get this blank groupskip-line at the top of the second page. ![blank line with own defined style](http://i.stack.imgur.com/JTeWj.png) When I add               \expandafter\let\csname @glsstyle@my_acronymlist\endcsname\relax      right before the style definition, and set               \renewcommand*{\glsgroupskip}{\noalign{\penalty-50\vskip\normalbaselineskip}}%      sadly I can't see any change.   Nevertheless, thanks so far for your help. Hopefully there will be a solution...


title: Test if a given control sequence is a length register

text: I'm in need of a macro which receives a control sequence as argument and needs to branch if this macro is actually a _length_ (of any kind, e.g. `dimen`, `skip` etc.) or "just" a normal macro (including one which is not defined yet).               \def\assignlengthormacro#1#2{%        \@iflength{#1}{%           \setlength{#1}{#2}%  or simply #1=#2\relax        }{%           \def#1{#2}%        }%     }          \newlength\mylength % LaTeX length => TeX skip register     \newdimen\mydimen     \def\mymacro{Some other definition}     \assignlengthormacro{\mylength}{1pt}     \assignlengthormacro{\mydimen}{1pt}     \assignlengthormacro{\mymacro}{1pt}     \assignlengthormacro{\previouslyundefinedmacro}{1pt}% should still work      _Note:_ I'm able to code it myself (using `\meaning`), but I think it is a good question and like to see other possible approaches. Maybe other high-rep users will wait a little and give others a chance to try it and earn some reputation points. _Bonus challenge:_ make the test fully expandable ;-)


title: Using \visible with media9 embedded videos

text: I am currently switching to media9 to include video in beamer. I bump into an issue with the visibility option. I want to put two videos on a frame alongside with the list. The first one starts when the page opens along with some items while the second video to show and start when I highlight the second part of the items. Here is my code in hope for a solution:               \begin{frame}{Frame example}         \begin{columns}             \begin{column}{5.5cm}                 \begin{itemize}                     \item Blabla                     \item Blabla                     \item<2-> Bloblo                     \item<2-> Bloblo                 \end{itemize}             \end{column}             \begin{column}{4.5cm}                 \begin{figure}{                     \includemedia[                         width=\columnwidth,height=2.8125cm,                         activate=pageopen,                         addresource=blabla_video.mp4,                         flashvars={                         source=blabla_video.mp4                         &loop=true                         &autoPlay=true                         &scaleMode=letterbox                         }                         ]{}{VPlayer.swf}                     \caption{Blabla}}                 \end{figure}                 \visible<2->{                 \begin{figure}{                              \includemedia[                         width=\columnwidth,height=2.8125cm,                         activate=pagevisible,                         addresource=bloblo_video.mp4,                         flashvars={                         source=bloblo_video.mp4                         &autoPlay=true                         &loop=true                         &scaleMode=letterbox                         },                         transparent                         ]{}{VPlayer.swf}                     \caption{Bloblo}}                 \end{figure}}             \end{column}         \end{columns}     \end{frame}      Also I notice that Adobe Reader is considerably much slower reading video with media9 than with movie15. Is it just related to my configuration or there is something I am missing like a codec of some sort? Is it related to the fact that a warning concerning a signature field detected appears? I am running MikTex 2.9, compiling with pdflatex and opening the pdf with Adobe Reader 11.0.3 I hope you guys have an answer...


title: Beamer frame environment introduces 5.69pt vertical margin

text: I'm working on a beamer poster template where I need precise control over all margins. I got rid of most, but the mandatory frame environment(1) introduces a `5.69pt`(2) which I cannot find(3). Observe this example:               \documentclass[final,t]{beamer}          \usepackage[orientation=portrait,size=a4]{beamerposter}     \geometry{margin=0pt}%          \begin{document}%     \begin{frame}[t,plain]%     %\vskip-5.69pt%    <--- magical vertical space     \begin{pgfpicture}%       \pgfsetlinewidth{1pt}%       \pgfpathmoveto{\pgfpoint{0pt}{0pt}}%       \pgfpathlineto{\pgfpoint{2cm}{0pt}}%       \pgfpathlineto{\pgfpoint{2cm}{-2cm}}%       \pgfusepath{stroke}%     \end{pgfpicture} with frame%     \end{frame}%     \end{document}%      If we build this and zoom in on the top left corner it looks like this: ![vertical frame margin](http://i.stack.imgur.com/eq3ks.png) Now, if we remove the `\begin{frame}[t,plain]` and `\end{frame}` we get this: ![no vertical margin](http://i.stack.imgur.com/DHQRZ.png) Note that the thin black frame around the picture is the page border inserted by my pdf viewer. _I have no idea where the distance between the page border and the pdfpicture comes from. **How do I get rid of it?_** * * * (1) I can omit the frame, but then I run into trouble with `\item`s in itemize environments. TeX then suddenly claims `\item` to be an undefined control sequence. (2) That's the overfull-ness of the `\hbox` reported by latex when I try to insert a minipage of the dimension `[\paperheight]{\paperwidth}`. (3) I tried setting virtually every page margin to `0pt` to no avail. Also, the official beamer guide does not mention this margin.


title: Table going past margins

text: I'm trying to create a header for my resume. I'm almost happy with the result, but there's a small formatting issue. I'm using a table to control where my name and contact info are placed. My name and details are just long enough to go slightly over my margins, and look a little awkward. Here's the minimum to show what I'm working with.               \documentclass[12pt]{article}     \usepackage{moresize}         \usepackage{fullpage}     \usepackage[defaultsans]{droidsans}     \renewcommand*\familydefault{\sfdefault}     \usepackage[T1]{fontenc}          \begin{document}          \begin{table}     \begin{tabular}{l r l}     \Huge{White H. Love-Tiger} &  & \\ \hline      & \small{\tt{whlt@stackexchange.com}} & \small{42 Latex Ave.}\\      & \small{(555) 765-4321} & \small{Texburg, \textsc{XY}}\\      &  & \small{\textsc{A1A 1A1}} \\     \end{tabular}     \end{table}                \section*{Experience}     Latex expert: I've never needed to ask anyone for help with Latex because I'm sure a Latex expert. Blah blah blah blah, lorem ipsum gibberish gibberish gibberish. I'm the most amazing, you really need to hire me, blah blah blah.... please give me a job. Blah blah blah blah, lorem ipsum gibberish gibberish gibberish. Blah blah blah blah, lorem ipsum gibberish gibberish gibberish. Blah blah blah blah, lorem ipsum gibberish gibberish gibberish.          \end{document}      The header goes just past the right margin. Is there a way I could have the header table fill the document from the left margin to the right margin, and have the lower rows of contact information not go past the right margin? This means that the end of my name might hang over the beginning of my email address, but I'm okay with that.


title: Single-spaced multi-line marginalia

text: When writing papers, I like to keep track of notes, thoughts and to do's inside the documents. I'd love to have tiny coloured multi-line marginalia. So far I used sth like               \newcommand{\mymarginnote}[1]{\marginpar{\begin{spacing}{0.8}\textcolor{red}{\scriptsize{#1}}\end{spacing}}}      to have a red side-note, but the single-spacing does not work. How can I have this marginalia single-spaced (or less)? And is it possible to have the text with a yellow background? The `\colorbox{}` command doesn't seem to wrap the text. I'd also be interested how you keep track of notes and thoughts within your documents... Thanks!


title: Contents in PDF bookmarks

text: I am using KOMA-Script (`scrreprt`) and `hyperref`. The PDF bookmarks are generated nicely from the table of contents, but I would like an extra _Contents_ bookmark to point to the table of contents itself (without including an entry in the table of contents) - like the KOMA manual itself. (Also list of figures and list of tables if I include them) What is the best way to do this? I could add a `\pdfbookmark` manually but I'm not sure how to get it to point correctly to the start of the section - if I do it after it will be on the wrong page (multipage toc), if I do before it will be the page before (since `\tableofcontents` does `\cleardoublepage`?). I guess I have to redefine `\tableofcontents` somehow.