title: How to match cmyk colors between matplotlib and LaTeX

text: I'm plotting something using `matplotlib` and I'm using the `matplotlib.cm.rainbow` colormap. I need to match the same colors in my LaTeX document, but I'm having a difficult time making the colors match between what I get on my plot and what appears in my LaTeX document. **What do I have to do to get matplotlib and LaTeX to use the same colors?** Even coming close would be a benefit. The code I'm using to plot in `matplotlib` is:               import matplotlib.pyplot as pyplot          Fig, ax = pyplot.subplots()     indices = range(8)          length = len(indices)     print("\ncolors: ")     for i in range(length-1):         left = indices[i]         right = indices[i+1]              c = pyplot.cm.rainbow(i/length)         print("i={}, color={}".format(i,c))         ax.fill_between((left,right), 0,1,                         facecolor=c, edgecolor=c, alpha=0.25)          # Do the last one     i +=1     left = indices[i]     right = 8     c = pyplot.cm.rainbow(1.0)     print("i={}, color={}".format(i,c))     ax.fill_between((left,right), 0,1,                     facecolor=c, edgecolor=c, alpha=0.25)      The output from this is:               colors:      i=0, color=(0.5, 0.0, 1.0, 1.0)     i=1, color=(0.24901960784313726, 0.38410574917192586, 0.98063477046897773, 1.0)     i=2, color=(0.0019607843137254832, 0.70928130760585339, 0.92328910610548931, 1.0)     i=3, color=(0.25294117647058822, 0.92563765978155632, 0.83018403081555059, 1.0)     i=4, color=(0.50392156862745097, 0.99998102734872685, 0.70492554690614728, 1.0)     i=5, color=(0.75490196078431371, 0.92090551794495368, 0.55236497296050591, 1.0)     i=6, color=(1.0, 0.70054303759329106, 0.37841105004231035, 1.0)     i=7, color=(1.0, 1.2246467991473532e-16, 6.123233995736766e-17, 1.0)      ![matplotlib plot output](http://i.stack.imgur.com/Ppn7l.png) I use the output to define colors in LaTeX using:               \definecolor{colorA}{cmyk}{0.5    , 0.0    , 1.0     , 0.0}     \definecolor{colorB}{cmyk}{0.2490 , 0.3841 , 0.9806  , 0.0}     \definecolor{colorC}{cmyk}{0.0019 , 0.7092 , 0.9232  , 0.0}     \definecolor{colorD}{cmyk}{0.2529 , 0.9256 , 0.8301  , 0.0}     \definecolor{colorE}{cmyk}{0.5039 , 0.9999 , 0.7049  , 0.0}     \definecolor{colorF}{cmyk}{0.7549 , 0.9209 , 0.5523  , 0.0}     \definecolor{colorG}{cmyk}{1.0    , 0.7005 , 0.37841 , 0.0}     \definecolor{colorH}{cmyk}{1.0    , 1.2246 , 6.12323 , 0.0}      Finally I use the colors in a table (with the `colortbl` package) using the command               \rowcolor{colorA!25} 1 & ...       However, the colors in the figure don't match the colors in the table and it is aggravating me why it doesn't work. Instead of the `purple, blue, aqua, ...` (I know these are not technical color names) that is seen in the figure, the colors I'm getting are `green, orange, orange red, red, gray red, violet, blue,...` The colors are not even close.


title: How do I extract repeated functionality (exsheets workaround) to make it reusable?

text: Speaking with Clemens (exsheets maintainer) he pointed me to a workaround by Gonzalo Medina, that helps put verbatim and listings code in the exsheets _pseudo_ (Clemens' word choice) question and solution environments. Fixing lstlisting inside exsheets question and solution environments My question pertains to the repeatable sections in the solution to the previous link. Seeing the solution triggers the DRY (Don't repeat yourself) rules from my programming background and makes me want to write functional replacements for reusable sections. **How do I go about extracting the common code** , so that I have a new _function call_ (for lack of better phrasing), that I can reuse consistently, without replicating (read: copy pasting) the minibox code every time? A MWE (modified from the mentioned question) to have a different box for question and solution.               \documentclass{article}          \usepackage{xcolor}     \usepackage{listings}     \usepackage{exsheets}          \lstset{     frame=single,     xleftmargin=20pt,     numbers=left,     numberstyle=\small,     tabsize=2,     breaklines,     showspaces=false,     showstringspaces=false,     language=C,     basicstyle=\small\ttfamily,     commentstyle=\itshape\color{gray}}               \newsavebox\myboxa     \newsavebox\myboxb          \begin{document}          \begin{lrbox}{\myboxa}\begin{minipage}{\textwidth}     \begin{lstlisting}[]     #include <stdio.h>          int main(int argc, char *argv[]) {       printf("hello, world\n");     }     \end{lstlisting}     \end{minipage}     \end{lrbox}          \begin{lrbox}{\myboxa}\begin{minipage}{\textwidth}     \begin{lstlisting}[]     #include <stdio.h>          int main(int argc, char *argv[]) {       printf("hello, world\n");     }     \end{lstlisting}     \end{minipage}     \end{lrbox}          \begin{lrbox}{\myboxb}\begin{minipage}{\textwidth}     \begin{lstlisting}[]     #include <stdio.h>          int main(int argc, char *argv[]) {       printf("hello, world\n");       # some more things that had to be done     }     \end{lstlisting}     \end{minipage}     \end{lrbox}               \begin{question}{6}     Pre-example text\par     \noindent\usebox\myboxa     \\Post-example text     \end{question}          \begin{solution}     Pre-solution text\par     \noindent\usebox\myboxb     \\Post-solution text     \end{solution}     \printsolutions           \end{document}      This generates: ![MWE example output](http://i.stack.imgur.com/dCGpj.png) which would be much more usable, if I can extract the sections, indicated in overlay below: ![Verbatim Extraction](http://i.stack.imgur.com/GSpJM.png) If I can extract those sections and access them with something like:               \verbatimquestionsolution{6}{Preexample text}{Code}{Post-example text}{Pre-solution text}{Solution code}{Post-solution text}      or               \verbatimquestion{6}{Preexample text}{Code}{Post-example text}     \verbatimsolution{Preexample text}{Code}{Post-example text}      (with one's output immediately following other in output. The pre and post solution text is not typically something I would use as one can do that in comments in the source, but is added here, for sake of discussing repeatable sections. I know this might seem like a 'too specific' use case, but what I'm trying to learn here, is the extraction of sections (I'm not even really sure I'm using the right terminology here) so that I don't repeat myself. This won't just aid in this specific example but also with other repeatable environments I might encounter. One thing I have no idea to approach for instance, is the               \newsavebox\myboxa     \newsavebox\myboxb      that comes in the preamble. **Any guidance as to this is much appreciated. What should I be reading up on here? Macros? How do I pass multiple variables? I see hooks are available but how do I get it to write to the preamble (if that is even necessary for the \newsavebox command)?**


title: Underfull \hbox when creating table containing much text

text: I am completely new to LaTeX and how to create tables in this environment. Currently, I am trying to create a table that contains much text in each cell using tabularx. The output does not look too bad, a lot of `Underfull \hbox (badness 10000) in paragraph` errors are created in the log related to the individual cells. Is there any way to amend this? I am trying to make following table:               \documentclass[12pt,a4paper]{article}     \usepackage[onehalfspacing]{setspace}     \usepackage{booktabs,tabularx}          \begin{document}     \begin{table}     \centering     \caption{Diagnostic tests overview}     \setlength{\tabcolsep}{10pt}     \begin{tabularx}{\textwidth}{X p{2.8cm} p{2.8cm} p{2.8cm}}     \toprule     Test & Diagnose & $H_0$ & $H_1$ \\     \midrule     F-test & Joint significance & $\beta_0=\beta_1=\ldots=\beta_i=0$ & Some or all $\beta_i\neq0$ \\[0.7cm]     Jarque-Bera & Normality & No skewness or excess kurtosis & Non-normality \\[0.7cm]     White & Hetero\-skedasticity & Homo\-skesdasticity & Hetero\-skedasticity \\[0.7cm]     White Cross-Products (X) & Hetero\-skedasticity & Homo\-skesdasticity & Hetero\-skedasticity \\[0.7cm]     Breusch-Godfrey & Autocorrelation & No autocorrelation & Autocorrelation \\[0.7cm]     Ramsey\-RESET 1 & Misspecification & Correct specification & Misspecification \\[0.7cm]     Ramsey\-RESET 2 & Misspecification & Correct specification & Misspecification \\     \bottomrule     \end{tabularx}     \end{table}     \end{document}


title: Positioning Even or Odd x axis tick labels in PGFPlots

text: I am wondering if it is possible in PGFPlots to position separately only the Odd x-tick labels (or Even). The reason is that, my x-axis labels look congested. In Tikz datavisualization, I have noticed that it is possible to move downward only Odd or Even tick labels. Is the same possible in PGFPlots?               \documentclass[12pt]{article}     \usepackage[usenames,dvipsnames,svgnames,table]{xcolor}     \usepackage[margin=1cm]{geometry}     \usepackage{pgfplots}     \usetikzlibrary{patterns,fadings}          \begin{filecontents*}{Total_Histogram.dat}      0.00000000e+00 2.00000000e+00      5.00000000e-01 0.00000000e+00      1.00000000e+00 3.00000000e+00      1.50000000e+00 3.00000000e+00      2.00000000e+00 4.00000000e+00      2.50000000e+00 1.00000000e+00      3.00000000e+00 2.00000000e+00      3.50000000e+00 1.00000000e+00      4.00000000e+00 2.00000000e+00      4.50000000e+00 2.00000000e+00      5.00000000e+00 3.00000000e+00      5.50000000e+00 5.00000000e+00      6.00000000e+00 3.00000000e+00      6.50000000e+00 4.00000000e+00      7.00000000e+00 7.00000000e+00      7.50000000e+00 5.00000000e+00      8.00000000e+00 4.00000000e+00      8.50000000e+00 0.00000000e+00      9.00000000e+00 2.00000000e+00      9.50000000e+00 2.00000000e+00      1.00000000e+01 1.00000000e+00      1.05000000e+01 0.00000000e+00      1.10000000e+01 3.00000000e+00      1.15000000e+01 2.00000000e+00      1.20000000e+01 0.00000000e+00      1.25000000e+01 0.00000000e+00      1.30000000e+01 1.00000000e+00      1.35000000e+01 0.00000000e+00      1.40000000e+01 0.00000000e+00      1.45000000e+01 0.00000000e+00      1.50000000e+01 0.00000000e+00     \end{filecontents*}          \begin{document}     \pagestyle{empty}          \begin{tikzpicture}         \centering         \begin{axis}         [         width=\textwidth,         ybar,         ymin=0,         xtick=data,         xticklabel style={rotate=45},         legend columns=-1,         nodes near coords,         every node near coord/.append style={         rotate=30,         xshift=1mm,         inner sep=1pt,         color=gray         },         ytick={0,1,2,3,4,5,6,7},         ymajorgrids,         major grid style={thick,white},         axis on top,         tick pos=left,         xlabel=Total Points in Quiz-1,         ylabel=Number of Students,         x label style={at={(axis description cs:0.5,-0.05)},anchor=north},         title={\bf Performance of students in Quiz-1}         ]                  \addplot+[color=red!30,draw=black,forget plot] table [y index=1,x index=0,skip coords between index={5}{31}]{Total_Histogram.dat};             \addplot+[color=yellow!30,draw=black,forget plot] table [y index=1,x index=0,skip coords between index={0}{5},skip coords between index={11}{31}]{Total_Histogram.dat};             \addplot+[color=blue!30,draw=black,forget plot] table [y index=1,x index=0,skip coords between index={0}{11},skip coords between index={17}{31}]{Total_Histogram.dat};             \addplot+[color=green!30,draw=black] table [y index=1,x index=0,skip coords between index={0}{17}]{Total_Histogram.dat};                  \node [fill=red!30] at (axis cs:0.65,3.75) {Attention};             \node [fill=yellow!30] at (axis cs:3.5,3.75) {C,D grades};             \node [fill=blue!30] at (axis cs:7,7.35) {B grade};             \node [fill=green!30] at (axis cs:11,3.75) {A,S grades};             \draw [->,blue,ultra thick] (axis cs:5.9,0) -- (axis cs:5.9,6.5) node [anchor=north east,draw=gray,xshift=-1.5mm]{Average=5.9};             \draw [<->,gray,ultra thick]    (axis cs:-0.1,5.4) -- (axis cs:5.8,5.4) node [anchor=north,midway]{28 Students};             \draw [<->,gray,ultra thick]    (axis cs:6.0,5.4) -- (axis cs:15,5.4) node [anchor=north,midway]{34 Students};         \end{axis}          \end{tikzpicture}          \end{document}      ![This is the image I get. I would like to position Odd tick labels downward by say 5 mm, to avoid congestion](http://i.stack.imgur.com/b9U6p.png)


title: Boxed entries in matrices

text: I would like to create a formula or figure like this: ![boxed entries in matrices](http://i.stack.imgur.com/H3VBX.png) I tried it simply with the `pmatrix` environment and the `\boxed` command, but the spacing looked horrible. I think it might be done with TikZ, but I don't know much about it. Edit: Here is what I got so far for the right-hand side:               \documentclass{article}          \usepackage{amsmath,amsthm,amsfonts,amssymb}     \usepackage{tikz}     \usetikzlibrary{arrows,matrix,positioning}          \begin{document}     \begin{tikzpicture}         \matrix [matrix of math nodes,left delimiter=(,right delimiter=)] (m)         {                A_1           & \phantom{A_1} & \phantom{A_1} & \\                \phantom{A_1} & \phantom{A_1} &               & \\                \phantom{A_1} &               & A_2           & \\                              &               &               & A_2           & \phantom{A_3}\\                              &               &               & \phantom{A_2} & A_3          \\         };           \draw (m-1-1.north west) -- (m-1-2.north east) -- (m-2-2.south east) -- (m-2-1.south west) -- (m-1-1.north west);         \draw (m-3-3.north west) -- (m-3-3.north east) -- (m-3-3.south east) -- (m-3-3.south west) -- (m-3-3.north west);         \draw (m-4-4.north west) -- (m-4-4.north east) -- (m-4-4.south east) -- (m-4-4.south west) -- (m-4-4.north west);         \draw (m-1-1.north west) -- (m-1-3.north east) -- (m-3-3.south east) -- (m-3-1.south west) -- (m-1-1.north west);         \draw (m-5-5.north west) -- (m-5-5.north east) -- (m-5-5.south east) -- (m-5-5.south west) -- (m-5-5.north west);         \draw (m-4-4.north west) -- (m-4-5.north east) -- (m-5-5.south east) -- (m-5-4.south west) -- (m-4-4.north west);     \end{tikzpicture}          \end{document}      ![enter image description here](http://i.stack.imgur.com/rM8Zl.jpg) What I hope to achieve is   * square boxes,   * `$A_1$` centered in the `$2\times 2$` box,   * also the left-hand side and the `$\subset$` sign in the middle. Comment: I have no idea what I did wrong in the formatting of this question.


title: Turn off bold font in heading for a single symbol

text: The headings commands (`\section`, `\subsection`, etc.) put their text argument in a bold font. I don't want to change that. But I sometimes need to put specific symbols (e.g. phonetic symbols) inside a heading, and these should not appear in a bold font. How can I "turn off" the bold font for a single character within a heading, and let it appear as defined (in the MWE below as an italicized character)? In the MWE example, the character U+01AB doesn't exist in the bold font, so it doesn't appear in the heading at all.               \documentclass{article}     \usepackage{fontspec}         \setmainfont         [             Path = C:/Windows/Fonts/,             Extension = .ttf,             UprightFont = Diauni,             BoldFont = Diaunife,             ItalicFont = Diauniku,         ]{dialektuni}     \newcommand{\twithpalhook}{\textit{\char"01AB}}     \begin{document}     \section{I would like the symbol {\twithpalhook} to appear as defined}     The symbol is \twithpalhook.     \end{document}      ![enter image description here](http://i.stack.imgur.com/Txky6.png)


title: Incollection book titles in italics using custom-bib

text: I've been trying to create a custom bibliography style using custom-bib (makebst), and I have almost succeeded. The only thing that I've failed to fix is the incollection and inproceedings book titles; they should be in italics, but, instead, they are between quotation marks. Any help would be greatly appreciated. Here's my tex file:               \documentclass{article}               \usepackage{authordate1-4}     \usepackage[brazil]{babel}     \usepackage[utf8]{inputenc}     \usepackage[T1]{fontenc}          \begin{document}          \cite{prawitz1975}     \cite{sher2008}     \cite{macfarlane2009}          \bibliographystyle{abnt}     \bibliography{mestrado}          \end{document}      And here's what I get as a result: ![Result from the above code](http://i.stack.imgur.com/xPFuY.jpg) And here's the code from the .bst file for the incollection and inproceedings functions:               FUNCTION {incollection}     { output.bibitem       format.authors "author" output.check       author format.key output       new.block       format.title "title" output.check       new.block       crossref missing$         { format.in.ed.booktitle "booktitle" output.check           end.quote.btitle           format.bvolume output           format.number.series output       format.edition output       format.chapter.pages output       new.sentence       format.publisher.address output       format.date "year" output.check       format.isbn output         }         { format.incoll.inproc.crossref output.nonnull           format.chapter.pages output         }       if$       format.pages "pages" output.check       format.doi output       new.block       format.note output       format.eprint output       fin.entry       write.url     }     FUNCTION {inproceedings}     { output.bibitem       format.authors "author" output.check       author format.key output       new.block       format.title "title" output.check       new.block       crossref missing$         { format.in.ed.booktitle "booktitle" output.check           end.quote.btitle           format.bvolume output           format.number.series output           new.sentence           publisher empty$             { format.organization.address output }             { organization "organization" bibinfo.check output               format.publisher.address output             }           if$           format.date "year" output.check           format.isbn output           format.issn output         }


title: xwatermark: watermark skipping pages

text: I'm creating a draft document template (article). I need the draft watermark on every page except the titlepage, but it's skipping the List of Figures. The problem seems to be coming from the second setcounter, where the number restart in Arabic, because removing that makes the draft show up on the List of Figures. How do I fix it?               \documentclass[printwatermark]{article}     \usepackage{xwatermark}     \usepackage{xcolor}     \usepackage{lipsum}%used to generate false content          \newwatermark[allpages,color=gray!25,angle=45,scale=5,xpos=0,ypos=0]{DRAFT}%determines watermark characteristics          \begin{document}          %starts page numbers at i     \setcounter{page}{1}     \renewcommand{\thepage}{\roman{page}}          NOTICES:\linebreak     \lipsum[1-2]     \newpage          \tableofcontents     \newpage          \listoffigures     \newpage          %starts page numbers at 1     \setcounter{page}{1}     \renewcommand{\thepage}{\arabic{page}}          \section{Demo Section}     \lipsum[1-2]     \subsection{Demo Subsection}     \lipsum[1-2]     \subsubsection{Demo Subsubsection}     \lipsum[1-2]     %includes figure in list of figures     \begin{figure}[h]     \includegraphics[width=.5\linewidth]{PlaceHolder}     \centering     \caption{Demo Graphic}     \label{fig:figure1}     \end{figure}          \end{document}      I've searched through the xwatermark guide, stackexchange, etc, but I can't find anything about the two conflicting.


title: how do I add delimiters to both sides of a tikz node?

text: Here is a simple document which does not seem to display properly:               \documentclass{article}     \usepackage{tikz}     \usetikzlibrary{matrix}     \begin{document}     \tikz \node[matrix of nodes] { |[left delimiter=(, right delimiter=)]| x \\ };     \end{document}      This document renders as ![incorrect spacing](http://i.stack.imgur.com/ghCyS.png). When I include just a left delimiter or just a right delimiter, it seems to work okay; namely, I get ![correct left delimiter](http://i.stack.imgur.com/UDaJV.png) and ![correct right delimiter](http://i.stack.imgur.com/kmTQi.png), respectively. How can I get both of those delimiters to appear in the appropriate positions?


title: How to APA 6th in LaTeX?

text: I have previously been writing psychology manuscripts according to the standards of the American Psychological Association (APA, version 5) using the excellent apa class, with apacite managing my references. However, there have been many changes to this standard with the release of the new version of APA's formatting requirements (now in version 6) a year ago. Neither of the packages apa nor apacite have been updated in light of these changes to the APA requirements, and I have not been able to determine if such work is in progress and whether it is possible to contribute to such work (although I have no programming skills myself). So, does anyone use LaTeX to write papers in APA 6th, and if so, have you got any recommendations or packages that make this work easier?


title: Using \parbox in Beamer has unwanted effects

text: I want to change from an itemized list on one slide to an image on the next slide. I tried this with a `\parbox` with overlay specifications. It works ok when the inner position of the parbox is set to `c` but messes the alignment up when switched to `t`. I think the `t` option alignment is nicer so I would like to retain it. **MWE:**               \PassOptionsToPackage{demo}{graphicx}     \documentclass{beamer}          \begin{document}          \begin{frame}{Headline}       Some text that is static     \parbox[c][.4\textheight][t]{\textwidth}{         \begin{itemize}[<1>]         \item{One}         \item{Two}       \end{itemize}       \only<2>{Second slide\\ \includegraphics[width=.75\textwidth]{PerturbationPol}}     }     \end{frame}          \end{document}      Which results in the wrong spacing on the second slide. ![Wrong spacing](http://i.stack.imgur.com/hhKwY.png)


title: Getting strange error with MiKTeX when trying to use "kpfonts" package

text: I'm getting the following error when trying to compile the following very minimal example with MiKTeX:               \documentclass{article}          \usepackage[T1]{fontenc}     \usepackage{kpfonts}          \begin{document}     test     \end{document}      The error I get is               hb/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]     (D:\dump\tex\tmp\test.aux) )Trying to make PK font jkpmn8r at 600 DPI...     Running miktex-makemf.exe...     miktex-makemf: The jkpmn8r source file could not be found.     Running ttf2pk.exe...     miktex-makepk: PK font jkpmn8r could not be created.          !pdfTeX error: pdflatex (file jkpmn8r): Font jkpmn8r at 600 not found      ==> Fatal error occurred, no output PDF file produced! It compiles perfectly on my Ubuntu machine with TeX Live 2011, but not on my Windows machine with MiKTeX 2.9 (just updated all packages as well). I detected this when trying to compile my thesis on my Windows machine, which produced the following error:               [5     ! pdfTeX error (font expansion): auto expansion is only possible with scalable     fonts.     \@EveryShipout@Output ...@Org@Shipout \box \@cclv          l.47          !  ==> Fatal error occurred, no output PDF file produced!      It appears it has something to do with the `kpfonts` package since the minimal example compiles when I comment it out, but why does it work on my Ubuntu machine then?


title: \framezoom - What am I doing wrong?

text: I'm working on my second ever Latex Beamer presentation, and loving the clean, professional appearance. All compiles into PDF format no problem, until I try to use `\framezoom`(the image is .jpg). This fails:               \begin{frame}     \frametitle{Example}     \framezoom<1><2>[border] (0cm, 0cm) (2cm, 1.5cm)     \includegraphics[height=4cm]{02_pa}     \end{frame}      but works ok without the `framezoom` line. I'm using Texworks, and the last lines of the console are:               ("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\umsb.fd")     ("C:\Program Files\MiKTeX 2.9\tex\latex\tipa\utipx.fd") [3] [4] [5]     <02_pa.jpg, id=50, 2377.88374pt x 2055.68pt> <use 02_pa.jpg>     Overfull \vbox (4.0187pt too high) detected at line 77     [6 <C:/Documents and Settings/Owner/My Documents/Beamer/02_pa.jpg>] [7]     [8] [9] [10] [11]     Runaway argument?     border] (0cm, 0cm) (2cm, 1.5cm) \includegraphics [height=4cm]{02_pa} \ETC.     ! Paragraph ended before \beamer@framezoom was complete.     <to be read again>                         \par      l.117       I've found several examples of how to use the command, and I can't see what I'm doing wrong. Any suggestions?


title: How to cite submitted paper?

text: Given this reference: > J. Simmonds, S. Ben-David, and M. Chechik. Optimizing Computation of > Recovery Plans for BPEL Applications, 2010\. Submitted. how can the "submitted" be added using BibTeX?


title: Subscripts and superscripts for Physiology paper

text: I'm writing a medicine/physiology article. I was writing the manuscript in Microsoft Word, but have recently discovered LaTeX for rendering math equations, which it does superbly; and wanted to learn how to use LaTeX in text mode to write this article. This is my first attempt using LaTeX text mode. I'm running MiKTeX 2.9 on a Windows XP laptop. My article repeatedly uses standard physiology terminology for variables such as:               F\textsubscript{I}O\textsubscript{2}      (or `$F_IO_2$` in math mode - but I know this is wrong to use this, as Math mode shouldn't be used to render text, and will italicise the subscripts!) ...or SI units such as:               L min\textsuperscript{-1)      (or `$L min^(-1)$` in math mode) I've read other discussions on the newsgroups regarding similar problems and have tried using the `mchem` add-in as a workaround; but this only recognises standard formulae used in chemistry, not physiology. I'm using these units and variables very frequently in the text. There's got to be an easier way than writing `\textsuperscript` every time I want to write units, or writing `\textsubscript` twice every time I state a variable! The whole point of using LaTeX for this exercise was to get away from Microsoft Word and the curse of its non-standard embedded control characters. However instead of being easier to use, the equivalent commands that I've found so far in LaTeX seem to take much more time and effort to write! Are there other commands, macros or plug-ins that I could use instead to get the same job done with the minimum of keystrokes?


title: Highlighting line ranges in listings

text: I've put here one adaptation for _"no-beamer"_ documents of this code. Thanks a lot for the indications given below by Daniel.               % Sources :      %   1) http://tex.stackexchange.com/questions/18969/creating-a-zebra-effect-using-listings     %   2) http://tex.stackexchange.com/questions/24046/listing-zebra-effect-and-broken-lines     %   3) http://tex.stackexchange.com/questions/30877/highlighting-line-ranges-in-a-lstlisting-partial-solution-but-expansion-issues/31267#31267          \documentclass[10pt,a4paper]{article}         \usepackage[utf8x]{inputenc}         \usepackage{ucs}         \usepackage{amsmath}         \usepackage{amsfonts}         \usepackage{amssymb}              \usepackage{xcolor}         \usepackage{listings}              \usepackage{pgf}         \usepackage{pgffor}          % Define backgroundcolor         \usepackage[             style=1,             skipbelow=\topskip,             skipabove=\topskip         ]{mdframed}              \definecolor{bggray}{rgb}{0.85, 0.85, 0.85}         \mdfsetup{             leftmargin = 20pt,             rightmargin = 20pt,             backgroundcolor = bggray,             middlelinecolor = black,             roundcorner = 15         }         \BeforeBeginEnvironment{lstlisting}{\begin{mdframed}\vskip-.5\baselineskip}         \AfterEndEnvironment{lstlisting}{\end{mdframed}}              \makeatletter     %     % \btIfInRange{number}{range list}{TRUE}{FALSE}     %     % Test if int number <number> is element of a (comma separated) list of ranges     % (such as: {1,3-5,7,10-12,14}) and processes <TRUE> or <FALSE> respectively     %             \newcount\bt@rangea             \newcount\bt@rangeb                  \newcommand\btIfInRange[2]{%                 \global\let\bt@inrange\@secondoftwo%                 \edef\bt@rangelist{#2}%                 \foreach \range in \bt@rangelist {%                     \afterassignment\bt@getrangeb%                     \bt@rangea=0\range\relax%                     \pgfmathtruncatemacro\result{ ( #1 >= \bt@rangea) && (#1 <= \bt@rangeb) }%                     \ifnum\result=1\relax%                         \breakforeach%                         \global\let\bt@inrange\@firstoftwo%                     \fi%                 }%                 \bt@inrange%             }                  \newcommand\bt@getrangeb{%                 \@ifnextchar\relax%                 {\bt@rangeb=\bt@rangea}%                 {\@getrangeb}%             }                  \def\@getrangeb-#1\relax{%                 \ifx\relax#1\relax%                     \bt@rangeb=100000%   \maxdimen is too large for pgfmath                 \else%                     \bt@rangeb=#1\relax%                 \fi%             }          %     % \btLstHL{range list}     %             \newcommand{\btLstHL}[1]{%                 \btIfInRange{\value{lstnumber}}{#1}%                 {\color{blue!30}}%                 {\def\lst@linebgrd}%             }%          %     % \btInputEmph[listing options]{range list}{file name}     %             \newcommand{\btLstInputEmph}[3][\empty]{%                 \lstset{%                     linebackgroundcolor=\btLstHL{#2}%                     \lstinputlisting{#3}%                 }% \only             }          % Patch line number key to call line background macro             \lst@Key{numbers}{none}{%                 \def\lst@PlaceNumber{\lst@linebgrd}%                 \lstKV@SwitchCases{#1}{%                     none&\\%                     left&\def\lst@PlaceNumber{\llap{\normalfont                     \lst@numberstyle{\thelstnumber}\kern\lst@numbersep}\lst@linebgrd}\\%                     right&\def\lst@PlaceNumber{\rlap{\normalfont                     \kern\linewidth \kern\lst@numbersep                     \lst@numberstyle{\thelstnumber}}\lst@linebgrd}%                 }{%                     \PackageError{Listings}{Numbers #1 unknown}\@ehc%                 }%             }          % New keys             \lst@Key{linebackgroundcolor}{}{%                 \def\lst@linebgrdcolor{#1}%             }             \lst@Key{linebackgroundsep}{0pt}{%                 \def\lst@linebgrdsep{#1}%             }             \lst@Key{linebackgroundwidth}{\linewidth}{%                 \def\lst@linebgrdwidth{#1}%             }             \lst@Key{linebackgroundheight}{\ht\strutbox}{%                 \def\lst@linebgrdheight{#1}%             }             \lst@Key{linebackgrounddepth}{\dp\strutbox}{%                 \def\lst@linebgrddepth{#1}%             }             \lst@Key{linebackgroundcmd}{\color@block}{%                 \def\lst@linebgrdcmd{#1}%             }          % Line Background macro             \newcommand{\lst@linebgrd}{%                 \ifx\lst@linebgrdcolor\empty\else                     \rlap{%                         \lst@basicstyle                         \color{-.}% By default use the opposite (`-`) of the current color (`.`) as background                         \lst@linebgrdcolor{%                             \kern-\dimexpr\lst@linebgrdsep\relax%                             \lst@linebgrdcmd{\lst@linebgrdwidth}{\lst@linebgrdheight}{\lst@linebgrddepth}%                         }%                     }%                 \fi             }              \makeatother               \begin{document}          \begin{lstlisting}[         language = C,         linebackgroundcolor = {\btLstHL{4-6,9}},     ]     /**     * Prints Hello World.     **/     #include <stdio.h>     }     int main(void) {         printf("Hello World!");           return 0;     }     \end{lstlisting}          \end{document}


title: Flattening BibTeX files

text: Is there a tool that "flattens" a complicated BibTeX file? In particular, I would like to:   1. Expand `@STRING` macros, for example:              @STRING{foo = {Bar}}     @MISC{x, title = foo}      ⇓              @MISC{x, title = {Bar}}        2. Expand cross references, for example:              @INPROCEEDINGS{x, title = {A}, crossref = y}     @PROCEEDINGS{y, title = {B}, booktitle = {B}}      ⇓              @INPROCEEDINGS{x, title = {A}, booktitle = {B}}


title: Rounded corners as a tangent in the right direction

text: I want to split a path into two branches as in the following MWE.               \documentclass{article}     \usepackage{tikz}     \usetikzlibrary{positioning}     \begin{document}     \begin{tikzpicture}       \node (A) [rectangle] {A};       \node (B) [rectangle,above right=1cm and 4cm of A] {B};       \node (C) [rectangle,below right=1cm and 4cm of A] {C};       \draw [->, rounded corners=1cm] (A) -| +(2cm,0cm) |- (B);       \draw [->, rounded corners=1cm] (A) -| +(2cm,0cm) |- (C);     \end{tikzpicture}     \end{document}      This is the result: ![an awkward result](http://i.stack.imgur.com/4IfRd.png) There are many things wrong with that.   1. The left quater circle to C goes in the wrong direction   2. The circles should be a tangent to each other   3. They should meet in exactly the middle of A and BC I think I still didn't get the thing about positioning in TikZ. Can someone help me?


title: How to cut a horizontal line by a perpendicular line?

text: I'd like to cut the line _AC_ at the point _p_ by a perpendicular line.               \documentclass{article}     \usepackage{xypic}     \begin{document}     \xymatrix{     & B\ar @{-}[d] &\\     A\ar @{-}[rr]_{P} &  & C       }     \end{document}


title: Provide an example of how to detect when a page break is about to occur

text: I have a long text and using `supertabular` package. While I know that the package and LaTeX itself calculate and determine when to have a page break, would it possible to know when the page break is about to occur or it is just occurred? Thank you for your help. Thank you David. In the following LaTeX document you will see on page 2 that the two header coincide. One header is controlled by the fancyheader and this is ok, however the other one can be eliminated if I know that the page break occurred or that the header will be displayed. Also and if it is not to much to ask, on this same document I used redefine command, which works great, but on the first page I do not have a value and hence it will print blank. I tried `ifthenelse` and `ifnum` but did not work, is there a way on the fancy header to find if it is the first page do not display this line of the header? Any help will be greatly appreciated.               \documentclass[10pt,english]{report}     \usepackage[letterpaper,top=2.0cm,bottom=2.0cm,left=0.5cm,right=1cm]{geometry}     \usepackage{booktabs}     \usepackage{calc}     \usepackage{ifthen}     \usepackage{array}     \usepackage{fancyhdr}     \usepackage[iso]{datetime}     \usepackage{lastpage}     \usepackage[english]{babel}     \usepackage[T1]{fontenc}     \usepackage[utf8]{inputenc}     \pagestyle{fancy}     \fancyhf{}     \setlength\headheight{0.5pt}     \chead{\textbf{\normalsize{Neuroscience Report}}}     \lhead{\textbf{UCLA}}     \rhead{\textbf{\footnotesize{Draft}}}     \rfoot{\today \hspace{0.5pt} \currenttime}     \cfoot{Page \thepage}\lfoot{UCLA}          \renewcommand{\headrulewidth}{1pt}          \usepackage{supertabular}     \newcommand{\NewText}{}     \newcommand{\Testit}{\NewText}     \begin{document}     \tablehead     {     \toprule[1pt]     \multicolumn{1}{c}{\textbf{Col1}} & \textbf{Col2} & \textbf{Col3} & \textbf{Col4} & \textbf{Col5} & \textbf{Col6} & \multicolumn{1}{c}{\textbf{SubCol1}}\\      & & & & & & \multicolumn{1}{c}{\textbf{SubCol2}}\\     \toprule[1pt]     \multicolumn{6}{l}{\textbf{\Testit}}\\}          \begin{supertabular}{p{37mm}p{15mm}p{23mm}p{26mm}p{33mm}p{10mm}p{37mm}}     \multicolumn{6}{l}{\textbf {Set 1}}\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     \toprule[1pt]\\     \multicolumn{6}{l}{\textbf {Set 2}}\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     \toprule[1pt]\\     \multicolumn{6}{l}{\textbf {Set 3}}\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     \gdef\NewText{Set 4}     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     \toprule[1pt]\\     \multicolumn{6}{l}{\textbf {Set 4}}\\     03/07/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     03/05/2012 17:07:00 & Par1 & Par2 & Par3 & \raggedright{Par4} & Par5 & 04/19/2012 00:01:06\\     \toprule[1pt]\\     \end{supertabular}     \end{document}


title: Footer Suppression

text: I'm wondering if it's possible to suppress footers if the page has a footnote, but display the footer as normal otherwise. To be specific, I'm reproducing an old book which uses catchwords for pages without footnotes, so I am using the `\NextWordBox` macro from the `fwlw` package inside my footer. Thanks all and have a great Christmas. EDIT: The solution provided by ADP works except for cases where the word with the footnote is the first word of a page, in which case the previous page style is reset instead of the page with the footnote. Here's a MWE.               \documentclass[14pt,twoside,openright]{memoir}     \usepackage[symbol,perpage]{footmisc}     \usepackage{fwlw}     \makepagestyle{fn} %defines style when footnote is present     \makeevenhead{fn}{\thepage}{THE TWO NEW SCIENCES OF GALILEO}{}     \makeoddhead{fn}{}{\leftmark}{\thepage}     \makeoddfoot{fn}{}{}{}     \makeevenfoot{fn}{}{}{}     \makepagestyle{standard} %defines headings     \makeevenhead{standard}{\thepage}{THE TWO NEW SCIENCES OF GALILEO}{}     \makeoddhead{standard}{}{\leftmark}{\thepage}     \makeoddfoot{standard}{}{}{\usebox\NextWordBox}     \makeevenfoot{standard}{}{}{\usebox\NextWordBox}     \pagestyle{standard}     \newcommand{\myfootnote}[1]{%         \footnote{#1}%         \thispagestyle{fn}%change pagestyle for this page only.     }     \begin{document}     This is a sentence.     \newpage     This is another sentence.\myfootnote{This is a footnote}     \newpage     This is yet another sentence.     \end{document}


title: Using page counter in \newtheorem

text: I would like to use the page counter as a the first part of the label for definitions. I tried               \newtheorem{definition}{Definition}[page]      but that wouldn't work if the definition is at the top of a new page, presumably because of this. Is there any way around it?


title: How to include subsection titles next to the bullets with the singapore beamer theme?

text: I am using `Singapore` theme in `beamer` and I would like to have the title of the subsections appearing next to the corresponding bullets, in the header. Would anyone have a suggestion on how to proceed ? I am a rather naive LaTeX user...


title: How to put sender address to the right on top of date in scrlttr2

text: I am using `scrlttr2` instead of the default `letter` for the various extra features it offers, but I want the `fromaddress` to be on top of the date and not in the page header. So I want it to look just like the default `letter` puts it. Is there any way I could remove the sender address from the header and put it on the date (with just one line of space)? I have this preamble so far:               \documentclass[paper=a4,parskip=full]{scrlttr2}     \usepackage[english]{babel}     \usepackage[latin1]{inputenc}     \usepackage{amsmath}     \usepackage{amsfonts}     \usepackage{amssymb}          \KOMAoptions{foldmarks=off,backaddress=false,fromalign=right}          \renewcommand*{\raggedsignature}{\raggedright}      This puts the from address in the header on the right and not aligned with the date. I want it to be lower (just over the date) and aligned with the date.


title: Back references for shorthandlist

text: I am using `biblatex` for writing my thesis and it works generally fine. Now I want to put back references to my bibliography. However, after putting the option into the preamble, the back references only appear in the normal bibliography but not in the list of the shorthands. Does anyone know how to make the shorthand list including the back references? Here is a mini example (compiled with `lualatex`, but I think the result is the same as with `latex`):               \documentclass{memoir}     \usepackage{filecontents}     \begin{filecontents*}{mybib.bib}          @book{Abook,     author = {First Author and The Second Author},     title = {The Longtitle and not the Shorttitle},     shorthand = {LnS},     publisher = {The Publisher},     address =  {Address},     year = {1965}}          @article{Aarticle,     author = {Article Author},     journal = {Journal Title},     pages = {113-126},     title = {Title of the Article},     volume = {65},     year = {1968}}          \end{filecontents*}     \usepackage[hidelinks]{hyperref}     \usepackage[style=philosophy-modern,backref=true,hyperref=true,language=auto,autocite=inline]{biblatex}          \defbibcheck{noshorthand}{%     \iffieldundef{shorthand}{}{\skipentry}}          \bibliography{mybib}     \bibintoc     \usepackage[ngerman,english]{babel}%english names of sections     \usepackage[babel,english=british]{csquotes}          \begin{document}     Backreference?     \cite{Abook}     \cite{Aarticle}     \printshorthands     \printbibliography[check=noshorthand]     \end{document}      Result: ![enter image description here](http://i.stack.imgur.com/Z2Hvu.png) ![enter image description here](http://i.stack.imgur.com/a23Yn.png) ![enter image description here](http://i.stack.imgur.com/KDDzB.png)


title: How to encoding of Lyx LaTeX output without Lyx adding inputenc declaration to preamble

text: I want to specify encoding that is used by Lyx when it generates LaTeX source for preview or export. That is not a big problem Document->Settings->Language->Encoding->Other->Select encoding from combo box will do just that. But it will also add command `\usepackage[selectedEncoding]{inputenc}` to preamble of generated document. How do I prevent that? I want all my LaTeX documents to be generated in UTF-8 but I do not want that inputenc declaration in preamble.


title: Adjusting the height of \vline

text: Is there a way to adjust the height of `\vline`?


title: Can't find pdf_tex from inkscape

text: I'm experiencing the same issue as here: I want to make use of "tex in inkscape" technology. Here's a tex:               \documentclass{article}          \usepackage{graphicx}     \usepackage{color}          \begin{document}          \begin{figure}[htb]       \centering       \def\svgwidth{200pt}       \input{drawing.pdf_tex}       \caption{Double pendulum}     \end{figure}     \end{document}      Here's a pdf_tex:               \begingroup       \makeatletter       \providecommand\color[2][]{%         \errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}         \renewcommand\color[2][]{}%       }       \providecommand\transparent[1]{%         \errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}         \renewcommand\transparent[1]{}%       }       \providecommand\rotatebox[2]{#2}       \ifx\svgwidth\undefined         \setlength{\unitlength}{311.07356567pt}       \else         \setlength{\unitlength}{\svgwidth}       \fi       \global\let\svgwidth\undefined       \makeatother       \begin{picture}(1,0.59438645)%         \put(0,0){\includegraphics[width=\unitlength]{drawing.pdf}}%         \put(0.48568235,0.40805542){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$\ell_1$}}}%         \put(0.67084755,0.16631196){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$\ell_2$}}}%         \put(0.71199538,0.04029675){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$m_2$}}}%         \put(0.55254756,0.27175325){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$m_1$}}}%         \put(0.52940191,0.0763011){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$\theta_2$}}}%         \put(0.42138888,0.28204021){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$\theta_1$}}}%       \end{picture}%     \endgroup      I get the error:               ! Unable to load picture or PDF file 'drawing.pdf'.     <to be read again>                         }     l.46 ...egraphics[width=\unitlength]{drawing.pdf}}                                                       %     ?      so it looks like my tex looks for a `drawing.pdf` instead of `drawing.pdf_tex`. I'm using `TeX Live 2012/Debian`.


title: How to use \StrBefore in \chapter with optional argument

text: I want to trim the chapter titles in toc up to first dot.               \documentclass{book}     \usepackage{xstring}          \newcommand{\chap}[1]{%         \chapter[\StrBefore{#1}{.}]{#1}     }     \begin{document}     \chap{Some title. Very long}          Foo Bar          \end{document}      Unfortunately this doesn't work - what am I missing here? (Xe)LaTeX gives me:               Chapter 1.     ! Use of \@chapter doesn't match its definition.     \@ifnextchar ... \reserved@d =#1\def \reserved@a {                                                    #2}\def \reserved@b {#3}\f...     l.8 \chap{Some title. Very long}


title: Add notches to characters

text: The title is self-explanatory really, all I really want to do is be able to add some kind of notch to any character, so that they are visible if you are actively looking for them. Like accents, but less obvious and more customizable. EDIT: David Carlisle asked about what kind of notch I was talking, I was thinking something like: ![Indentation in a character](http://i.imgur.com/nSLhM.png) ![Or the opposite](http://i.imgur.com/lLhL5.png) Either would work, but I would prefer something like the first one. More specifically working with the cedilla thing, I would cut off the round part, keep the square at the top and move it up and to the right, but still such that it would be connected wih it.


title: How to get Matlab code into a LaTeX document?

text: I'm trying to put in my thesis matlab code but the results are not very good. I would get something like that but I don't know what packages using and how to create this result: ![enter image description here](http://i.stack.imgur.com/3qEbr.png)


title: Changing the font size of nodes inside a savebox causes TeX to exceed stack size

text: I'd like to have a tikzpicture (actually several) appear inside a node of another tikzpicture. I already know that I can use savebox for that, the problem is: When I change the fontsize of a node inside of this nested picture it causes TeX to exceed its stack size, giving the following error: `TeX capacity exceeded, sorry [input stack size=5000].` It works if I leave the font size at normal, so that seems to be the root of the problem. However, as I do want the text in the node to be smaller, that's not a solution... I've searched for an hour now to find a solution, but am pretty much stuck. Increasing the stack size to 50000 didn't work, neither did putting extra braces anywhere. Does anyone have an idea why this eats all of my save stack? MWE:               \documentclass{article}     \usepackage[utf8]{inputenc}     \usepackage{tikz}          \usetikzlibrary{positioning}          \begin{document}     \begin{tikzpicture}         \node (1) {$x$};              \newsavebox\MyBox         \begin{lrbox}{\MyBox}             \begin{tikzpicture}                 \node (1) {\scriptsize $y$};             \end{tikzpicture}         \end{lrbox}              \node[right=of 1] (2) {\usebox\MyBox};     \end{tikzpicture}     \end{document}      As said, it works fine, if I remove the `\scriptsize`. I do know of course, that the MWE can be done differently (read: without the savebox), the thing I actually want to do however would require a lot of rewriting to be done differently, so I'd prefer to find a solution to this problem...


title: svg from inkscape -- doesn't work in xelatex?

text: I want to make use of "svg in tex" technology. Here's a tex:               \documentclass{article}     \usepackage{color}     \usepackage{graphicx}          \newcommand{\executeiffilenewer}[3]{%         \ifnum\pdfstrcmp{\pdffilemoddate{#1}}%             {\pdffilemoddate{#2}}>0{\immediate\write18{#3}}         \fi}          \newcommand{\includesvg}[1]{%         \executeiffilenewer{#1.svg}{#1.pdf}%             {inkscape -z -D --file=#1.svg --export-pdf=#1.pdf --export-latex}%         \input{#1.pdf_tex}}          \begin{document}     \begin{figure}         \centering         %\def\svgwidth{\columnwidth}         \includesvg{svgfig}         \caption{My SVG Image}     \end{figure}     \end{document}      One can take any svg image. Then:               pdflatex -shell-escape tex-file      works, but               xelatex -shell-escape tex-file      and               xelatex -shell-escape -8bit tex-file      both give error:               ! Undefined control sequence.     \executeiffilenewer #1#2#3->\ifnum \pdfstrcmp                                                    {\pdffilemoddate {#1}}{\pdffil...     l.19     \includesvg{svgfig}      **Edit** : Currently I prepare pdfs from svg before compiling then doc, so I do have "svgs in xetex". I even automated the thing in bash, so I'm pretty happy. Nevertheless, all problems should be solved, and all issues cleared -- so if someone aware of XeTeX internals thinks something is wrong -- it sould be reported and fixed.


title: Error when trying to open pdf file from AUCTeX

text: I'm new to Emacs and AUCTeX. On my home computer (with Windows XP) I can successfully compile .tex files and then, using C-c C-c again, launch a pdf viewer (Adobe Reader or Sumatra) to view the file. However, on my work computer (Windows 7), I can successfully compile a .tex file to pdf using C-c C-c, but when I do C-c C-c again to view, the default view command that appears is `start "" "a.pdf"`. Pressing Enter brings up the Windows error message `Windows cannot find 'a.pdf'. Make sure you typed the name correctly, and then try again.` If I change the command so that it includes the full location of the file, e.g. `start "" "//servername/mark/a.pdf"`, then the pdf viewer opens. At home, there is no need to change the default command `start "" "a.pdf"`. I'd appreciate if anyone can tell me how to get the pdf viewer to open without having to edit the command each time. At work I have AUCTeX version 11.86.


title: Creating my own \tableofcontents in plain TeX

text: I'd like to define my own table of contents in TeX (not LaTeX, so without packages) to have a fine control on what goes there, how the numbers are displayed, etc. Basically what I would like is to write a file that looks like               1.0.0.Title of chapter 1     1.1.0.Title of section 1     1.1.1.Title of subsection 1.1     1.1.2.Title of subsection 1.2     2.0.0.Title of chapter 2     A.0.0.Title of appendix A      and read it with these kind of options:   * write a table of contents including only the chapters   * write a table of contents including only the chapter 1 and its sections   * ... To do so I have 2 questions:   1. How can I (re)write some content at a particular line to keep my file sorted? (e.g. if after a second compilation I change the title of chapter 2 and I add a subsection 1.3 in chapter 1, how do I update my file?)   2. How do `\read` this file? I'm new with file writing/reading in TeX so I don't know if there is any care to take or a special way to do this? * * * After thinking of my question, question 2 might trivial if the file is written in the template               \toccontent{1}{0}{0}{Title of chapter 1}     ...      so that it only has to be `\input`ted, after redefining `\toccontent` according to what and how I want to display (e.g. "do nothing if the 2nd argument is not 0").


title: Scary Font Echo Effect

text: I'm trying to reproduce a strange font effect that is normally seen in horror movie trailers. In the trailers, a word will usually be flashed on screen, with 'echos' or 'shadows' of the word around it. I failed utterly to find an example, but I rigged up an image that looks something like the effect: ![enter image description here](http://i.stack.imgur.com/01Vqz.jpg) In some renditions, the shadows overlap the word, in others the shadows don't touch the word; I am not particular. My question is: How would you achieve this effect on a few words or part of a sentence using LaTeX? For bonus points: Can the shadow effect be achieved and still leave the surrounding words readable? [EDIT]For further clarification: I did specify 'LaTeX', but any flavor of tex is A-OK in my book.


title: Avoiding recompilation of unchanged part of a document

text: I am currently editing a relatively long document in arabic with the package `arabtex`, everything is going quite fine but the compilation takes several minutes. As I need to edit only small parts at once, I need to recompile only modified parts. I can accept pagebreaks between these parts. I already tried `input`, `include` and `subfiles` packages, but they all seem to recompile the whole document even if nothing changed. I would like to precise that I need, at any time, the whole document to be complete as   1. my contributions are only comments that can be inserted anywhere in the document    2. the editing is intended to be a collaborative with other persons on several platforms. So I cannot consider the `includeonly` solution. I considered using several separate documents and merging the pdfs in a single one, but the compilation process becomes a bit more tedious and not easy to use. Is there an elegant way to do so ?


title: mathdesign fails with font error

text: I have mathdesign installed with texlive 2013. Nothing special about the installation, at least mathdesign or its fonts are not installed by myself. Everything worked half year ago, but latest updates now cause an error with this code:               \documentclass{minimal}     \usepackage[charter]{mathdesign}     \begin{document}     Hello     \end{document}      Here's the output of `\listfiles`                *File List*      minimal.cls    2001/05/25 Standard LaTeX minimal class     mathdesign.sty    2013/08/29 v2.31 Math Design Project       keyval.sty    1999/03/16 v1.13 key=value parser (DPC)       ifthen.sty    2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)        mdbch.cfg        mdbch.sty    2013/08/29 v2.31 bitstream bitstream charter + mdbch (Math Design Project)       mdfont.def    2013/08/29 v2.31 (Math Design Project)     mdsffont.def    2013/08/29 v2.31 (Math Design Project)     mdttfont.def    2013/08/29 v2.31 (Math Design Project)      xkeyval.sty    2012/10/14 v2.6b package option processing (HA)      xkeyval.tex    2012/10/14 v2.6b key=value parser (HA)     ot1mdbch.fd    2013/08/29 Fontinst v1.933 font definitions for OT1/mdbch.      fontenc.sty        t1enc.def    2005/09/27 v1.99g Standard LaTeX file      t1mdbch.fd    2013/08/29 Fontinst v1.933 font definitions for T1/mdbch.       mdacmr.fd       mdbcmr.fd       The error is this one               name = md-chr8y, rootname = md-chr8y, pointsize = mktexmf: empty or non-existent rootfile!          Cannot find font md-chr8y in map file(s).          kpathsea: Running mktexmf md-chr8y.mf The command name is C:\texlive\2013\bin\win32\mktexmf Cannot find md-chr8y.mf . I try ps2pk --> gsftopk --> ttf2pk --> hbf2gf. ps2pk cannot be used. I try gsftopk. gsftopk.exe md-chr8y 576 gsftopk cannot be used. Next I try ttf2pk. ttf2pk.exe -q md-chr8y 576 ttf2pk failed. Finally I try hbf2gf. hbf2gf.exe -q -p md-chr8y 576 All trials failed. kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 0+576/600 --dpi 576 md-chr8y The command name is C:\texlive\2013\bin\win32\mktexpk kpathsea: Appending font creation commands to missfont.log.          !pdfTeX error: pdflatex.exe (file md-chr8y): Font md-chr8y at 576 not found           ==> Fatal error occurred, no output PDF file produced!      What can I do to solve this font problem? Log files: **missfont.log**               mktexpk --mfmode / --bdpi 600 --mag 0+576/600 --dpi 576 md-chr8y      **complete log file**               This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/W32TeX) (format=pdflatex 2014.1.16)  18 JAN 2014 13:41     entering extended mode      \write18 enabled.      %&-line parsing enabled.     **"fontsample - Charter-Bera Sans-Luxi Mono.tex"     (./fontsample - Charter-Bera Sans-Luxi Mono.tex     LaTeX2e <2011/06/27>     Babel <3.9h> and hyphenation patterns for 78 languages loaded.     (c:/texlive/2013/texmf-dist/tex/latex/base/minimal.cls     Document Class: minimal 2001/05/25 Standard LaTeX minimal class     ) (c:/texlive/2013/texmf-dist/tex/latex/mathdesign/mathdesign.sty     Package: mathdesign 2013/08/29 v2.31 Math Design Project          (c:/texlive/2013/texmf-dist/tex/latex/graphics/keyval.sty     Package: keyval 1999/03/16 v1.13 key=value parser (DPC)     \KV@toks@=\toks14     )     (c:/texlive/2013/texmf-dist/tex/latex/base/ifthen.sty     Package: ifthen 2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)     )     (c:/texlive/2013/texmf-dist/tex/latex/mathdesign/mdbch/mdbch.cfg)     (c:/texlive/2013/texmf-dist/tex/latex/mathdesign/mdbch/mdbch.sty     Package: mdbch 2013/08/29 v2.31 bitstream bitstream charter + mdbch (Math Desig     n Project)          (c:/texlive/2013/texmf-dist/tex/latex/mathdesign/mdfont.def     File: mdfont.def 2013/08/29 v2.31 (Math Design Project)     )     (c:/texlive/2013/texmf-dist/tex/latex/mathdesign/mdsffont.def     File: mdsffont.def 2013/08/29 v2.31 (Math Design Project)     )     (c:/texlive/2013/texmf-dist/tex/latex/mathdesign/mdttfont.def     File: mdttfont.def 2013/08/29 v2.31 (Math Design Project)     )     \symmdcal=\mathgroup4     LaTeX Font Info:    Overwriting symbol font `mdcal' in version `bold'     (Font)                  OMS/mdbch/m/n --> OMS/mdbch/b/n on input line 97.     \symmdscr=\mathgroup5     LaTeX Font Info:    Overwriting symbol font `mdscr' in version `bold'     (Font)                  OMS/mdbch/m/n --> OMS/mdbch/b/n on input line 103.     LaTeX Font Info:    Overwriting math alphabet `\mathfrak' in version `bold'     (Font)                  U/xmdeuf/m/n --> U/xmdeuf/b/n on input line 110.     LaTeX Font Info:    Overwriting symbol font `operators' in version `normal'     (Font)                  OT1/cmr/m/n --> OT1/mdbch/m/n on input line 121.     LaTeX Font Info:    Overwriting symbol font `letters' in version `normal'     (Font)                  OML/cmm/m/it --> OML/mdbch/m/it on input line 122.     LaTeX Font Info:    Overwriting symbol font `symbols' in version `normal'     (Font)                  OMS/cmsy/m/n --> OMS/mdbch/m/n on input line 123.     LaTeX Font Info:    Overwriting symbol font `largesymbols' in version `normal'     (Font)                  OMX/cmex/m/n --> OMX/mdbch/m/n on input line 124.     LaTeX Font Info:    Overwriting symbol font `operators' in version `bold'     (Font)                  OT1/cmr/bx/n --> OT1/mdbch/b/n on input line 126.     LaTeX Font Info:    Overwriting symbol font `letters' in version `bold'     (Font)                  OML/cmm/b/it --> OML/mdbch/b/it on input line 127.     LaTeX Font Info:    Overwriting symbol font `symbols' in version `bold'     (Font)                  OMS/cmsy/b/n --> OMS/mdbch/b/n on input line 128.     LaTeX Font Info:    Overwriting symbol font `largesymbols' in version `bold'     (Font)                  OMX/cmex/m/n --> OMX/mdbch/b/n on input line 129.     LaTeX Font Info:    Overwriting math alphabet `\mathrm' in version `normal'     (Font)                  OT1/mdbch/m/n --> OT1/mdbch/m/n on input line 131.     LaTeX Font Info:    Overwriting math alphabet `\mathbf' in version `normal'     (Font)                  OT1/cmr/bx/n --> OT1/mdbch/b/n on input line 132.     LaTeX Font Info:    Overwriting math alphabet `\mathit' in version `normal'     (Font)                  OT1/cmr/m/it --> OT1/mdbch/m/it on input line 133.     LaTeX Font Info:    Overwriting math alphabet `\mathsf' in version `normal'     (Font)                  OT1/cmss/m/n --> OT1/cmss/m/n on input line 134.     LaTeX Font Info:    Overwriting math alphabet `\mathtt' in version `normal'     (Font)                  OT1/cmtt/m/n --> OT1/cmtt/m/n on input line 135.     LaTeX Font Info:    Overwriting math alphabet `\mathrm' in version `bold'     (Font)                  OT1/mdbch/b/n --> OT1/mdbch/b/n on input line 137.     LaTeX Font Info:    Overwriting math alphabet `\mathbf' in version `bold'     (Font)                  OT1/cmr/bx/n --> OT1/mdbch/b/n on input line 138.     LaTeX Font Info:    Overwriting math alphabet `\mathit' in version `bold'     (Font)                  OT1/cmr/bx/it --> OT1/mdbch/b/it on input line 139.     LaTeX Font Info:    Overwriting math alphabet `\mathsf' in version `bold'     (Font)                  OT1/cmss/bx/n --> OT1/cmss/b/n on input line 140.     LaTeX Font Info:    Overwriting math alphabet `\mathtt' in version `bold'     (Font)                  OT1/cmtt/m/n --> OT1/cmtt/b/n on input line 141.     \symlettersupright=\mathgroup6     LaTeX Font Info:    Overwriting symbol font `lettersupright' in version `bold'     (Font)                  OML/mdbch/m/n --> OML/mdbch/b/n on input line 144.     LaTeX Font Info:    Redeclaring math alphabet \mathrm on input line 145.     LaTeX Font Info:    Overwriting math alphabet `\mathcal' in version `normal'     (Font)                  OMS/mdbch/m/n --> OMS/mdbch/m/n on input line 167.          (c:/texlive/2013/texmf-dist/tex/latex/xkeyval/xkeyval.sty     Package: xkeyval 2012/10/14 v2.6b package option processing (HA)          (c:/texlive/2013/texmf-dist/tex/generic/xkeyval/xkeyval.tex     \XKV@toks=\toks15     \XKV@tempa@toks=\toks16     \XKV@depth=\count79     File: xkeyval.tex 2012/10/14 v2.6b key=value parser (HA)     ))     LaTeX Font Info:    Try loading font information for OT1+mdbch on input line 18     6.          (c:/texlive/2013/texmf-dist/tex/latex/mathdesign/mdbch/ot1mdbch.fd     File: ot1mdbch.fd 2013/08/29 Fontinst v1.933 font definitions for OT1/mdbch.     )     LaTeX Font Info:    Font shape `OT1/mdbch/m/n' will be     (Font)              scaled to size 9.60007pt on input line 186.     LaTeX Font Info:    Redeclaring math accent \widetilde on input line 449.     LaTeX Font Info:    Redeclaring math accent \widehat on input line 450.     \symmathdesignA=\mathgroup7     LaTeX Font Info:    Overwriting symbol font `mathdesignA' in version `bold'     (Font)                  MDA/mdbch/m/n --> MDA/mdbch/b/n on input line 491.     \symmathdesignB=\mathgroup8     LaTeX Font Info:    Overwriting symbol font `mathdesignB' in version `bold'     (Font)                  MDB/mdbch/m/n --> MDB/mdbch/b/n on input line 498.     \@emptytoks=\toks17     LaTeX Font Info:    Redeclaring math accent \widetilde on input line 532.     LaTeX Font Info:    Redeclaring math accent \widehat on input line 533.     \rulethickness=\skip41     )     (c:/texlive/2013/texmf-dist/tex/latex/base/fontenc.sty     Package: fontenc 2005/09/27 v1.99g Standard LaTeX package          (c:/texlive/2013/texmf-dist/tex/latex/base/t1enc.def     File: t1enc.def 2005/09/27 v1.99g Standard LaTeX file     LaTeX Font Info:    Redeclaring font encoding T1 on input line 43.     )     LaTeX Font Info:    Try loading font information for T1+mdbch on input line 100     .          (c:/texlive/2013/texmf-dist/tex/latex/mathdesign/mdbch/t1mdbch.fd     File: t1mdbch.fd 2013/08/29 Fontinst v1.933 font definitions for T1/mdbch.     )     LaTeX Font Info:    Font shape `T1/mdbch/m/n' will be     (Font)              scaled to size 9.60007pt on input line 100.     ))     (./fontsample - Charter-Bera Sans-Luxi Mono.aux)     \openout1 = `"fontsample - Charter-Bera Sans-Luxi Mono.aux"'.          LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 4.     LaTeX Font Info:    ... okay on input line 4.     LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 4.     LaTeX Font Info:    ... okay on input line 4.     LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 4.     LaTeX Font Info:    ... okay on input line 4.     LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 4.     LaTeX Font Info:    ... okay on input line 4.     LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 4.     LaTeX Font Info:    ... okay on input line 4.     LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 4.     LaTeX Font Info:    ... okay on input line 4.     LaTeX Font Info:    Checking defaults for MDA/cmr/m/n on input line 4.     LaTeX Font Info:    Try loading font information for MDA+cmr on input line 4.          (c:/texlive/2013/texmf-dist/tex/latex/mathdesign/mdacmr.fd     File: mdacmr.fd      )     LaTeX Font Info:    ... okay on input line 4.     LaTeX Font Info:    Checking defaults for MDB/cmr/m/n on input line 4.     LaTeX Font Info:    Try loading font information for MDB+cmr on input line 4.          (c:/texlive/2013/texmf-dist/tex/latex/mathdesign/mdbcmr.fd     File: mdbcmr.fd      )     LaTeX Font Info:    ... okay on input line 4.      [1{c:/Users/Matthias Pospiech/.texlive2013/texmf-var/fonts/map/pdftex/updmap/p     dftex.map}]     (./fontsample - Charter-Bera Sans-Luxi Mono.aux)           *File List*      minimal.cls    2001/05/25 Standard LaTeX minimal class     mathdesign.sty    2013/08/29 v2.31 Math Design Project       keyval.sty    1999/03/16 v1.13 key=value parser (DPC)       ifthen.sty    2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)        mdbch.cfg        mdbch.sty    2013/08/29 v2.31 bitstream bitstream charter + mdbch (Math Desi     gn Project)       mdfont.def    2013/08/29 v2.31 (Math Design Project)     mdsffont.def    2013/08/29 v2.31 (Math Design Project)     mdttfont.def    2013/08/29 v2.31 (Math Design Project)      xkeyval.sty    2012/10/14 v2.6b package option processing (HA)      xkeyval.tex    2012/10/14 v2.6b key=value parser (HA)     ot1mdbch.fd    2013/08/29 Fontinst v1.933 font definitions for OT1/mdbch.      fontenc.sty        t1enc.def    2005/09/27 v1.99g Standard LaTeX file      t1mdbch.fd    2013/08/29 Fontinst v1.933 font definitions for T1/mdbch.       mdacmr.fd           mdbcmr.fd          ***********           )      Here is how much of TeX's memory you used:      1615 strings out of 493308      22205 string characters out of 6141367      59673 words of memory out of 5000000      5109 multiletter control sequences out of 15000+600000      6898 words of font info for 18 fonts, out of 8000000 for 9000      957 hyphenation exceptions out of 8191      34i,4n,29p,279b,98s stack positions out of 5000i,500n,10000p,200000b,80000s          !pdfTeX error: pdflatex.exe (file md-chr8y): Font md-chr8y at 576 not found      ==> Fatal error occurred, no output PDF file produced!


title: How can I test the first character on each line of a listing?

text: The listings package defines a hook called `EveryLine` to allow users to execute TeX code at the beginning of each line of a listing; the following is taken directly from the `listings` source code (`listings.dtx`): > >     \hookname{EveryLine} >   >     Executed at the beginning of each \emph{output} line, i.e.~more than >     once for broken lines. This hook must not change the horizontal or >     vertical position. >   The code below is my attempt at using this hook to test whether the first character of each line is `f` and insert `YES` before it in that case. However, as you can see below, I'm not getting the expected output. At first, I thought if might be a grouping problem: the code inserted at the `EveryLine` might be buried inside a group and, as a result, my test could not access the first token on the line, because that token lies outside the group in question. However, a quick test (consisting in locally incrementing a TeX register) shows that it's not the case. Any idea what I'm doing wrong? ![enter image description here](http://i.stack.imgur.com/dKG3c.png)               \documentclass{article}          \usepackage{listings}          \usepackage{filecontents}     \begin{filecontents*}{sample.c}     foo     bar     frivolous     thing     discourse     fragile     \end{filecontents*}          \makeatletter     \lst@AddToHook{EveryLine}{\@ddedToEveryline}     \def\detectF#1{\ifx f#1 YES#1\fi}     \newcount\mycount     \def\advandprintCount{\advance\mycount by \@ne\the\mycount}     \makeatother          \begin{document}          \makeatletter          \let\@ddedToEveryline\detectF     \lstinputlisting[basicstyle=\ttfamily]{sample.c}          \let\@ddedToEveryline\advandprintCount     \lstinputlisting[basicstyle=\ttfamily]{sample.c}          \makeatother          \end{document}


title: Plotting a straight line to the peak point of a graph

text: For the MWE below:               \documentclass{report}     \usepackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm]{geometry}     \usepackage[T1]{fontenc}     \usepackage{pgfplots}          \usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%         decorations.pathreplacing,decorations.pathmorphing,shapes,%         matrix,shapes.symbols,automata}          \begin{document}          \begin{figure}[H]     \begin{tikzpicture}     \begin{axis}[%     width=1*\textwidth,     height=8cm,     xlabel={Query},     ylabel={Elapsed Time (in seconds)},     grid = both,     minor x tick num=3,     minor y tick num=3,     enlarge x limits=0     ]     \addplot [     color=red,     solid,     line width=1.0pt     ]     coordinates{          (0,6.66003) (1,9.10814) (2,182.761) (3,109.154) (4,246.253) (5,206.129) (6,212.653) (7,240.088) (8,4.49266) (9,263.248) (10,257.65) (11,147.81) (12,87.5402) (13,127.389) (14,167.028) (15,2.35324) (16,120.594) (17,2.4295) (18,13.0306) (19,126.756) (20,64.0324) (21,100.611) (22,14.7892) (23,2.41528) (24,132.193) (25,9.94301) (26,156.253) (27,123.016) (28,186.208) (29,102.549) (30,194.67) (31,184.039)      };          \end{axis}     \end{tikzpicture}     \caption{Blah}     \end{figure}          \end{document}      Is it possible to draw a straight line to the peak of the graph ? It will basically visually indicate the highest point of the the plot.


title: fp calculation variable

text: I want to do some calculations in a LaTeX document; the result of the first is used in the next calculation. I figured out that the `fp` package should do the job. Here is an example:               \FPeval{\result}{round(400*1.06,0)}%     $400+6\%=\result$\\     \FPeval{\result}{round(424*1.06,0)}%     $424+6\%=\result$      The first `\result` should be stored in a varable of some sort an fed into the next equation.


title: Why does \dot over \vec over {\bf E} gives a tilde?

text: When using AMSmath and trying to put a `\dot` over a `\vec` of a bold symbol it works, but subsequent instances have a tilde instead of a vector over the bold symbol, and strangely my partial wrt become bold. If I don't use AMSmath, this works. I have tried many variants with extra brackets or interchanged orders, but nothing seems to fix this bug. Here is a tex snippet that reproduces the problem on the second row, the third row when preceding `{\vec E}` with `\bf` produces only tildes instead of vectors, but the `\dot` make the `D` not be bold. Any ideas what I am missing?               \documentclass [12pt] {article}     \usepackage{amsmath,amssymb}          %\let\vec\relax     %\DeclareMathAccent{\vec}{\mathord}{letters}{"7E}     \newcommand{\pdt}[1]{\frac{\partial^{#1}}{\partial t^{#1}}}     \begin{document}          \LARGE     $     \vec E \cdot \dot{{\vec D}} =     \vec E \cdot \pdt{} (\epsilon \vec E )     $          $     \vec {\bf E} \cdot \dot {\vec {\bf D}} =     \vec {\bf E} \cdot \pdt{} (\epsilon \vec {\bf E} )     $          $      {\bf {\vec E}} \cdot \dot{ {\bf {\vec D}}} =      {\bf {\vec E}} \cdot \pdt{} (\epsilon  {\bf {\vec E}} )     $     \end{document}


title: title too long when using amsart

text: I am going to submit an artcile to a conference, and it requires the authours to use amsart document class. When I use this class, on the top of each page, it shows the title or authros name(and Institut). My article has a long title, but it is fine in the first page. But from 2nd page to the end, the title shown on the top is too long to fit in a page width. I am not going to drop these titles, since it requires the authous not to change the style. But if I can use a shorter title to be shown on the top of each page, but keep the original title to be shown on the first page, it would be good. Someone had the same problem before? And how you deal with it?


title: Defining a different symbol to be used as a sum-class symbol

text: If I'm interested in using an arbitrary symbol or character instead of the default sum-class symbols (such as `\int`, `\coprod`, etc), solely with the interest of preserving subscripts and superscripts above and below the symbol, how should I proceed?


title: \verbatim environment compatible with lingmacros \enumsentence

text: Using the verbatim environment inside an \enumsentence fails. Here is a MWE:               \documentclass{article}     \usepackage{lingmacros}     \begin{document}     \enumsentence{     \begin{verbatim}     foo     \end{verbatim}     }     \end{document}      I can do a workaround using `\texttt{ }`, but then I have to escape a bunch of funny characters and in general I'd prefer `verbatim` for this. Any suggestions?


title: How to avoid page breaks before enumerate/itemize by default?

text: Basically the same as this question, except I don't want to have to remember to write `\mynobreakpar` (or anything else) everywhere. How do I set this as the default option for all itemize/enumerate/etc. environments?


title: natbib will not auto-indent and \bibhang is not recognized

text: Here's my MWE:                   \documentclass[oneside,11pt]{book}              \usepackage[sort&compress]{natbib}      % for bibliography              \begin{document}              \chapter{one}              here is some stuff and I'm going to reference \cite{Aliyu1985}.              \bibliographystyle{plain}         \bibliography{references}              \end{document}      The references.bib file only contains one reference:                   @inproceedings{Aliyu1985,         title="{{``Effects of Strain Rate on Delamination Fracture Toughness of Graphite/Epoxy"}}",         author="Aliyu, A.A. and Daniel, I.M.",         booktitle="Delamination and Debonding of Materials",         year="1985",         pages="336-348",         organization="American Society for Testing and Materials",         address="Philadelphia",         publisher="ASTM STP 876",         editor="W.S. Johnson, Ed.",         }      My problem is that the document I am trying to format is my thesis and must conform to my university's format guidelines. The hanging indentation that is supposed to appear in the bibliography (set by \bibhang) is non existent. I've tried setting the length, i.e.                   \setlength{\bibhang}{2em}      or                   \setlength{\bibhang}{0.5in}      to no avail. My document is over 200 pages long, so I would really rather not change the document class or switch to biblatex (not even sure if that would work). Does anyone have any suggestions on how to implement the hanging indentation?


title: Including parts of a LaTeX document in another document WITHOUT splitting up original document

text: I'm working on a paper with some collaborators. At the same time, I'm writing my dissertation for my defense next month. I need to include the paper in the dissertation, but it doesn't just become a chapter. Parts go in one chapter, and parts of it go in another. There are too many parts to just put each in their own file; at least 5 or 6, so I think my collaborators would be upset. Each dissertation chapter is currently a separate file (separate directory even). So what I really want is to slice-and-dice the paper, occasionally even at the level of individual paragraphs, into my thesis, and at the same time be able to merge in changes made by myself and my collaborators on the base paper. This merging should be easy, or preferably done automatically when I request it. (The paper and dissertation are both in subversion.) Do I have any options for accomplishing this fairly easily? Would `\includecomment` and `\excludecomment` from the comment package help me? I've read a little bit about the extract package, which sounded pretty useful except that it's designed to produce free-stranding documents via extraction, whereas I want to extract chunks of LaTeX to be included with `\input`. Does anyone know how well this package works, and whether it could help me? Could I conditionalize the preamble in the paper somehow so that it could all get commented out when I input the extracted tex file? I.e., #ifndef EXTRACT, and #define EXTRACT before I do `\input`? (Also, I presume I could place any new packages directly in the directory so that my collaborators can get it automatically.) I've used TeX for years but am really not an expert, and I really need to get my dissertation written so I can defend. So far I've just forked the paper and was hoping to do subversion merges, but that's not going to be sufficient-- subversion won't be able to track paragraphs I relocated because it doesn't have a concept of relocating a text block.


title: How to remove the first and last letter of a string

text: My example. Need from the string " **$${{15}\over{4}}$$** " get the string " **${{15}\over{4}}$** ".               \documentclass[14pt]{extarticle}     \usepackage{xstring}     \usepackage{amsmath}          \def\f(#1){(#1)^2-5*(#1)+6}               \begin{document}           \section{Problem}     Evaluate $f(x)=\f(x)$ for $x=\frac 1 2$.          \section{Solution}     \immediate\write18{cas "x: 1/2\string$ tex(\f(x))\string$"}     \def\SX{\input{solution}}%This file has a string "$${{15}\over{4}}$$"          \StrGobbleLeft{\SX}{1}[\SX]%It produces an error     \StrGobbleRight{\SX}{1}[\SX]%It produces an error     $f(x)=$\SX          \end{document}      Thanks in advance.


title: Underline and color URL in LuaLaTex

text: I was wondering how I can underline and color URL in LuaLaTex. I was able to add underline but could not change the URL and the underline to blue. Font is Calibri. Thanks!               % code used in LuaLaTex          \documentclass{article}     \usepackage{fancyhdr,graphicx,xcolor,colortbl}     \usepackage{fontspec}          \setmainfont{Calibri}          \begin{document}          Further information can be found online (\underline {http://findsource.org/})          \end{document}


title: Aligning sub-equations within align

text: ## Update: How do I align both the `\sum` signs and the `=` signs in the last two equations? I have updated the picture. ## Original Question: When I use the following code:               \begin{equation}     \begin{split}         \label{eq:BILP}         \mathpzc{I}^* & = \argmax_{\mathcal{I}} \; \left\{\sum_{i\in \mathcal{V}} \left(\theta_K \cdot \mathbb{I}_{i,j}(1,1) + \theta_K \cdot \mathbb{I}_{i,j}(0,0) \right) + \right.\\         & \qquad  \qquad \quad \;\,\;\; \left. \sum_{i\in \mathcal{E}} \theta_{i_0} \cdot \mathbb{I}(x_i=0) + \theta_{i_1} \cdot \mathbb{I}(x_i=1) \right\}\\         & \qquad \qquad  \text{s.t.} \; \; \sum_{x_j} \mathbb{I}_{i,j}(1,x_j)  =   \mathbb{I}(x_i=1) \\         & \qquad \qquad  \qquad \sum_{x_i}\mathbb{I}_{i,j}(x_i,1) =   \mathbb{I}(x_j=1) \\         & \qquad \qquad  \qquad \sum_{x_i,x_j}\mathbb{I}_{i,j}(x_i,x_j) = 1 \\         %& \;\psi_{\mathrm{SAT}}\left(\mathbf{s}, \mathbf{l}\right) = 1         \end{split}         \end{equation}      I get the following (note the misalignment between the `\sum` signs, and the `=` signs highlighted under the red lines):     ![enter image description here](http://i.stack.imgur.com/3CbhP.png) How can I get them to align? (and avoid using all the artificial `\qquad`, `\,` `\;` spaces)


title: Drawing tadpole diagram using feynmp

text: I have a basic question, how can I draw a tadpole using feynmp?![enter image description here](http://i.stack.imgur.com/cLfSz.png)


title: Align \itemize and \tabular horizontally

text: I have an `\itemize` list and a `\tabular` table, how do I get them to align horizontally on the the same line? This is what I have so far:               \documentclass[8pt, a4paper,twoside]{article}     \usepackage{amssymb, amsmath, comment, array}     \usepackage[cm]{fullpage}          \begin{document}          \begin {itemize}         \item \begin{math} P[S] = 1\end{math}         \item \begin{math} \{ \forall A \in S  : P[A] \ge 0 \} \end{math}         \item \begin{math} P[\varnothing] = 0 \end{math}         \item \begin{math} P[A'] = 1 - P[A] \end{math}     \end {itemize}          \begin{tabular} {| p{3cm} | p{6cm} | }       \hline         General Addition Rule & \begin{math} P[A_1\cup A_2] = P[A_1] + P[A_2] - P[A_1 \cap A_2] \end{math} \\ \hline         Conditional Probability & \begin{math} P[A_2|A_1] = \frac {P[A_1 \cap A_2]} {P[A_1]} \end{math} \\ \hline         Independent Events &\begin{math} P[ \displaystyle \bigcap_{A \in S} A] = \prod_{A \in S} P[A] \end{math} \\ \hline         Multiplication Rule & \begin{math} P[A_1 \cap A_2] = P[A_2|A_1]P[A_1] \end{math} \\ \hline         Bayes' Theorem & \begin{math} P[A_j|B] = \frac {P[B|A_j]P[A_j]} {\displaystyle \sum_{i=1}^n P[B|A_i]P[A_i]} \end{math} \\ \hline      \end{tabular}     \end{document}      ![enter image description here](http://i.stack.imgur.com/gv7nU.png)


title: mdframed does not split correctly between pages

text: I use mdframed to make boxes and split them across pages. However, sometimes mdframed splits! very strangly across the pages. In this example he prefers splitting, while there is enough space to put it all. ![enter image description here](http://i.stack.imgur.com/Ouf1H.jpg) I would like to know where the conflict is. I am not interested to twiking this example, because I have hundreds of boxes. I need to understand where the problem is and fix it in the whole book at once.               \documentclass[a4paper,10pt,twocolumn]{book}     \usepackage[english]{babel}     \newcommand{\mytext}{uutien gaaaetlmsl t n.tu aii s liwmuarpulfoaf ealiesnPui sutuacttcuMitai   ibioErertix}     \usepackage[framemethod=tikz]{mdframed}     \tikzstyle{titregris} =[draw=gray, thick, fill=white,       text=black, rectangle,minimum height=0.7cm]     \mdfdefinestyle{Argumentstyle}{}     \begin{document}     ${}$ \vspace{18cm}     \begin{mdframed}[style=Argumentstyle,     firstextra={\node[titregris,xshift=5mm] at (P-|O) {puttetuiroe};},]     \begin {enumerate}     \item \mytext \mytext     \item \mytext \mytext     \item \mytext \mytext     \item \mytext \mytext     \item \mytext \mytext     \end {enumerate}     \end{mdframed}     \end{document}       UPDATE: I saw that the wrong breakings take place when there is empty space before. mdframed seems to calculate the empty space needed, correctly splits the box such that the first part has the right length, but then it starts WRONGLY, ALWAYS, from the beggining of the next page! ![Here is a screen shot!](http://i.stack.imgur.com/xNhqM.jpg) UPDATE 2: I think now that the problem is given by the node that define the title of the box. Namely, it gives extra height which does not fit into calculations... I changed the present form of the title with the usual one (frametitlerule=true, frametitle={MyTitle}), and the problem dissapear in all the document :) However, I do like the node of the previuos form... UPDATE 3: It seems to be indeed from the title box, which goes up few millimeters and mdframed does not take into account for the calculation of avaliable space. The only work around I found untill now was to move he title box INSIDE the main box... I checked, with this the whole document is OK.


title: How to create equi-distant nodes on a spiral with TikZ?

text: I have borrowed the following code to draw a spiral using one of the existing posts in TEX.SE.               \begin{tikzpicture}     \draw [domain=0:25.1327,variable=\t,smooth,samples=55]         plot[mark=*,mark options={fill=white}] ({\t r}: {0.002*\t*\t});     \end{tikzpicture}      ![enter image description here](http://i.stack.imgur.com/c38Ru.png) As seen, nodes in the resulting spiral get closer and closer as they approach the center. What I'd like to have is to specify a set of nodes on the spiral that are equally distant from their adjacent ones. That is, they do not get closer to each other towards the center as in the figure above. The resulting spiral can be assumed as an approximation of the existing one which of course would no longer be looking smooth.


title: How to make \left, \right pairs of delimiter work over multiple lines?

text: I have a very long equation that must be separated into two lines, and it has several pairs of nesting `\left` `\right` delimiters. Unfortunately, it seems that they need to be on the same line in order for them to work. Also I'm using the `align` environment because I need the aligning functionality. Is there a way to have the size of delimiters automatically adjusted over multiple lines?


title: How can I implement an '&' inside a \left( \right) environment?

text: I've been running into a strange issue. I'm doing some derivations in `LaTeX` document, and am using the align environment to do so. Some derivations require multi-line brackets, for which I try to use               \left( \right. \\     \left. \right)      However, when I want to align my equations with something inside these brackets, I run into errors. Example:               \begin{align}     blablabla x=y \left(5 + 3 & + \right. \\     & \left. + 1 + 9 + 7 \right)     \end{align}      This runs into trouble, while               \begin{align}     blablabla & \left(5 + 3 + \right. \\     & \left. + 1 + 9 + 7 \right)     \end{align}      works just fine. Hence, I strongly suspect that the problem is caused by the first ampersand being inside the `\left( ... \right)` environment. Is there any way to get this to work? Any help would be much appreciated. EDIT: For clarity: I'm looking for a way around the ampersand problem: I would like to have the ampersand inside my `\left( ... \right)` environment. Is there any way to do this?


title: split doesn't want to split \left and \right

text: In short, I have : `\begin{equation} \begin{split} a = & \left | \dfrac{b}{c} \\ & + \dfrac{d}{e} \right | \end{split} \end{equation}` and it complains that I want to split `\left` and `\right`, if I remove those everything is ok. Please suggest what to do in this case?


title: problem with \left| and align

text: > **Possible Duplicate:**   >  How to make \left, \right pairs of delimiter work over multiple lines? Hi I'm trying to write a long equation with `{align*}`:               \begin{align*}     &\left|<L(w^2u),Lu>_k-<L(wu),L(wu)>_k \right|= \\     &|<L(w^2u),Lu>_k-<wL(wu),Lu>_k+<wL(wu),Lu>_k\\     &-<L(wu),wLu>_k+<L(wu),wLu>_k-<L(wu),L(wu)>_k|\\     &\leq \left|<(Lw-wL)(wu),Lu>_k\right|+\left|<wL(wu),Lu>_k-<L(wu),L(wu)>_k\right|\\     &+\left|<L(wu),(wL-Lw)u>_k\right|     \end{align*}      and I find that when I try to add `\left|` and `\right` to the second and third line the code doesn't compile. Can someone tell me what is wrong with this and how to fix it:               \begin{align*}     &\left|<L(w^2u),Lu>_k-<L(wu),L(wu)>_k \right|= \\     &\left|<L(w^2u),Lu>_k-<wL(wu),Lu>_k+<wL(wu),Lu>_k\\     &-<L(wu),wLu>_k+<L(wu),wLu>_k-<L(wu),L(wu)>_k\right|\\     &\leq \left|<(Lw-wL)(wu),Lu>_k\right|+\left|<wL(wu),Lu>_k-<L(wu),L(wu)>_k\right|\\     &+\left|<L(wu),(wL-Lw)u>_k\right|     \end{align*}


title: Splitting a long equation while maintaining size of brackets

text: > **Possible Duplicate:**   >  How to make \left, \right pairs of delimiter work over multiple lines? How can I have this equation:               \begin{eqnarray}\nonumber     \ln T &=& -\sum\limits_{i=1}^{N} \left\{\ln(N2\pi\sigma_x(i)\sigma_y(i))\, \right.\\          && \left. -\,\ln\left(\sum\limits_{j=1}^{M}\exp\left[-\frac{1}{2}\left(\frac{x_j^2}{\sigma_x(i)}+\frac{y_j^2}{\sigma_y(i)}\right)\right] \right) \right\}     \end{eqnarray}      show the same size for the opening and closing brackets? Right now it looks like this: ![equation](http://i.stack.imgur.com/1DpiD.png) # Edit This works:               \begin{equation}       \begin{aligned}       \ln T &= -\sum\limits_{i=1}^{N} \Bigg\{\ln(N2\pi\sigma_x(i)\sigma_y(i))\, \\     & -\,\ln\left(\sum\limits_{j=1}^{M}\exp\left[-\frac{1}{2}\left(\frac{x_j^2}{\sigma_x(i)}+\frac{y_j^2}{\sigma_y(i)}\right)      \right] \right) \Bigg\}        \end{aligned}      \end{equation}


title: split problem between \left( and \right)

text: I have this equation, and strangely enough I can not split the equation from somewhere in between `\left(` and `\right)` If I use the `\\` to split the equation after `\right)` then it works, I did not really get why? Or the problem is changed to a simpler one...               \begin{split}     \left(     a \\     b     \right)      which is is the problem.


title: Linebreak between \left and \right

text: > **Possible Duplicate:**   >  How to make \left, \right pairs of delimiter work over multiple lines? I would like to type something like this:               \begin{equation}            \begin{split}              \left( ba ba ba \\              ba ba ba \right)            \end{split}          \end{equation}      But it contains error; I think it's because `\left(` and `\right)` should be in the same line. How can I type something like this, but in different lines? I think one of the solution is replaced `\left(` and `\right)` by `\Big(` and `\Big)`. But I am not satisfied with it since `\Big(` is not "big" enough compared to `\left(`.


title: How to get (No)LineFinal to work for Hoefler Text Italic with TeX Live 2013?

text: I’ve just installed MacTeX 2013, which includes TeX Live 2013. This somehow breaks the `Contextuals=(No)LineFinal` feature from `fontspec` with Hoefler Text Italic. It works as I expect with MacTeX 2012 (which I fortunately still have installed). The following file is typeset with a swash on the final n with MacTeX 2013, but not with MacTeX 2012.               \documentclass{article}     \usepackage{fontspec}          \setmainfont [UprightFeatures={Contextuals=NoLineFinal}]{Hoefler Text Italic}     % One could use [ItalicFeatures={Contextuals=NoLineFinal}]{Hoefler Text}     % and add a \itshape or \textit to the document          \begin{document}          There should be no swash to this last n          \end{document}      Compiling `aat-info.tex` reports the same features with both version of MacTeX, and in both case, it reports Line Final Swashes as _on_. Is it a new bug or was I unknowingly relying on an old, now fixed, one? In any case, how could I get the swashes to disappear again? * * * I’m still looking into the issue, and this is likely related. With Apple Chancery, I can’t find a way to turn _on_ Line Initial Swashes or Line Final swashes in MacTeX 2013. In MacTeX 2012, `LineInitial` triggers _very_ often, including in the middle of a line. It seems to me it does the same thing as `WordInitial`. In both MacTeX 2012 and 2013, `WordInitial` and `WordFinal` appear to work fine when turned on. Once again, `aat-info.tex` reports the same features and defaults when run with MacTeX 2012 or 2013. However, MacTeX 2013 reports them in french (my system default) while MacTeX 2012 does it in english.               \documentclass{article}     \usepackage{fontspec}          \setmainfont {Apple Chancery}     % Explicitly turn on Word initial/final swashes     % \setmainfont [Contextuals={WordInitial, WordFinal}]{Apple Chancery}     % Explicitly turn on Line initial/final swashes - actually the default     % \setmainfont [Contextuals={LineInitial, LineFinal}]{Apple Chancery}     % Explicitly turn off Line initial/final swashes     % \setmainfont [Contextuals={NoLineInitial, NoLineFinal}]{Apple Chancery}          \begin{document}          % Examples courtesy of Apple     Rolling hills, Rolling\\     pines, Rolling thunder          Pears, pinapples, cherries\\     and so many grapes          I saw one in a box once          \end{document}      * * * Next step, try pure XeTeX. Unfortunately, I don’t know much about it.