title: Aligning .tikz pgfplots with semi custom styles

text: Previously I was helped with how to align and position graphs in a table with optional subplots in this question: Overlay two .tikz files from input It worked great, but I was not happy using scaling options to shrink the graphs. I much prefer just specifying the width and height, and letting latex take care of the font sizing. It made for a much more consistent article. So when creating a graph I give it a style that allows a batch width and height setting in the preamble, and then edit the individual entries pertinent to that graph underneath. Unfortunately using this system has thrown out alignment again. It seems alignment only remains when I either use a custom style that defines ALL the entries in the preamble, or when I don't use a custom style at all and set the width and height in the .tikz picture to be the same. Full MWE to show my problem:               \documentclass{article}     \usepackage{graphicx,array,booktabs,pgfplots}     \pgfplotsset{compat=1.9}     \usetikzlibrary{calc}          \pgfplotsset{inTable/.style={     width=4.0cm,     height=4.0cm,     }}          \newsavebox{\mybox}     \sbox{\mybox}{     \begin{tikzpicture}     \begin{axis}[inTable,     scale only axis,     xmin=1,     xmax=500,     xlabel={A},     ymin=0.5,     ymax=1,     ylabel={A}]          \addplot [color=blue,solid,line width=1.0pt,forget plot]       table[row sep=crcr]{     10  0.7  \\     11  0.7  \\     12  0.7  \\     };     \end{axis}     \end{tikzpicture}}          \newsavebox{\myboxB}     \sbox{\myboxB}{     \begin{tikzpicture}     \begin{axis}[inTable,     scale only axis,     xmin=1,     xmax=200,     xlabel={B},     ymin=0,     ymax=3,     ylabel={B}]          \addplot [color=blue,solid,line width=1.0pt,forget plot]       table[row sep=crcr]{     10  0.5  \\     11  0.6  \\     12  0.7  \\     };     \end{axis}     \end{tikzpicture}}          \begin{document}          \newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}     \begin{table}[htb!]      \centering          \begin{tabular}{P{6.5cm} P{6.5cm}}          \toprule           Expt1 & Expt2\\           \cmidrule(r){1-1}\cmidrule(l){2-2}           \begin{tikzpicture}[baseline=(a.base)]           \node[outer sep=0pt]  (a){\usebox{\mybox}};            %%% Change dimensions in $(a.east)+(-0.9,0cm)$     %      \node[anchor=east,outer sep=0pt] at     %               ($(a.east)+(-0.9,0cm)$){\usebox{\mybox}};           \end{tikzpicture}           {\usebox{\mybox}}           &           {\usebox{\mybox}}           {\usebox{\myboxB}}           \\ \bottomrule           \end{tabular}           \caption{Test}           \label{tbl:1}     \end{table}          \end{document}      ![Misalignment](http://i.stack.imgur.com/BOX8R.png) Help is greatly appreciated. This should be the final piece to my table-graph- inset plotting protocol.


title: Empty bibliography and undefined references

text: My minimal working example. But it does not work. Bibliography               %\RequirePackage[ngerman=ngerman-x-2012-05-30]{hyphsubst}     \documentclass[ngerman, fontsize=12pt]{scrartcl}          %\usepackage{xunicode}     %\usepackage[utf8]{inputenc}     \usepackage[T1]{fontenc}          %\usepackage{hyphsubst}     %\HyphSubstIfExists{ngerman-x-2012-05-30}{%         %\HyphSubstLet{ngerman}{ngerman-x-2012-05-30}}{}          \usepackage[]{babel}     %\usepackage{hyperref}     \usepackage[autostyle=true, german=quotes]{csquotes}     \usepackage[backend=biber]{biblatex}     %\usepackage{blindtext}     %\usepackage{libertineotf}     %\usepackage{fnpct}     %\usepackage{ccicons}     %\usepackage{embrac}          %\usepackage[modulo]{lineno}     %\linenumbers          \addbibresource{Facharbeit.bib}          \begin{document}          \cite{mierau}          \printbibliography          \end{document}


title: Invisible listing captions

text: Short version: how can I make a listing's caption show up in the List of Listings but not in the body of the document where the listing is? I'm writing a university report, and many of my subsections contain only a single listing. Because of this the logical names of the subsection and the listing are the same. I'm currently using the `listings` package. I would like there to be sensible descriptive names in both the Tables of Contents (for the subsection) and the List of Listings (for the listing), but I don't want both names in the body of the document, as the duplication looks silly. Preferably in the main document the subsection would be titled but not the listing, although vice versa is still helpful.


title: How to reduce the spacing between punctuation and the superscript citation

text: I'm using biblatex with the `autocite=superscript` option, so I can use `\autocite` to switch the interpunction and a superscript citation when the `\autocite` command is placed before an period or comma. I'd like to move the citation closer to or above the interpunction. What I want to achieve is shown at the second half of the page: http://www.khirevich.com/latex/footnote_citation/ The solution given on the page consist of a new command that takes both the citation as well as the interpunction as an argument:               \newcommand{\sjcitep}[2][]{%       new command with two arguments: optional (#1) and mandatory (#2)         \settowidth{\spc}{#1}%         set value of \spc variable to the width of #1 argument         \addtolength{\spc}{-1.8\spc}%  subtract from \spc about two (1.8) of its values making its magnitude negative         #1%                            print the optional argument         \hspace*{\spc}%                print an additional negative spacing stored in \spc after #1         \supershortnotecite{#2}}%      print (cite) the mandatory argument      Is it possible to change the `\autocite` command such that it inserts a `\hspace` like in the code above between the interpunction and the superscript whenever it puts the superscript behind an interpunction character?


title: Dealing with solutions within parts of exercises

text: I am trying to create a database of maths questions and answers in TeX form. The idea is that a simple command such as `\getfromDB{101}` will pull the text from the database of the question numbered 101. The solutions should be included in the text source with the question. Hence a typical entry in the database is:               What is the answer? \solution{This is it!}      A user can simply put the `\getfromDB{101}` text in their document as they like: say, within a `list`/`enumerate`/`theorem`, numbered whichever way they want. Now if all questions were like this, then I think that there are all sorts of options and packages available that can redefine the `\solution` macro the way any user would like. But some questions come in parts:               This question has two parts:     \begin{parts}     \item Part one \solution{Part 1 answer}     \item Part two \solution{Part 2 answer}     \end{parts}      Again the idea is that the user can define the `parts` environment the way they like, but so far I haven't found a suitable package that can help with a suitable redefinition of the `\solution` macro. I have looked at the following packages and so far I haven't been smart enough to solve my problem: `answers` and `exsheets`. Can anyone point me in an appropriate direction?


title: Dual compatibility of TeX sources

text: Consider the following situation. You enjoy TeXing on your local machine, having fun with the latest versions of various packages. For example, exploiting the benefits of `TikZ/externalize`... or `biblatex`. Alas... Your university's TeX installation is old, or your collaborator cannot use your cutting edge packages. Then, a checked out copy on the other system **won't compile!** One solution, which I have just used, is to remove all the fancy stuff from the source and make it compatible with the old-style system. This, however, has huge disadvantages; for example now compiling your source (on you local box) takes longer because you cannot take advantage of your latest installed version of `TikZ`. Let me focus on the `TikZ` issue. Is there a way to automize a solution? That is, run a test at the beginning of the compilation, and _enable_ or _disable_ the usage of the `externalize` package depending on the system the document is currently compiled on? Does this kind of approach make sense at all? ## Edit: I'm taking the risk of becoming too localized, but I do want to find a solution and to accept an answer here. I tired to use @JosephWright idea as follows:               \makeatletter     \IfFileExists{tikzexternal.sty}     {%       \usetikzlibrary{external}%       \tikzexternalize%       \tikzsetexternalprefix{figures/cache/}%       \renewcommand{\todo}[2][]{%         \tikzexternaldisable\@todo[#1]{#2}\tikzexternalenable}%     }%     {%     }%     \makeatother      When compiling this I get the following error: `Illegal parameter number in definition of \reserved@a.` which I don't know how to fix... Any ideas?


title: Section spacing suddenly dynamic

text: I'm using LaTex in combination with MikTex and just recently introduced the fancyhdr package to my thesis. For some reason, when using the \subsection or \subsubsection commands I sometimes get the following rendering issue. First is a page with an image on it, which occupies about one third of the page: ![This is the first page](http://i.stack.imgur.com/jWEK9.png) Right after the first page, which for some reason has now messed up section title spacings, the second page is fine again: ![This is the page right after the first](http://i.stack.imgur.com/NOAbw.png) For whatever reason, it decides to break before the start of the next \subsubsection. Why it does that instead of filling the space that's left on the first page is what's baffling me right now. Does anyone have an idea what could be off here or where I should begin looking for issues? [Edit] Removing the \subsubsection commands puts the text in it's right place, correctly filling the pages. So I assume it must have something to do with the page/line breaks before and after section commands.


title: PDFLaTeX produces black boxes after executing Sweave

text: There is the following code               \documentclass[a4paper]{article}          \begin{document}              hey there              <<>>=         1+1         @     \end{document}      I saved the `example.Rnw` in my home directory an then I executed the `.Rnw` with Sweave("/home/myname/example.Rnw") in R using the terminal. The output is:               Writing to file example.tex     Processing code chunks with options ...          You can now run (pdf)latex on ‘example.tex’      When I open the generated tex-file with the Texmaker, it looks like this:               \documentclass[a4paper]{article}          \usepackage{Sweave}     \begin{document}              hey there              <<>>=         1+1         @     \end{document}      I think, at this point the tex-file has to be look different! When I run PDFLaTeX on the file. The results are little black boxes. << and >> are the black boxes following by the statement `= 1+1 @` What could be wrong?


title: verbatim useable with a newenvironment definition?

text: I'm trying to create a simple newenvironment allowing me to display source code in a verbatim text block with a caption, numbering etc. The solution I'm after is with the in-built LaTeX verbatim environment. I would have used the fancyvrb package, that seems to allow that kind of thing, but I can't update my MiKTeX installation due to proxy authentication issues. Instead I'm after a way to do it _with just the built in verbatim environment_. When I get home, I can adapt it to use fancyvrb (so I am still interested in answers relating to that), but for now, I'm after a temporary solution to get me through the day. ;^) Here's what I imagine the newenvironment command would be like:               \usepackage{float}     \floatstyle{boxed}     \newfloat{program}{h}{lop}     \floatname{program}{Example}          \newenvironment{example}[2]{%         \begin{program}%         \label{#1}%         \caption{#2}%         \scriptsize         \begin{verbatim}%     }{%         \end{verbatim}%         \end{program}%     }      It fails later-on, complaining about overfull \hboxes, which I assume means that it's still trying to typeset the rest of my document as though it were in verbatim mode. Can I use verbatim env in this way? Got a workaround (given that my MiKTeX package repo is pretty small)?


title: Selective page break

text: Is there a way to select a float for three rows so that the page break will push the set of three rows to the next page instead of breaking between the rows? In the following example the second line of the subset 13 is pushing to the next page, but I would like the whole subset 13 (title and the following two rows) to push to the second page. I thought about float and could not make it work. Also if there is another way to do it I will be more than happy to hear it. Thanks a lot in advance for all your help and support.               \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}}\\     \multicolumn{3}{l}{\textbf {SubSet 1}}&\multicolumn{3}{l}{\textbf {SubSet 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\\     \\     \multicolumn{3}{l}{\textbf {SubSet 2}}&\multicolumn{3}{l}{\textbf {SubSet 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\\     \\     \multicolumn{3}{l}{\textbf {SubSet 3}}&\multicolumn{3}{l}{\textbf {SubSet 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\\     \\     \multicolumn{3}{l}{\textbf {SubSet 4}}&\multicolumn{3}{l}{\textbf {SubSet 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\\     \\     \multicolumn{3}{l}{\textbf {SubSet 5}}&\multicolumn{3}{l}{\textbf {SubSet 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\\     \\     \multicolumn{3}{l}{\textbf {SubSet 6}}&\multicolumn{3}{l}{\textbf {SubSet 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\\     \\     \multicolumn{3}{l}{\textbf {SubSet 7}}&\multicolumn{3}{l}{\textbf {SubSet 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\\     \\     \multicolumn{3}{l}{\textbf {SubSet 8}}&\multicolumn{3}{l}{\textbf {SubSet 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\\     \\     \multicolumn{3}{l}{\textbf {SubSet 9}}&\multicolumn{3}{l}{\textbf {SubSet 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\\     \\     \multicolumn{3}{l}{\textbf {SubSet 10}}&\multicolumn{3}{l}{\textbf {SubSet 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\\     \\     \multicolumn{3}{l}{\textbf {SubSet 11}}&\multicolumn{3}{l}{\textbf {SubSet 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\\     \\     \multicolumn{3}{l}{\textbf {SubSet 12}}&\multicolumn{3}{l}{\textbf {SubSet 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\\     \\     \multicolumn{3}{l}{\textbf {SubSet 13}}&\multicolumn{3}{l}{\textbf {SubSet 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\\     \\     \multicolumn{3}{l}{\textbf {SubSet 14}}&\multicolumn{3}{l}{\textbf {SubSet 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\\     \\     \multicolumn{3}{l}{\textbf {SubSet 15}}&\multicolumn{3}{l}{\textbf {SubSet 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\\     \toprule[1pt]\\     \end{supertabular}     \end{document}


title: Transparent shapes in Matlab to TeX when using Matlab Fill

text: I want to export figures with transparent shapes in Matlab to TeX. For the following code, the triangle will appear transparent in Matlab but will be solid blue when I generate the tex file using `\input{triangle.pgf}` Matlab Code:               x = [ 1         -0.5         -0.5            1];     y = [0      0.86603     -0.86603 -2.4493e-016];          f = figure;     t = fill(x,y,'b');      alpha(t,0.05);          matfig2pgf('fignr',1,'filename','triangle.pgf','figwidth',14);


title: What is the difference between bibtex and biblatex?

text: I've been reading about biblatex more and more on here. What is the difference between it and bibtex? Why should I switch to biblatex? Seeing the documentation doesn't seem too mature (or accessible - I couldn't find any introduction without downloading the whole package), I thought I would ask here. I am currently using LaTeX and I compile my documents with pdflatex, if that makes any difference.


title: How to display polynomial-time "reduction" symbol?

text: I'm looking for a package where is defined the symbol for polynomial-time reduction that looks like the infinity symbol. Thanks!


title: Omitting visibility marker in MetaUML

text: Is there a way to omit the visibility (lock symbol) marker in MetaUML `Class` objects? If I just refrain to use one I get a protected marker as a default. A short example ( _note_ : the LaTeX builder has to be run with `-shell- escape` option):               \documentclass{article}     \usepackage[shellescape]{gmp}     \begin{document}     \begin{mpost}[mpsettings={input metauml;},use]          Class.A("ClassA")     ("-private","+public","default protected", "#protectedWithNumberSign")     ();     drawObjects(A);          \end{mpost}     \end{document}      Just to have stated it: in section 2 _Class Diagrams_ on page 6, the handbook says that `#` produces a protected marker (therefore I was tempted to think that omitting the marker symbol it would result in no marker), but in fact this produces such a marker plus a # sign.


title: Is there a transparent way to automatically abbreviate journal names?

text: I have a BibTeX file containing many references, where the journal titles are (for the most part) written out in full. I would like to replace these in my reference list with the standard abbreviated titles. Searching the web I can find many suggested solutions to this problem. These all seem to involve maintaining either maintaining your own database of search-and-replace strings, using a GUI reference manager (Jabref), or editing the whole `.bib` file so that every journal name is a macro call. My `.bib` file has 171 entries (it was originally the references for my thesis and I've kept adding to it since then, using the same file for every paper), so creating and maintaining my own database of journal abbreviations would be a huge undertaking. While I will just start using Jabref if I have to, it doesn't seem right that I should have to use a GUI package to solve such an inherently text-based problem. What I really want is a script (or even better, a LaTeX package) that will just go through my `.bib` file and replace every full journal name with an abbreviation looked up in one of the many standard databases that exist for this purpose. (Of course there will probably be some that get missed, but I don't mind fixing one or two by hand.) I'm guessing that such a painless, transparent solution doesn't exist, but it can't hurt to ask here. It seems to me that this must be a very common thing to want to do, and I'm kind of surprised that the functionality isn't just built into BibTeX in the first place.


title: Problem with odd/even margins when environment crosses page boundaries

text: In this question, I described a problem I have with `marginpars` appearing on the wrong side of the page when they occur near a page break. I ran into a different, but perhaps related problem described below. I have a non-LaTeX related solution (also described below) that I include as a workaround in case others may find it useful, but I would like very much to have a pure LaTeX solution. I want to print my course notes as a book, with double-sided paper. [I am using the `memoir` class.] I also want to have text or figures in the "outer" (i.e. wide) margin - and that margin should change side depending if the page is odd or even. I also want to be able to change from single column (with a wide margin) to double column (with narrow margins) to include either worked out examples and/or problems at the end of each chapter. The problem I encountered is that the margin adjustment done (correctly) at the beginning of the double-column environment is totally wrong on the subsequent page if the environment crosses a page boundary. Here is a MWE - actually, three MWE in one. Depending on which options get commented out, one can have the normal two-sided memoir output, or a one-sided output with the wide margin either on the left-hand side or the right hand side. Note that there are two places where commented out options occur: right at the beginning and also in the page layout "section" of the preamble.               %%%%% two-sided option with wide margin alternating sides     %   \documentclass[openany,twoside]{memoir}     %       \newenvironment{widematter}{\begin{adjustwidth*}{0in}{-2in}\small}{\end{adjustwidth*}}          %%%%  one sided - wide margin (for marginpar) on the right     %   \documentclass[openany,oneside]{memoir}     %       \newenvironment{widematter}{\begin{adjustwidth}{0in}{-2in}\small}{\end{adjustwidth}}                   %%% one sided - wide margin (for marginpar) on the left     \documentclass[openany,oneside]{memoir}     \newenvironment{widematter}{\begin{adjustwidth}{-2in}{0in}\small}{\end{adjustwidth}}     \marginparmargin{left}               %%% page layout dimensions for memoir     \setstocksize{11in}{8.5in}     \settrimmedsize{\stockheight}{\stockwidth}{*}     \settypeblocksize{9.0in}{5in}{*}     \setulmargins{1.0in}{*}{*}     \setheadfoot{30pt}{26pt}     \setheaderspaces{*}{30pt}{*}     \setmarginnotes{0.2in}{1.8in}{1cm}     %%% marginpar on right OR twosided     % \setlrmargins{0.75in}{*}{*}     %%% marginpar on left     \setlrmargins{2.75in}{*}{*}     \checkandfixthelayout     %          \usepackage{multicol}     \usepackage{lipsum}          \newcommand{\sampletext}{This is a short sample text         longer than one line but shorter than a typical paragraph         from the lipsum package.}     \newenvironment{TwoCol}{\begin{widematter}\begin{multicols}{2}}{\end{multicols}\end{widematter}}          \begin{document}     \frontmatter         \tableofcontents     \mainmatter     \chapter{First Chapter}     \section{First section}     \lipsum[1]\marginpar{\sampletext}     \lipsum[2]     \begin{TwoCol}         \lipsum[5]     \end{TwoCol}     \section{Second section}     \lipsum[3-4]\marginpar{\sampletext}          \chapter{Second Chapter}     \section{First section}     \lipsum[1]\marginpar{\sampletext}     \lipsum[2-6]\marginpar{\sampletext}     \lipsum[7]     \begin{TwoCol}         \lipsum[1-10]     \end{TwoCol}     \lipsum[4-8]\marginpar{\sampletext}          \end{document}      The non-LaTex solution I have found is to have two one-sided "base documents" (for lack of a better term), one that has the preamble for the wide margin on the left, the other for the wide margin on the right, and keeping most of the content in separate files that get inputted. I then process both the "left" document and the "right" document, and combine them with this Python script:               from pyPdf import PdfFileWriter, PdfFileReader          output = PdfFileWriter()     left = PdfFileReader(file("left-test.pdf", "rb"))     right = PdfFileReader(file("right-test.pdf", "rb"))          total_nb_pages = left.getNumPages()     assert left.getNumPages() == right.getNumPages()          for page in range(0, total_nb_pages, 2):         output.addPage(left.getPage(page))         if page + 1 < total_nb_pages:             output.addPage(right.getPage(page + 1))          outputStream = open("combined-test.pdf", "wb")     output.write(outputStream)     outputStream.close()      So far, based on limited tests, it does work ... but a pure LaTeX solution would be much appreciated.


title: How to use table in mdframed?

text: I am working on report format using `mdframed` and I need to add table inside `mdframed`.               \documentclass[11pt]{article}     \usepackage[table]{xcolor}     \usepackage{array,ragged2e}     \usepackage[pdftex]{graphicx}     \usepackage[framemethod=TikZ]{mdframed}     \usepackage{lipsum}     \usepackage[margin=1cm]{geometry}     \usepackage[table]{xcolor}     \definecolor{lightgray}{gray}{0.9}     \begin{document}     \begin{mdframed}[roundcorner=10pt,leftmargin=1, rightmargin=1, linecolor=orange,outerlinewidth=1, innerleftmargin=15, innertopmargin=15,innerbottommargin=15]     \textbf{Detailed Genotype Table}     \leavevmode     \newline     \begin{table}[ht]     \newcolumntype{P}[1]{>{\RaggedRight\hspace{0pt}}p{#1}}     \begin{center}     \rowcolors{1}{}{lightgray}     \begin{tabular}{|{\rule{0pt}{2cm}}c |P{2cm} | P{2cm} | P{2cm}|P{2cm} | P{2cm} | P{2cm}|P{2cm} | P{2cm} | P{2cm}|}      \rowcolor{orange} Gene &SNP &Odds Ratio &Genotype &Genotype &Genotypic Effect &Citations &Frequency\\                                     \hline       1 & 2.36 & 1.08 & -0.49 & -0.82 & -0.65 \\       2 & -0.68 & -1.13 & -0.42 & -0.72 & 1.51 \\       3 & -1.00 & 0.02 & -0.54 & 0.31 & 1.28 \\       4 & -0.99 & -0.54 & 0.97 & -1.12 & 0.59 \\       5 & -2.35 & -0.29 & -0.53 & 0.30 & -0.30 \\       6 & -0.10 & 0.06 & -0.85 & 0.10 & -0.60 \\       \hline     \end{tabular}     \end{center}     \end{table}     \leavevmode     \newline     \end{mdframed}     \leavevmode     \newline     \end{document}      But in the above code i am not able to get table inside mdframed. May i know where i am wrong. Any example will help me a lot. Thanks


title: redefine starred command \section*

text: with `\usepackage[explicit]{titlesec}` I have defined `\section` like               \titleformat{\section}       {\ttfamily\Large\bfseries\color{red}}       {\thesection}       {1em}       {#1}      i want to redefine the starred version of section `\section*` To become like `\section` (with number) Except that the text after Comes in front of section heading (run in)


title: Newbie TikZ question : A line starting inside a node

text: I'm trying to draw a line from (p) to (x0), but I want that the line starts inside the node (p) and not at the border. I tried using "xshift" but it doesn't work.               \begin{tikzpicture}[auto,>=latex', thick, overlay]         \path[->]<1-> node[cell, label=left:\texttt{x}] at (-1,0) (x0) {};         \path[->]<1-> node[cell, label=left:\texttt{p}] at (-3,2) (p) {};         \path[->,red,xshift=-5mm]<1-> (p) edge [bend left] (x0);     \end{tikzpicture}      Thank you in advance.


title: Title page using TikZ

text: Based on the question on Use TikZ to draw frontpage, I have taken the liberty to create my own custom LaTeX title template for my school's reports. So far I created this.               \documentclass[paper=a4,     11pt,     DIV=14,     parskip=half]{scrartcl}          \usepackage[utf8]{inputenc}     \usepackage{tikz}     \usepackage{lipsum}     \usepackage{color}          %MEDTADATA ,     \def\myauthor{Author} % Author     \def\mycoauthor{} % co-author     \def\mytitle{Title} % titel van het document     \def\mydate{27 Januari 2010} % datum indien gewenst     \def\typedoc{Lab report} %type of document: lab report, article     \def\mycourse{Course Name} % gives the name of the coure          \begin{document}               \begin{titlepage}.     %Use the tikzpicture for the document banner          \begin{tikzpicture}[remember picture,overlay]          \coordinate [below=2.5cm] (midpoint) at (current page.north);          \node [name=colourbar,     anchor=base,     fill=blue!40,     text = white,     minimum width=\paperwidth,     minimum height=1cm] at (midpoint){\Large{\textsf{Departement Industriële Wetenschappen}}};          % Define the point where the logo will go     \coordinate [right=4cm] (logo) at (colourbar.west);          % Set coordinate system origin     \begin{scope}[shift=(logo)]     % Draw the outline     \filldraw [white,draw=blue!40] (2.3,0.85) -- (-2,0.85) -- (-2.8,-0.85) -- (2.3,-0.85) --cycle;     % Include the logo     \node {\includegraphics[width=4cm]{Logo_Lessius_Mechelen_colour.jpg}};     \end{scope}          \end{tikzpicture}          \vspace{3cm}     \begin{center}     \Huge     \textsf{\mytitle}     \end{center}     \begin{flushright}     \vspace{2cm}          %\LARGE     \Large     \textsf{\typedoc\\     \emph{\textcolor{gray}{door}} \\     \myauthor\\     \mycoauthor}          \vspace{1cm}     \textsf{\mycourse}          \vspace{1cm}     \textsf{\mydate}\\ %%Date - better you write it yourself.          \vspace{1cm}     \textsf{Docent:\\ % meervoud maken door middel van      Prof. Dr..... \\     }          \vspace{1cm}     \textsf{Lessius Mechelen}          \textsf{Schakelprogramma Industrële Wetenschappen}     \end{flushright}          %Fill up the rest off the document     \vfill     %Add horizontal line     \hrule      \end{titlepage}     \end{document}      I am very pleased with the result. There is however one small thing that bothers me. ![Example](http://i.stack.imgur.com/sh5n9.jpg) In the TikZ picture, I would like to add a bit more space (1 cm) between the logo and the text (Departement Industriële Wetenschappen) written next to it. Does anybody have a solution?


title: why does using nodes with to in TikZ result in grossly missized labels?

text: As much as I love TikZ, its trouble producing consistent output on different computers is getting to me. At the moment, I'm having trouble because when I use the to command, and nodes inside the draw command, the fonts sizes are all wrong, and the nodes often misplaces labels. This seems to be a quirk of my current computer, and some code I wrote on another computer now doesn't compile right (incidentally, I just checked; this compiles fine on my old laptop). For example, the code               \[     \epsilon=\tikz[baseline,very thick,scale=2.5]{      \draw[<-] (.2,.1) to[out=-120,in=-60] (-.2,.1)       node[at end,above left,scale=.8]{$i$}     node[at start,above right,scale=.8]{$i$};     \node[scale=.8] at (0,.3){$\lambda$};      \node[scale=.8] at (0,-.2){$\lambda+\alpha_i$};}\qquad \qquad     \epsilon'=\tikz[baseline,very thick,scale=2.5]{     \draw[->] (.2,.1)to[out=-120,in=-60] (-.2,.1)      node[at end,above left,scale=.8]{$i$}      node[at start,above right,scale=.8]{$i$};     \node[scale=.8] at(0,.3){$\lambda$};      \node[scale=.8] at (0,-.2){$\lambda-\alpha_i$};}     \]      produces ![enter image description here](http://i.stack.imgur.com/wckOg.png) > What's with the crazy big i's? Is there something I can do to fix this? As reference, if I make the nodes free-standing and change the code to               \[     \epsilon=\tikz[baseline,very thick,scale=2.5]{\draw[<-] (.2,.1)       to[out=-120,in=-60] (-.2,.1);  \node at (.2,.2) [scale=.8]{$i$};       \node at (-.2,.2)[scale=.8]{$i$};\node[scale=.8] at       (0,.3){$\lambda$}; \node[scale=.8] at (0,-.2){$\lambda+\alpha_i$};}\qquad \qquad     \epsilon'=\tikz[baseline,very thick,scale=2.5]{\draw[->] (.2,.1)       to[out=-120,in=-60] (-.2,.1); \node at (.2,.2) [scale=.8]{$i$};       \node at (-.2,.2)[scale=.8]{$i$};\node[scale=.8] at       (0,.3){$\lambda$}; \node[scale=.8] at (0,-.2){$\lambda-\alpha_i$};}     \]      I get basically what I intended. ![enter image description here](http://i.stack.imgur.com/NTsL5.png)


title: Undefined control sequence \begin{abstract} but abstract appears

text: I'm using a customised (not by me) document class called `geogthesis` to produce my Geography PhD thesis. When I compile the file I get an error saying:               Undefined control sequence. [\begin{abstract}]      However, the PDF actually builds fine, and includes the abstract - which is strange. Still, I'd like to get rid of the error (errors when building my thesis scare me!) I'm using the LaTeX file below, combined with the geogthesis.cls file:               \RequirePackage{ifpdf}     \documentclass{geogthesis}          \begin{document}     \frontmatter     \title      {TITLE HERE}     \authors    {\texorpdfstring{\href{mailto:r.t.wilson@soton.ac.uk}{Robin Wilson}}{}}     \supervisor {\texorpdfstring {\href{mailto:blah@soton.ac.uk}{Blah}}{}}     \cosupervisor {\texorpdfstring {\href{mailto:blah@soton.ac.uk}{Blah}}{}}     \addresses  {\deptname\\\univname}     \date       {\today}     \subject    {Remote Sensing}     \keywords   {keywords}     \maketitle          \begin{abstract}     \small{Blah blah}     \end{abstract}          \mainmatter               Main text here!          \end{document}


title: Hook tex macro without altering tokens stream

text: Is is possible to hook a macro with function which writes some info to file or log without altering stream which creates dvi file. For example if i have macro definition               \def\foo{\mathop{A}}      and i hook it with               \def\foo{{\ifmmode\typeout{math}\else\typeout{text}\fi}\mathop{A}}      it gives me different output for expressions like.               $\max \foo$       Because it alters stream `mathop, mathop --> mathop, something, mathop`. I don't know luatex, but solutions with help of lua code are also appreciated.


title: LyX 2.1 Report Class Changing Part to Other Text When Using non-TeX fonts (via XeTeX/LuaTeX)

text: I am using LyX 2.1 with the document class "Report". I am writing my thesis, which consists of three essays. How do I change word "Part" for each section to "Essay"? I have not been able to find an answer to this question for LyX 2.1. I have already tried using:               \renewcommand{\partname}{Essay}      in the preamble as documented in previous StackExchange answers but they do not seem to work in the basic report class template in a fresh newfile of LyX 2.1 (I can provide an MWE if necessary). Edit 1: one solution presented in the comment below is to use something like:               \usepackage[english]{babel}     \addto\captionsenglish{       \renewcommand{\partname}{Essay}     }      in the preamble. This works for the basic LyX 2.1 document in the Report class. However, I have discovered that the solution breaks if using non-TeX fonts via XeTeX/LuaTeX. In the case of my essays, if one selects the "Use non- TeX fonts (via XeTeX/LuaTeX)" option and the Roman option set to "Baskerville Old Face" the solution breaks down. Edit 2: With only a slight modification, the code above works for any choice of fonts. Use the following:               \AtBeginDocument{\addto     \captionsenglish{ \renewcommand{\partname}{Essay}}}


title: cleveref and algorithm2e

text: I'm currently working on a document where I was using `algorithm`+`algorithmic` along with `cleveref`. With this everything worked perfectly. Now I had to replace `algorithm`+`algorithmic` with `algorithm2e`. Ever since, I cannot `\cref` to the label in the `algorithm` environment. More explicitly, I can refer but `\cref` doesn't generate a text in front of the number (which is correct) of the algorithm. I couldn't find any reference to `algorithm`'s packages in the `cleveref` documentation. Any ideas?


title: Chapter numbers in bibliography

text: I am compiling my thesis in LaTeX and I am using the `chapterbib` package to put separate bibliography lists in each chapter. I would like each bibliography to have its own name, indexed by the chapter number (e.g. "References for Chapter #"), but I am not aware of any way to do this, or if it is doable at all. Has anybody tried it before?


title: disable lyx cache for compiling

text: When compiling the document for the first time after opening LyX, it requires some time. For another run, it is finished almost immediately. LyX seems to use a cache, if it thinks that there are no changes. I need to disable that cache, because I manually run makeglossaries in the working directory of LyX and LyX does not recognize that. Any idea?


title: CV/resume entry

text: I would like to create a "command" that does this for me:               \cventry{jobtitle}{organisation}{date}{description}{bulletpoint...}      such as:               \cventry{Potato peeler}{TESCO}{1999 -- to date}{     Responsible for the peeling of all potatoes}{     Sped-up potato peeling by 15 percent}{     Increased potatoes' smoothness by 20 percent as measured by 2004 customer survey}      yielding:               \textbf{Potato peeler} \hfill 1999 -- to date \\     TESCO \\     Responsible for the peeling of all potatoes \\     \begin{list2}       \item Sped-up potato peeling by 15 percent       \item Increased potatoes' smoothness by 20 percent as measured by 2004 customer survey     \end{list2}      Notice the `varargs` nature of the {bulletpoints...} "argument", by that I mean that the "command" could accept just one parameter, two parameters, `n` parameters, and still work precisely as intended. Please provide a code example. Optional: in your code, if it's possible in TeX/LaTeX (I don't know), allow creation of a "CV entry" data structure to hold all data pertaining to a single "CV entry" (title, dates, bullet-point array, ...) and an "array"/"list" of such objects so that the latter may be passed to a "lay out CV entry" function, which would simply typeset each "CV entry" in turn, and then layout the "CV entry" according to the spec above". Thanks a lot for your help, I think I will learn a lot from this answer so I am grateful in advance for your input.


title: Longtable exceeds page length

text: My longtable exceeds the page length. Any help would be highly appreciated.               \documentclass[11pt,a4paper,oneside]{report}          \usepackage{fontenc}     \usepackage{setspace}     \usepackage{array}     \usepackage{covington}     \usepackage{pslatex}     \usepackage{float}     \usepackage{longtable}     \usepackage{booktabs}     \newcolumntype{R}{>{\raggedleft\arraybackslash}p{2cm}}     \usepackage{tocvsec2}     \setcounter{secnumdepth}{3}     \setcounter{tocdepth}{3}     \usepackage{colortbl}     \setlength{\evensidemargin}{1.96cm}     \setlength{\topmargin}{3.5 cm}     \setlength{\headheight}{1.36cm}     \setlength{\headsep}{1.00cm}     \setlength{\textheight}{20.84cm}     \setlength{\textwidth}{14.5cm}     \setlength{\marginparsep}{1mm}     \setlength{\marginparwidth}{3cm}     \setlength{\footskip}{2.36cm}     \usepackage{graphicx}     \usepackage{titlesec}     \usepackage[bottom,norule]{footmisc}     \usepackage[tableposition=t]{caption}     \usepackage[danish,english]{babel}     \usepackage{natbib}     \bibpunct{(}{)}{,}{a}{}{,}     \usepackage[a4paper]{geometry}     \geometry{top=4cm, bottom=3.5cm, left=5cm, right=3.5cm}     \footskip = 30pt     \renewcommand{\bibname}{References}     \usepackage[toc,page]{appendix}     \usepackage{longtable}     \usepackage[hidelinks]{hyperref}     \usepackage{bookmark}     \usepackage[bitstream-charter]{mathdesign}     \usepackage[T1]{fontenc}     \usepackage{multirow}     \usepackage{lscape}               \begin{document}          \newpage     \chapter{Data Collection}          \section{California Cities Selected and Represented in the Present Study}          \subsection{Cities Selection Method}          Northern California includes forty-eight counties, thirty-eight of which are represented in this study (see following sections for a complete list of included counties).           Alpine County, Colusa County, Inyo County, Mariposa County, Modoc County, Mono County, Napa County, Plumas County, Sierra County, and Sutter County are not represented in this study.     In fact, we could not find online newspapers based in those counties that were suitable for the present research.          \newpage     \subsection{The North Coast Region}          \begin{figure}     \centering     \rule{4.88in}{4in}\caption{Map of the North Coast Region.\label{fig:North Coast Region}}          \end{figure}          The North Coast of California is a rural area that stretches on the Pacific coast from San Francisco Bay north to the Oregon border and includes Del Norte, Humboldt, Trinity, and Mendocino counties. Within the region there is no city with a population of over 100,000.           According to Bright (1971), in 1870 the population of the North Coast region included eleven percent of immigrants from New York, nine percent from Missouri; three percent from Maine; and two percent from Ohio (see Appendix for details).          %(White \%, Black or African American \%, Hispanic or Latino \%, Asian \%, Other \%). The median age of the population in Del Norte County is - years old.           \begin{longtable}{l r l r r}     \caption{Description of the Counties in the The North Coast Region\label{Description of the Counties in the The North Coast Region}}\\     \toprule     \textsc{County}&\textsc{Founded}&\textsc{Seat}&\textsc{Area (sqm)}&\textsc{Pop 2010}\\     \midrule     \endfirsthead     \caption[]{(continued)}\\     \toprule     \textsc{County}&\textsc{Founded}&\textsc{Seat}&\textsc{Area (sqm)}&\textsc{Pop 2010}\\     \midrule     \endhead     \bottomrule     \endlastfoot     Del Norte&1857&Crescent City&1,008&7,643\\      Humboldt&1853&Eureka&3,573&27,191\\      Lake&1861&Lakeport&1,258&4,753\\     Mendocino&1850&Ukiah&3,509&16,075\\     Trinity&1850&Weaverville&3,179&3,600\\       \end{longtable}          \begin{longtable}{l l l}     \caption{Coverage for The North Coast Region\label{Coverage for The North Coast Region}}\\     \toprule     \textsc{County Name}&\textsc{City}&\textsc{Online Newspaper}\\     \midrule     \endfirsthead     \caption[]{(continued)}\\     \toprule     \textsc{County Name}&\textsc{City}&\textsc{Online Newspaper}\\     \toprule     \endhead     \bottomrule     \endlastfoot     Del Norte&Crescent City&Daily Triplicate\\      Humboldt&Eureka&Eureka Times-Standard\\      Lake&Lakeport&Lake County News\\     Mendocino&Ukiah&Ukiah Daily Journal\\     &Willits&Willits News\\      Trinity&Weaverville&Trinity Journal\\     \end{longtable}          \end{document}


title: Why choose LuaLaTeX over XeLaTeX?

text: There are questions on TeX.sX already about what the differences between LuaLaTeX and XeLaTeX are (Differences between LuaTeX, ConTeXt and XeTeX), what one should be keep in mind when going from XeLaTeX to LuaLaTeX (Considerations when migrating from XeTeX to LuaTeX?), and how they typically differ in their preambles (Frequently loaded packages: Differences between XeLaTeX and LuaLaTeX). From the perspective of an end user, however, I've yet to see any reason for why one should switch from XeLaTeX to LuaLaTeX. That is, I have read facts like LuaLaTeX using the Lua scripting engine, but that is not relevant to an end user like me who has no idea what that entails. Yet I've noticed that most of the cool kids here on TeX.sX seem to prefer LuaLaTeX over XeLaTex, and I'm curious what those reasons are, and more specifically, if they apply to "normal" end users like myself. To give LuaLaTeX a try, I recompiled an old short handout of mine in LuaLaTex, and they mostly looked exactly the same. Where they differed, however, XeLaTeX clearly gave the better results. Below are some examples I found in my handout: XeLaTeX: ![enter image description here](http://i.stack.imgur.com/b6knp.png) LuaLaTeX: ![enter image description here](http://i.stack.imgur.com/O2Eg4.png)               \documentclass{article}     \usepackage{fontspec}     \setmainfont         [             Path = C:/Windows/Fonts/,             Extension = .otf,             UprightFont = LinLibertine_R,             BoldFont = LinLibertine_RZ,             ItalicFont = LinLibertine_RI,             BoldItalicFont = LinLibertine_RZI         ]{libertine}          \begin{document}     mak\textbf{\underline{a}}t     \textit{wund\textbf{\underline{V\char"0306}}de}     \textit{*wund\textbf{\underline{\char"014D}}d\char"0113}     \end{document}      In the second and third word, LuaLaTeX adds more white space before the underlined italicized boldfaced characters. In my view, it adds too much. Notice, however, that it does not add any extra white space in the first word, where the character is not italicized. In the second word, XeLaTeX handles the placement of the combining breve character well, but LuaLaTeX does not. This is potentially a worry, since I normally use a lot of combining characters in my documents (this being the only example in my handout). If anything, I only see reasons to stick to XeLaTeX for the moment, but I am still curious if there are advantages to LuaLaTeX over XeLaTeX that could potentially override the disadvantages I've identified above.


title: fancyhdr package not found

text: I'm trying to use the `fancyhdr` package for headers and footnotes for my LaTeX report, but when I compile TeX returns an error saying that `fancyhdr.sty` file can't be found. Any suggestion on how to proceed please?


title: Is there any more convenient way to insert Math-mode Accents?

text: Is there any more convenient (concise) way to insert Math-mode Accents? For example is it possible to use a syntax like following:               a\^ %instead of \hat{a}      a\- %instead of \bar{a}     a\~ %instead of \tilde{a}      or               \^a %instead of \hat{a}      \-a %instead of \bar{a}     \~a %instead of \tilde{a}


title: How do you prepare your preprints?

text: My first paper has been accepted for publication recently, and I was instructed to send the `.tex` source code based on one of the two templates available on the journal website. This was painful, both in styling as well in practices. For example, I am using `\nameref` through and through my paper, but the template did not include that. Seeing how this is part of a reasonable common package I wasn't _that_ worried, but I am still somewhat worried that they will request that I remove that and change all those to hand-written names (perhaps with `\ref` instead or so). But on the other hand, I also use a custom multi-parameter macro based on `xparse` (i.e., it has a mandatory argument and an optional one). This part really worries me, that they will request that I edit that one out. It's not a huge hassle, the paper is not that long and I suppose that I could do it in an hour of work. However I feel that there is a lesson to be learned here. * * * > How do you prepare your preprints?   * Do you have a single-file template that you pass from one paper to another, and accumulate new commands and so on (which is a good thing because it allows you to decide to change some things without damaging previously written papers)?   * Do you have a multiple-file template passing from one paper to another, again accumulating new commands and so on (which is also good, but can be slightly more painful when preparing a file for publication)?   * Do you have a different habit? I am aware that this question might be slightly off topic, but I am quite familiar with writing LaTeX code (e.g., I go insane with every warning); but I am new to writing papers that make it to publication. Also, I'd love to get some input and suggestion from more experienced people than me.


title: Trouble aligning rows in two columns using makecell

text: Been trying to align columns two and three (vertically) but can't figure it out. Columns are coming up central to "Workability" instead, and as column two has some rows taking up 2 lines, they don't match up. Here's what I've got..               \usepackage{makecell}     \newcommand{\aspect}{%     \makecell[l]{Practicality\\Controlling factors\\Knocking-up\\Type of lime\\Impacts}%     }     \newcommand{\key}{%     \makecell*[l{p{85mm}}]{Mortar needs to be easy to work so the mason won't add more water\\Water retentivity, water content, internal friction, surface area, air content, density, consistency\\Consistency reintroduced without need for extra water\\Hydrated lime more workable than hydraulic\\Strength (particularly bond strength), water resistance and workmanship}%     }          \begin{document}          \begin{table}[ht]     \renewcommand{\arraystretch}{2.5}     \centering     \begin{tabular}{p{15mm}p{30mm}p{85mm}} \toprule        & Aspect   & Key Characteristics \\ \midrule     Workability & \aspect & \key \\     \end{tabular}     \end{table}          \end{document}      I initially had the following...but as you can see, "Workability" wasn't actually central.               \usepackage{multirow}     \usepackage[labelfont=bf]{caption}          \begin{document}          \begin {table} [ht]     \renewcommand{\arraystretch}{1.5}     \centering     \begin{tabular} {l l p{8.5cm}}     %3 left aligned columns     \hline     & Aspect & Key Characteristic(s) \\     \hline     \multirow{5}{*}{Workability}      & Practicality & Mortar needs to be easy to work so the mason won't add more water \\     & Controlling factors & Water retentivity, water content, internal friction, surface area, air content, density, consistency \\     & "Knocking-up" & Consistency reintroduced without need for extra water \\      & Type of lime & Hydrated lime more workable than hydraulic \\     & Impacts & Strength (particularly bond strength), water resistance and workmanship \\         \hline     \end{tabular}     \caption{Workability}     \label{table:Workability}    %table reference in text     \end{table}          \end{document}


title: Biblatex with biber backend results in undefined control sequences but not with bibtex backend

text: I use Texmaker (verion 3.4.1) and MikTeX 2.9 (which has been installed one week ago). Texmaker is configured to use biber: I replaced "bibtex %.aux" by "biber %". If I run LaTeX, then the file compiles without errors. The same goes for BiBTeX. But if I then run LaTeX again, then get error messages. Here is a minimal working example:               \documentclass{article}     \usepackage[english]{babel}     \usepackage{csquotes}     \usepackage[backend=biber,style=authoryear-comp]{biblatex}     \addbibresource{mybibliography.bib}     \begin{document}     \textcite{label}     \printbibliography     \end{document}      Here are the error messages: > ! Undefined control sequence. ...c@refsection @entry@\blx@slist@name > > l.39 \endentry > > The control sequence at the end of the top line of your error message was > never \def'ed. If you have misspelled it (e.g., `\hobx'), type`I' and the > correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget > about whatever was undefined. > > ! Undefined control sequence. ...c@refsection @entry@\blx@slist@name > > l.39 \endentry There are no error messages if I replace `backend=biber` with `backend=bibtex`. How can I solve this problem?


title: dictionary-style header problem with fancyhdr

text: I am trying the `fancyhdf.pdf` page 11 example. But I find I am getting wrong headers like `Foo--Foo` on the first page of the `Foo` entry, but correctly `Foo` on subsequent pages. The reason seems to be that the `equal{\leftmark}{\rightmark}}` command is failing because `\leftmark` is lower case, and `\rightmark` is upper case. I cannot find any way to fix this. Any suggestions? My code is:               \renewcommand{\parishmarks}{% as in fancyhdr.pdf page 11, but with \nouppercase added     \ifthenelse{\equal{\leftmark}{\rightmark}}{\rightmark}{\nouppercase\rightmark--\leftmark}}          \fancyhead[L]{\chaptermark}\fancyhead[R]{\parishmarks}      See How can I achieve dictionary headers for two page spreads in LaTeX * * * Here is a complete example. Without the \renewcommand, the first page has "-AAA" where it should have "AAA".               \documentclass[12pt,a4paper]{article}          \usepackage{fancyhdr,ifthen}          \renewcommand{\sectionmark}[1]{} % turn off section marks          % create a command to create marks and collapse them if they are identical...     \newcommand{\mymarks}{%     \ifthenelse{\equal{\leftmark}{\rightmark}}     {\rightmark} % if equal     {`\rightmark'--`\leftmark'}} % if not equal          \renewcommand{\mymarks}{% fix the case where \rightmark is an empty string \ifthenelse{\equal{\leftmark}{\rightmark}}     {\rightmark} % if equal     {\ifthenelse{\equal{}{\rightmark}}{\leftmark}{\rightmark--\leftmark}}} % if not equal          \fancyhead[LE,RO]{\mymarks}     \fancyhead[LO,RE]{\thepage}          \pagestyle{fancy}          \begin{document}          \section{First section}\markboth{AAA}{AAA} % this goes wrong without the fix          \noindent This is the first section.          \clearpage\markboth{CCC}{BBB}          \noindent This is a new page, not a new section.          \end{document}


title: complex table with multirow doesn't close all the boxes

text: I have made a big table with a table editor and there are two lines that doesn't finish in the place they are suposed to finish.               \documentclass{scrartcl}     \usepackage[utf8]{inputenc}     \usepackage[catalan]{babel}     \usepackage{graphicx}     \usepackage{lscape}     \usepackage{multirow}     \usepackage{layout}     \newcommand{\rot}[1]{\rotatebox{90}{#1}}     \begin{document}          \begin{landscape}     \begin{table}[h]   \footnotesize     \begin{tabular}{c|c|c|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|}     \cline{5-20}     \multicolumn{1}{l}{}               & \multicolumn{1}{l}{}                                & \multicolumn{1}{l}{}                            &                                             & \multicolumn{16}{|c|}{\textbf{ACCIONS}}                                                                                \\ \cline{5-20}      \multicolumn{1}{l}{}                                       & \multicolumn{1}{l}{}                                & \multicolumn{1}{l}{}                            &                                             & \multicolumn{10}{|c}{FASE DE CONSTRUCCIÓ}                                                                                & \multicolumn{6}{|c|}{FASE D'EXTRACCIÓ}                                                                                \\ \cline{5-20}      \multicolumn{1}{l}{}                                       & \multicolumn{1}{l}{}                                & \multicolumn{1}{l}{}                            &                                             & \rot{preparació de l'àrea} &\rot{ construcció diposits externs}  &\rot{ infr. transport} &\rot{ maquinaria transport} &\rot{ perforació del pou} &\rot{ revestiment de carcasses} &\rot{ injecció de ciment} &\rot{ perforació pou horitzontal} &\rot{ recollida i transport de residus} &\rot{ consum de recursos} &\rot{ Maquinaria de transport} &\rot{ Bombeig solució} &\rot{ extracció solució resultant} &\rot{ recollida i transport de residus} &\rot{ consum de recuros} &\rot{ transport de personal} \\ \hline     \multicolumn{1}{|c|}{\multirow{13}{*}{\textbf{MEDI FÍSIC}}} & \multicolumn{1}{|c|}{\multirow{10}{*}{ ABIÓTIC}} & \multicolumn{1}{|c|}{\multirow{3}{*}{Atmosfera}} & \multicolumn{1}{|l|}{Contaminació gasos}    &                      &                     &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \cline{4-20}      \multicolumn{1}{|l|}{\textbf{}}                            & \multicolumn{1}{l}{}                                & \multicolumn{1}{l}{}                            & \multicolumn{1}{|l|}{Contaminació pols}     &                      &                               &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \cline{4-20}      \multicolumn{1}{|l|}{\textbf{}}                            & \multicolumn{1}{l}{}                                & \multicolumn{1}{l}{}                            & \multicolumn{1}{|l|}{contaminació acústica} &                      &                               &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \cline{3-20}      \multicolumn{1}{|l|}{\textbf{}}                            & \multicolumn{1}{l}{}                                & \multicolumn{1}{|c}{\multirow{4}{*}{Sòl}}       & \multicolumn{1}{|l|}{Contaminació}          &                      &                               &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \cline{4-20}      \multicolumn{1}{|l|}{\textbf{}}                            & \multicolumn{1}{l}{}                                & \multicolumn{1}{|l}{}                           & \multicolumn{1}{|l|}{Erosió}                &                      &                               &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \cline{4-20}      \multicolumn{1}{|l|}{\textbf{}}                            & \multicolumn{1}{l}{}                                & \multicolumn{1}{|l}{}                           & \multicolumn{1}{|l|}{Ús del sòl}            &                      &                               &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \cline{4-20}      \multicolumn{1}{|l}{\textbf{}}                             & \multicolumn{1}{|l}{}                               & \multicolumn{1}{|c}{}                           & \multicolumn{1}{|l|}{Sismicitat}            &                      &                               &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \cline{3-20}      \multicolumn{1}{|l}{\textbf{}}                             & \multicolumn{1}{|l}{}                               & \multicolumn{1}{|c}{\multirow{3}{*}{Aigua}}     & \multicolumn{1}{|l|}{Aigues superficials}   &                      &                               &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \cline{4-20}      \multicolumn{1}{|l|}{\textbf{}}                            & \multicolumn{1}{l}{}                                & \multicolumn{1}{l}{}                            & \multicolumn{1}{|l|}{Aigues subterraneas}   &                      &                               &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \cline{4-20}      \multicolumn{1}{|l|}{\textbf{}}                            & \multicolumn{1}{l}{}                                & \multicolumn{1}{l}{}                            & \multicolumn{1}{|l|}{Recurs hídric}         &                      &                               &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \cline{2-20}      \multicolumn{1}{|l}{\textbf{}}                             & \multicolumn{1}{|c}{\multirow{3}{*}{BIÓTIC}}        & \multicolumn{2}{|c|}{Vegetació}                                                               &                      &                               &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \cline{3-20}      \multicolumn{1}{|l}{\textbf{}}                             & \multicolumn{1}{|l}{}                               & \multicolumn{2}{|c|}{Fauna}                                                                   &                      &                               &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \cline{3-20}      \multicolumn{1}{|c}{\textbf{}}                             & \multicolumn{1}{|l}{}                               & \multicolumn{2}{|c|}{Paisatge}                                                                &                      &                               &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \hline     \multicolumn{2}{|l}{\multirow{4}{*}{\textbf{MEDI SOCIOECONÒMIC}}}                                                & \multicolumn{2}{|c|}{Demografia}                                                              &                      &                               &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \cline{3-20}      \multicolumn{2}{|l}{}                                                                                & \multicolumn{2}{|c|}{Turisme}                                                                 &                      &                               &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \cline{3-20}      \multicolumn{2}{|l}{}                                                                                & \multicolumn{2}{|c|}{Economia}                                                                &                      &                               &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \cline{3-20}      \multicolumn{2}{|l}{}                                                                                & \multicolumn{2}{|c|}{Salud }                                                                  &                      &                               &                 &                      &                    &                          &                    &                            &                                  &                    &                         &                 &                             &                                  &                   &                       \\ \hline     \end{tabular}     \end{table}     \end{landscape}     \end{document}


title: achemso stopped generic Tables, Figure and Eq. in front of labels

text: I have the following problem. After an update to MikTeX2.9 (from 2.7) the `achemso` package stopped working properly in terms of generating "key words" in front of labels used by `\re`f. I.e. now instead of "See Figure 1" I have just "See 1". Does anyone have any idea what could be the reason for this?


title: Change color of a type of text like header/footer

text: Can we change the color of a logical type of text, say every header or every footer, by a single command? Header and footer is using `fancyhdr`. I believe it should be a `\renewcommand` but won't it affect dependent packages like `fancyhdr`? I could define newer macros from the one which fancyhdr uses like `\rfoot` or `\cfoot`, to say `\rfootcolored` or `\cfootcolored`. But then I have to redesign the entire header/footer from scratch...which I don't want to do.. A MWE..               \documentclass{book}          \usepackage{lipsum}     \usepackage{fancyhdr}               \begin{document}     \pagestyle{fancy}          \chapter{Lipsum}     \lipsum[1-6]          \section{lipsumsection}     \lipsum[7-10]          \chapter{Lipsum2}     \lipsum[2-7]                    \end{document}


title: Add word Listing in front of number in list of listings

text: I have to add the word `Listing` or `Lst.` in front of the number of a listings in the list-of-listings. I use the `listings` package. I know how to achieve this with tables:               \renewcommand{\cfttabpresnum}{Tab. }     \settowidth{\cfttabnumwidth}{Tab. 10\quad}      but is there something similar for the listings? My current code:               \documentclass[12pt,a4paper]{scrartcl}     \usepackage{listings}     \begin{document}     \lstlistoflistings     \section{Test}     \begin{lstlisting}[caption=TestListing]     test()     \end{lstlisting}     \end{document}


title: LaTeX custom distribution

text: I have two questions:   1. Is it legal to redistribute LaTeX in a commercial software?   2. if is, how do I make a minimal and portable distribution of plain latex and a few packages? **Note** : I wish to use LaTeX by IPC in my program to print some numbers on sale factors. I would like to do this via LaTeX + XeLaTeX (if possible). Thanks in advance


title: Apply draft option of graphicx for only one chapter/section

text: I am writing a thesis with many figures in each chapter. It takes quite some time to compile and convert to PDF. If I use the `draft` option of the `graphicx` package the figures will be skipped. This is good, but not for the chapter that I am working on. Is there a way to turn the option on only for other chapters? I know about `\include` and `\includeonly` but I want the whole thesis text to be there.


title: How could I center the text in a rectangle split node?

text: I use TikZ to create pictures in LaTeX. My picture consists of a rectangle with nine split parts. Every part has its own text inside the node, for example, "local variables, and temporaries":               \nodepart{eight} \structtwenty Saved registers, local variables, and temporaries      My problem is the text is not centered in the node, but on top and bottom of the node, can any help, below is the whole TeX file:               \documentclass{article}     \usepackage{tikz}          \usetikzlibrary{calc}     \usetikzlibrary{decorations.pathreplacing}          \usetikzlibrary{shapes,arrows,positioning}     \def\structforty{\vrule depth 4cm width 0pt}      \def\structsix{\vrule depth 0.14cm width 0pt}      \def\struceleven{\vrule depth 1.1cm width 0pt}      \def\strucfourteen{\vrule depth 1.1cm width 0pt}      \def\structtwenty{\vrule depth 1.9cm width 0pt}           \begin{document}              \begin{tikzpicture}[auto,       rect/.style={         rectangle split, rectangle split parts=9,         draw,rectangle split part align=center,draw, thick,         text width=3cm,         text centered, %minimum height=26em,         % font=\ttfamily,         align=center, rectangle split part align={center,left},         rectangle split part align=midway,         rectangle split part fill={gray!30, blue!20, blue!15, blue!20,blue!15,blue!15,green!15,green!20,green!30}       }]            \node (stack) [rect] {     \nodepart {one}\structforty $\vdots$     \nodepart {two}\struceleven $\vdots$          \nodepart{three}\structsix Argument n     \nodepart{four} \struceleven $\vdots$     \nodepart{five} \structsix Argument 1     \nodepart{six} \structsix Return Address     \nodepart{seven} \structsix Saved \%ebp     \nodepart{eight} \structtwenty Saved registers, local variables, and temporaries     \nodepart{nine} \strucfourteen Argument build area     };          \end{tikzpicture}     \end{document}


title: Fix position of picture over different slides

text: I have a few very simple beamer slides, which are built up this way: > A short introducory text > > A picture, which is almost the same in all slides Unfortunately, the introducory text is sometimes one line, sometimes two lines and sometimes three. Therefore the picture gets always a little bit shifted in its vertical position. Since this is a presentation, I would it like to have it fixed on a certain position, so that it doesn't change when loading the new slide.


title: How to test whether the starred-version of a command is defined?

text: This question is similar to How to conditionally define a new command in LaTeX? but I want to test if the starred version of a command is defined. The naive thing               \makeatletter     \@ifundefined{ref*}{}{}     \makeatother      doesn't work, for example, for testing whether a starred version of `\ref` is defined (say, by `hyperref`) as it always returns true.


title: Location of entry's page number in toc, lot and lof

text: I'm using titlecontens offered by `titletoc` package to format the entries in toc, lot and lof. For a multiline entry, the default location of its corresponding page number is after the last line of this entry. Is there any way to place this number after the first line of this entry?


title: Add Footer Text to All Slides in Beamer

text: Is there a way to append footer text to the slides in beamer? I wanted to get rid of the default footer, but I want to add a bit of additional text. Right now I have:               %gets rid of bottom navigation bars     \setbeamertemplate{footline}[page number]{}          %gets rid of navigation symbols     \setbeamertemplate{navigation symbols}{}


title: Wider tables in LaTeX, which is the best solution?

text: Hi I have a LaTeX table code generated from **R** like the following               \usepackage{rotating}     ...     \begin{sidewaystable}       \begin{center}         \small\addtolength{\tabcolsep}{-7pt}         \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c}           \hline           & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\            \hline           1 & 199431807780.64 & 183081402932.29 & 128534694388.51 & 179440680448.90 & 108197076781.65 & 197467417852.02 & 160955357155.76 & 131219625892.12 & 195614579576.07 & 124954368732.87 & 150613258150.41 & 174825984193.01 \\            2 & 103291688766.33 & 122482430678.79 & 133002175739.97 & 145037559652.70 & 195323145552.54 & 127063745679.33 & 117424926743.84 & 163175808917.73 & 142332740593.70 & 141749742929.82 & 149479208537.38 & 170449046092.11 \\            3 & 147147895675.15 & 141156681370.92 & 123554744524.88 & 146418996830.47 & 113873624568.81 & 180636164429.60 & 154157750261.95 & 179955205763.69 & 177509862114.68 & 184403196861.97 & 188580405595.71 & 138935472769.66 \\            4 & 190173864271.49 & 100045285350.64 & 127888713567.52 & 192334005935.12 & 149804830760.70 & 110147950542.16 & 193738265451.98 & 181565890880.30 & 162375453603.45 & 109334682021.29 & 117348478571.51 & 141804601531.48 \\            \hline         \end{tabular}       \end{center}     \end{sidewaystable}      I have a set of tables like this. My problem is the table is not displayed in the page. So I have used two solutions 1) `rotating` package; 2) adding `\small\addtolength{\tabcolsep}{-7pt}` between `\begin{center}` and `\begin{tabular}`. But the problem is the text in the table gets overlapped and is not legible to read. Can anyone please help me by giving a solution for this.


title: Create plain CSV list of pages with/without figures

text: I'm wondering if there's an easy way to have LaTeX output two lists:   1. of pages containing and   2. of pages not containing figures and/or other color objects. I'd like to print color pages on a color printer (expensive) and print the rest of the pages on B&W. I'd like to be able to have one PDF and two txt files with CSV lists I can just dump into a print dialog. If this can't easily be done, then is there is way to modify the list of figures format so it just lists the pages with comma separation? That way I could compile a temporary version of the PDF with that LOF, and copy them to a text file. Don't know how I'd get the complement of that set of page numbers then though. I saw this post which recommended doing it manually or using PDFpages, but it seemed a little inconclusive. **Update** Andrey has provided a nice solution below to output a CSV list. I now realize that for my thesis, the list is long enough that it won't fit in a print dialog, and my printing place says they prefer two separate PDF docs anyway. So, I wonder is it possible to integrate the `pdfpages` method demonstrated here so that it takes in the CSV lists produced by Andrey's method and uses them to create two additional PDF files, one with color pages, and one B&W. That method is as follows, where `inputPDFfilename` is the full PDF:               \documentclass{article}     \usepackage{pdfpages}     \begin{document}     \includepdf[pages={3-6, 17, 28, 29-31}]{inputPDFfilename}     \end{document}      One tricky aspect is that pdfpages takes absolute page numbers. I'm not familiar enough with the packages and syntax in Andrey's method to modify it myself at present. It would be cool if this could be fully integrated into the same LaTeX project that creates my thesis.


title: Formatting a book with scene markers

text: I'm laying out my wife's book using LaTeX; I'm using KOMA-Script `scrbook` as my document class, but I don't think that my question here is specific to KOMA. Between certain scenes, we have scene markers to indicate to the reader that either time has passed or the point of view has changed; standard fare in novels. It would look something like: > …and we came to the end of the paragraph. > > • • • > > Meanwhile, in this other paragraph… With the layout that I'm producing, I want to introduce two specific behaviours to this:   1. I never want a scene separator as the first text on a page. If I have to squeeze some vertical spacing to fit the scene separator at the bottom of the _previous_ page, that's what I want to do. If it's better to move some of the text of the previous page (while avoiding widows/orphans) to the new page, that's what I want to do. I'd _also_ like to do this with as little human intervention as possible, since I'm using LaTeX as an intermediate format for the print document.   2. I want the paragraph _following_ the scene separator to not be indented, just as if this were the beginning of a chapter. What I have made is a command:               \usepackage{fontspec,xunicode}     \defaultfontfeatures{Ligatures=TeX}     \newfontfamily\cleffont{Apple Symbols}     \makeatletter          \newcommand{\Scene}{%       \begin{center}%         {{\fontsize{2\dimexpr\f@size}%         \z@\cleffont{}}}%       \end{center}}     \makeatother      So that I use it as:               …and we came to the end of the paragraph.          \Scene          Meanwhile, in this other paragraph…      Can I do either of these, and how?


title: formula transfer to a new line

text: How I can make a transfer of a long math equation in a new line? I suppose there are at least two methods: manually by hands and adjust math container to do that automatically. Can you show me, please this two methods.


title: Background color of breakable box with thin blank lines

text: The purpose of the `mybox` environment in the following document is to typeset a box in a blue background. The box may be split by page breaks. The algorithm used is similar to the one found in the `boites` package:   * first the text is formatted in a vbox   * then each line of the vbox is extracted from the vbox and output in a colorbox. The document:               \documentclass{article}     \usepackage[paperwidth=10cm,paperheight=35mm,margin=3mm]{geometry}     \usepackage[utf8]{inputenc}     \usepackage[T1]{fontenc}     \usepackage{color}     \usepackage{lipsum}     \pagestyle{empty}          \newbox\boxhead     \newbox\boxtail     \newbox\boxtemp          \newdimen\dimtemp          \def\boxsplit{%       % total height of original box       \dimtemp\ht\boxtail       \advance\dimtemp\dp\boxtail       % split original box in order to retrieve its first line       \setbox\boxhead\vsplit\boxtail to 0pt       % fix the height of the first line       \setbox\boxhead\vbox{\unvbox\boxhead}%       % restore original size       \setbox\boxtemp\vbox{\copy\boxhead\copy\boxtail}%       \advance\dimtemp-\ht\boxtemp       \advance\dimtemp-\dp\boxtemp       \advance\dimtemp\dp\boxhead       \dp\boxhead\dimtemp     }          \newenvironment{mybox}{%       \ifhmode\par\fi       \setbox\boxtail\vbox\bgroup     }{%       \egroup       {%         \noindent         \fboxsep 0pt         \splittopskip 0pt         \baselineskip 0pt         \lineskiplimit 0pt         \lineskip 0pt         \vfuzz\maxdimen         \leavevmode         \loop           \ifvoid\boxtail           \else             \boxsplit             \colorbox{blue}{\hbox to \linewidth{\box\boxhead}\hfil}%             \hfil             \repeat       }%     }          \begin{document}          \begin{mybox}       \lipsum[68]     \end{mybox}          \end{document}      When looking with care (the following image shows the document opened in the `evince` pdf viewer), very thin white rules can be seen between the blue lines in the text formatted by the environment. ![sample document](http://i.stack.imgur.com/etGpI.png) Has anybody any clues on how to eliminate them? I know there are packages like `mdframed` that already provides this functionality using a different algorithm. But they do not work with the `beamer` class or in multicolumn environments, and they cannot be nested. EDIT: As pointed by others, this seems to be an issue with the pdf viewer. I tried several viewers (on Linux) and found that some of them shows the thin white rules and others do not. Good pdf viewers:   * qpdfview 0.4.9   * adobe reader 9.5.5   * okular 0.18.3   * foxit reader 6.1.4.0217 (with wine) Bad pdf viewers:   * evince 3.10.3   * epdfviewer 0.1.8   * sumatra pdf 2.4 (with wine)   * pdf-xchange (with wine)


title: Can my LaTeX (maths) code be improved?

text: I feel that my code isn't written very efficiently.               \documentclass[a4paper,11pt]{article}     \usepackage[english]{babel}     \usepackage[pdftex]{graphicx}     \usepackage{tikz}     \usepackage{wasysym}     \usepackage[all]{xy}     \usepackage{amsfonts}          \title{Discrete Mathematics -- Lecture 15}     \author{Alec Taylor}     \date{August 25, 2011}          \begin{document}          \maketitle          \section{Disjoint definition}     Sets A and B are \underline{disjoint} if A $\cap$ B = \{ c,d,e \}     \\[2mm]     But if C=\{ x,y,z \} then A and C are disjoint, B and C are disjoint.     \begin{center}     \line(1,0){250}     \end{center}          Note: A $\subseteq$ A so A $\in$  $\mathcal{P}$(A)     \\[2mm]     $\mathcal{P}$ $\subseteq$ A so $\emptyset$ $\in$ $\mathcal{P}$(A)     \\[2mm]     x $\in$ A, \{x\} A, \{x\} $\in$ $\mathcal{P}$(A)          \section{Cartesian definition}     The \underline{cartesian product} of the set $A_1$, $A_2$, ..., $A_n$ is $A_1$ $\times$ $A_2$ $\times$ ... $\times$ $A_n$      \newline     =\{($a_1$, $a_2$, ..., $a_n$)(a, $\in$$A_1$)$\land$($a_2$$\in$$A_2$)$\land$...$\land$($a_n$$\in$$A_n$)\}     \\[2mm]     The element ($a_1$, $a_2$, ..., $a_n$) is an \underline{ordered n-tuple}.     \\[2mm]     E.g.: (x,y) in cartesian plan (i.e.: the coordiantes of a point in the plane) is an ordered pair, the Cartesian plane is the product $\mathbb{R}$x$\mathbb{R}$ or $\mathbb{R}^2$.          \section{Cardinality definition}     In general if $\|$A$\|$=n, $\|$B$\|$=m then $\|$A $\times$ B$\|$ = $\|$A$\|$ $\|$B$\|$     \\[2mm]     $\|$$A^n$$\|$=$\|$A$\|$ $\|$A$\|$ (<n times>) $\|$A$\|$ = $\|$$A^n$$\|$     \end{document}                    \documentclass[a4paper,11pt]{article}     \usepackage[english]{babel}     \usepackage[pdftex]{graphicx}     \usepackage{tikz}     \usepackage{wasysym}     \usepackage[all]{xy}     \usepackage{amsfonts}          \title{Discrete Mathematics -- Lecture 16}     \author{Alec Taylor}     \date{August 25, 2011}          \begin{document}          \maketitle          \section{Laws}     Let A = \{ x $\in$ $\mathbb{Z}$ $\|$  x $\le$ 5 \}     \newline     Let B = \{ x $\in$ $\mathbb{Z}$ $\|$ x $>$ 0 \}     \\[2mm]     A $\cap$ B = \{ x $\in$ $\mathbb{Z}$ $\|$ (x $\le$ 5) $\land$ (x $>$0) \}     \newline     = \{ 1,2,3,4,5 \}     \\[2mm]     A $\cup$ B = \{ x $\in$ $\mathbb{Z}$ $\|$ (x $\le$ 5) $\lor$ (x $>$ 0) \} = $\mathbb{Z}$     \\[2mm]     $\bar{A}$ = \{ x $\in$ $\mathbb{Z}$  $\|$ x $>$ 5 \}     \newline     = \{x $\in$ $\mathbb{Z}$ $\|$-(x$\le$5) \}     \\[2mm]     A $\cap$ $\mathbb{P}$ = A     \\[2mm]     A $\cap$ $\bar{A}$ = $\diameter$     \\[2mm]     A $\cap$ $\diameter$ = $\diameter$     \\[2mm]     A $\cup$ (A $\cap$ B) $\equiv$ A     \\[2mm]     A $\cap$ B     \begin{tikzpicture}     \filldraw[fill=gray] (-2,-2) rectangle (3,2);     \scope % A \cap B     \clip (0,0) circle (1);     \fill[white] (1,0) circle (1);     \endscope     % outline     \draw (0,0) circle (1)           (1,0) circle (1);     \end{tikzpicture}     \\[2mm]     $\overline{A \cap B}$ \tikz \fill[even odd rule] (0,0) circle (1) (1,0) circle (1);          \section{Equivalency}     Two expressions involving sets are equivalent if ew can represent them with the same venn diagram. This corresponds to using truthg tables to establish equivalence of logical expressions.          \subsection{Examples}     \subsubsection{Example 1}     Let $\mathbb{P}$ = \{ 1,2, ..., 10 \}     \newline     A = \{ 2,4,7,9 \}     \newline     B = \{ 1,4,6,7,10 \}     \newline     C = \{ 3,5,7,9 \}          \subsubsection{Example 2}     Find B $\cap$ $\bar{C}$     \newline     $\bar{C}$=\{1,2,4,6,8,10\}     \newline     So B $\cap$ $\bar{C}$ = \{1,4,6,10\}          \subsubsection{Example 3}     Find (A $\cap$ $\bar{B}$) $\cup$ C = (A $\cap$ \{ 2,3,5,9,9 \}) $\cup$ C = \{ 2,9 \} $\cup$ C = \{ 2,3,5,7,9 \}     \subsubsection{Example 4}     Find $\overline{B \cup C}$ $\cap$ C = \{ $\overline{1,3,4,5,6,7,8,10}$\} $\cap$ C = \{ 2,8 \} $\cap$ C = $\diameter$          \subsubsection{Example 5}     Show that  (A $\cup$ $\bar{B}$) $\cap$ (A $\cup$ B) = A     \newline     (A $\cup$ $\bar{B}$) $\cap$ (A $\cup$B) = ((A $\cup$ $\bar{B}$) $\cap$ A) $\cup$ ((A $\cup$ $\bar{B}$) $\cap$ B) \underline{\bf distr}     \newline     =((A $\cup$ $\bar{B}$) $\cap$ A) $\cup$ ((A $\cap$ B) $\cup$ ($\bar{B}$ $\cap$ B)) \underline{\bf distr}     \newline     = A $\cup$ ((A$\cap$B)$\cup$($\bar{B}$ $\cap$ B)) \underline{\bf absorption}     \newline     = A $\cup$ (A $\cap$ B) \underline{\bf identity}     \newline     = {\bf A}     \end{document}      Is there a better way of writing it? FYI: I type up these notes during the lectures.


title: Why is the pin's angle argument displayed as text?

text: I'm completely stuck with the syntax of the command options `\node` Here is my code line:               \node [circle,fill=blue,scale=0.5,pin=60:$q_0$] at (9+90:15*4/30) {};      And it displays the same as if I had written `pin=0:{60:$q_0$}` Where is my mistake ?


title: Centering tabular: Why does this work?

text: About a month ago, someone asked how to align a tabular environment around the intercolumn space, which was something I'd been trying to figure out for a brief eternity. Werner's answer worked more or less fine, though I had to add extra braces around `\raggedright`. I was wondering, though, if someone could explain to me _why_ it worked. Here's the code that I'm using:               \usepackage{array}     %...          \noindent     \begin{tabular}       {>{\raggedleft}p{\dimexpr.5\linewidth-2\tabcolsep-.5\arrayrulewidth}|        >{{\raggedright}}p{\dimexpr.5\linewidth-2\tabcolsep-.5\arrayrulewidth}}         Kindle Edition Available & k \\         PC/Mac Edition Available & p     \end{tabular}      I think it's mostly the math for the paragraph widths that I'm not understanding, but I'd really appreciate it if someone could explain the whole thing in English. The part that I get is "insert the command `\raggedright` before the first paragraph-style column and `\raggedleft` before the second paragraph-style column"; otherwise I'm in the dark. If I was unclear about what I'd been trying to do, here's the difference between what that block produces and what this one does:               \begin{center}     \begin{tabular}{rl}         Kindle Edition Available & k \\         PC/Mac Edition Available & p     \end{tabular}     \end{center}      ![sample output](http://i.stack.imgur.com/k2Dyt.png) Thanks so much for your help!


title: How to redefine commands and environments, and make them acceptable for `\write`

text: My general problem is the following. I want to "convert" many .tex files into some other format (xml-like). I don't want to modify the tex files, I can only build a documentclass. The texfiles are organized in blocs ( i will call them content-blocs), through commands and environment, for example, roughly:               \begin{document}     \content{blablabla}     \titre{joli titre}     \explanation{i muss explain that...}     \begin{definition}        here some nice text     \end{definition}     ....     \end{document}      My present method, is to capture the content of the commands or environments and use `\write` to write them in a file:               \newwrite\tempfile     \immediate\openout\tempfile="test.xml"      For example (the following is defined in the documentclass used by the tex file):               \newcommand{\content}[1]{       \immediate\write\tempfile{<content>}       \immediate\write\tempfile{\content}       \immediate\write\tempfile{</content>}     }      The complication comes from the fact, that the commands and environments in `\content` may contain more than text, e.g other macros. For example :               \content{       some blablabla  \textbf{important} etc etc      }          \begin{definition}        consider the following points :        \begin{quote}           quote quote quote         \end{quote}        and so on, and so on...     \end{definition}      In this form, this gives a compilation error, because `\write` can't write this into the file. On the other hand, I know the exhaustive list of commands/environments that can appear in the "content-blocs". I though about capturing them, through a redefinition. For example :               \renewcommand{\textbf}[1]{<bold>#1</bold>}      works, the command `\content` will produces in the file "test.xml" a line               some blablabla  <bold>important</bold> etc etc      **Problem 1** : This strategy does not work for environments. My attempt               \renewenvironment{quote}{<quote>}{</quote>}      fails miserably. **Problem 2** : I would need this in particular for the `itemize` environment (instead of `quote`). I know that redefining `\item` may yield some problems **Problem 3** : In the content-blocks, I have sometimes commands with optional arguments, eg :               \content{bla bla \com[opt]{AAA} bla bla}      Here again, it fails, because commands with optional arguments are not fully expandable. As workaround, i can redefine the command `\com` with `\DeclareExpandableDocumentCommand` from the package `xparse`.               \DeclareExpandableDocumentCommand\expandCom{ o m} {<com : #1>#2</com>}      It seems to solve my problem for commands with optional arguments, but I would need the same for environments with optional arguments. **Problem 4** : I need to treat the content of the content-blocs, in order to extract information. For this i use in particular `\edef`, and i need that the macros (`\com`, `\texbf`, and so on...) expand correctly in a `edef`. But i guess that it is exactely the same problem like with `\write`. For both `\edef` and `\write` one needs fully expandable macros inside, isn't it ? **EDIT1** Concerning Bruno's question. I think that David's solution is somehow secure, because it does not redefine the existing commands/environments, but it rather creates new ones (`\mwx\begin`, etc...). Nevertheless, following Bruno's suggestion, i try to simply redefine the command `\begin` and `\end` for the environments i need (quote and definition, in this example). My attempt fails nevertheless. It might be because of `\ifthenelse`, but on the other hand, i never feel comfortable with `\ifx` :               \documentclass{article}     \usepackage{ifthen}          \let\originalbegin\begin     \let\originalend\end     \def\begin#1{%       \ifthenelse{\equal{#1}{quote}}{<quote:special def for quote>}{         \ifthenelse{\equal{#1}{definition}}{<DEF: another definition>}{\originalbegin{#1}         }       }      }     \def\end#1{%       \ifthenelse{\equal{#1}{quote}}{</quote>}{         \ifthenelse{\equal{#1}{definition}}{</DEF>}{\originalend{#1}         }       }     }     \newwrite\tempfile     \immediate\openout\tempfile="nico.xml"     \begin{document}          \def\content{     some blablabla  etc etc        \begin{definition}          consider the following points :           \begin{quote}             quote quote quote            \end{quote}          and so on, and so on...       \end{definition}     }     \immediate\write\tempfile{\content}%     \immediate\closeout\tempfile     \end{document}


title: lstlisting-environment not available within tabularx-environment

text: Please consider the following example. Does anyone has an idea why I cannot use the `listings`-environment within the `tabularx`-environment?               \documentclass{article}     \usepackage[ngerman]{babel}          \usepackage{tabularx}     \usepackage{listings}          \usepackage{lipsum}          \begin{document}          \newenvironment{foo}{\tabularx{\textwidth}{p{2cm}X}}{\endtabularx}     \newcommand{\M}{\textit{Mathematica }}     \newcommand{\C}[1]{\texttt{#1}}          \newcommand{\LongText}{This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text. This is a long text.}          \lipsum[1-3]          \begin{tabularx}{\textwidth}{p{2cm}X}     Whatever & \LongText \LongText \\     Something else & \LongText \LongText \\     Code & \begin{lstlisting} for i=0 do... \end{lstlisting}      \end{tabularx}               \end{document}