title: How to make a \newcommand that acts like \dim?

text: The `\dim` command is good at deciding how to space things following it: for example, both `$\dim M$` and `$\dim_A M$` look right (the subscript immediately follows the `dim`, whereas the non-subscripted version has a space before the `M`). I'd like to make a similarly-acting command `\depth`. I've been using:               \newcommand{\depth}{\textnormal{depth }}      but this forces a space, so `$\depth_A M$` doesn't look good. I tried using `\xspace` as per this question:               \newcommand{\depth}{\textnormal{depth}\xspace}      but it doesn't seem to do anything (there is no difference between using it and not, in the above command). How can I get the right behavior?


title: Labels in TikZ are incorrectly interpreted

text: I'm running into a weird problem with TikZ. The following code               \node (A) [label=45:$A$] at (p2) {};      is rendered correctly in one document, but incorrectly in another, larger document (which uses incidentally more packages, this is why I suspect some package clash. Surprisingly, the label specified by the portion of the code `45:$A$` is rendered explicitly as 45:A, rather than being interpreted as A at 45°. There is no warning or error raised. Any idea of where the problem might come from?


title: Avoid update font name database by luaotfload

text: I am using `LuaLaTeX` to typesetting documents with system fonts. Compiling needs much time to update the font database: `luaotfload | Updating the font names database:`. I think this update is not necessary, because I do not change the fonts every time. If my assumption is correct, is it possible to avoid this update? A minimal example that shows the problem:               \documentclass[paper = a4]{scrartcl}      \usepackage{blindtext, fontspec}          % Typewriter (\ttfamily)     \setmonofont[BoldFont = VeraMoBd, ItalicFont = VeraMoIt, Scale = MatchLowercase]{VeraMono}          \begin{document}     \blinddocument     \end{document}      I used different fonts set by `\setmainfont` and `\setsansfont`, but only the mono-spaced `VeraMono` hangs on updating the font names database. The free font `Bitstream Vera` is available here.


title: How can I draw this commutative diagram for function composition?

text: I am working on a project, and need to add a diagram that displays a commutative diagram illustrating basic function composition similar to what is on page 17 in the image attached. I would like to make it look a bit "nicer" for lack of a better term though. I really do not know where to even begin however. Any help is appreciated. ![enter image description here](http://i.stack.imgur.com/y6BUp.png) Here is a beginning. While I realize it is only a beginning, it is all I have been able to put together thus far. Thanks:               \documentclass[a4paper,12pt]{article}          \usepackage{tikz}     \usetikzlibrary{matrix,arrows}          \begin{document}     \begin{tikzpicture}[description/.style={fill=white,inner sep=2pt}]     \matrix (m) [matrix of math nodes, row sep=3em,     column sep=2.5em, text height=1.5ex, text depth=0.25ex]     { X & & Y \\     & V & \\ };     %\draw[double,double distance=5pt] (m-1-1) – (m-1-3);     \path[-,font=\scriptsize]     (m-1-1) edge node[auto] {$ f $} (m-1-3)     edge node[description] {$ g \circ f $} (m-2-2)     (m-1-3) edge node[auto] {$ g $} (m-2-2);     \end{tikzpicture}          \end{document}      It does not have the arrows nor the ellipses I would like, but it is a start. Thanks again for the help!


title: Custom environment using the answers package

text: I want to create a custom environment to be used with the `answers` package, something like                ...     \usepackage{answers}     \Newassociation{solu}{Soln}{ans}     \newtheorem{ex}{Ejercicio}[chapter]     \newenvironment{exer}{\begin{ex}\normalfont}{\end{ex}}          \newenvironment{\exercises}[1]{      \bigskip%     \Opensolutionfile{ans}[ans\thechapter]     ....     }{ \Closesolutionfile{ans}... }               \begin{document}          ....     \begin{exercises}               \begin{exer} blabla...1                     \begin{sol}                               blahblah 1                     \end{sol}          \end{exer}                   \begin{exer} blabla...2                     \begin{sol}                               blahblah 2                     \end{sol}          \end{exer}     \end{exercises}      ... but I can't do it. Can you help me?


title: booktabs: What is the difference between \toprule and \hline

text: The horizontal lines in `tabular` environment can be constructed. What is the difference between `\toprule`, `\midrule`, `\bottomrule` and specifying horizontal line using `\hline`?


title: multiple choice with showanswers

text: Can somebody please change these codes for `choices` so that the choices show vertically in line and not in one paragraph?               \documentclass{article}          %--------------------------------------------------------------------     \newcounter{question}     \newenvironment{questions}{%       \list{\thequestion.}%       {%         \usecounter{question}%         \def\question{\item}%         \settowidth{\leftmargin}{10.\hskip\labelsep}%         \labelwidth\leftmargin\advance\labelwidth-\labelsep       }%     }     {%       \endlist     }%                    \newcounter{choice}     \renewcommand\thechoice{\Alph{choice}}     \newcommand\choicelabel{\thechoice.}     %\makeatletter     \newenvironment{choices}%       {%         \setcounter{choice}{0}%         \def\choice{%           \refstepcounter{choice}%           \ifnum\value{choice}>1\relax             \penalty -50\hskip 1em plus 1em\relax           \fi           \choicelabel           \nobreak\enskip         }% choice                   \def\CorrectChoice{%           \choice           \addanswer{\thequestion}{\thechoice}%         }         \let\correctchoice\CorrectChoice     %    \par % Uncomment this to have choices always start a new line        % \let\par\@empty         % If we're continuing the paragraph containing the question,         % then leave a bit of space before the first choice:         \ifvmode\else\enskip\fi         \ignorespaces       }%       {}     \makeatother     \newbox\allanswers     \setbox\allanswers=\hbox{}     \newcommand{\addanswer}[2]{%       \global\setbox\allanswers=\hbox{\unhbox\allanswers \quad #1.~#2}%     }     \newcommand{\showanswers}{%       \vfill       \begin{center}         Answers       \end{center}       \unhbox\allanswers     }                    %--------------------------------------------------------------------     \begin{document}               \begin{questions}       \question What was the color of George Washington's white horse?        \begin{choices}          \choice Blue \\         \choice Yellow \\         \correctchoice White \\         \choice Black       \end{choices}       \question Which of these things doesn't fit in?       \begin{choices}         \choice John         \choice Paul          \choice George          \choice Ringo          \correctchoice Socrates       \end{choices}       \question Who's buried in Grant's tomb?       \begin{choices}         \choice Washington         \choice Mickey Mouse         \correctchoice Grant       \end{choices}     \end{questions}          \showanswers     \newpage                    \begin{questions}       \question $1+1= \mathord{?}$       \begin{choices}         \choice $0$ \choice $1$ \correctchoice $2$ \choice $3$ \choice $4$       \end{choices}       \question $\sin \frac{\pi}{2} = \mathord{?}$       \begin{choices}         \choice $0$ \correctchoice $1$ \choice $2$ \choice $\frac{\pi}{2}$       \end{choices}       \question What was the color of the bus driver's eyes?       \begin{choices}         \choice Green \choice Yellow \correctchoice Blue \choice Red       \end{choices}     \end{questions}          \showanswers          \end{document}


title: Natural deduction like proof

text: I'm not sure what the right word is for this kind of proof (in the picture): ![enter image description here](http://i.stack.imgur.com/Itv1g.jpg) It is some kind of combination of natural deduction and normal math proofs. I'm wondering how I could do this in LaTeX. I doesn't really need to look exactly like this. In the picture, I've put statement 6-11 to the right for example, but this is not really necessary. More generally I would like something as: **Given**   1\. statement   2\. statement   **Ⅰ   ** Statement to prove   3\. hypothese      4\. statement (justification)   5\. statement (justification)   **II   ** Other statement to prove   etc. etc. Any suggestion for doing something like this in LaTeX, maybe some packages that I could use ?


title: What is PostScript dictionary for? How to know whether or not I need it?

text: Consider the following code,               \documentclass[pstricks,border=12pt]{standalone}     \usepackage{pstricks-add}     \psset{linecolor=red}     \pstVerb     {         /updateCP {2 copy CPy add /CPy ED CPx add /CPx ED} bind def          /updateA  {1 sub sqrt 1 exch atan Angles add /Angles ED} bind def      }          \def\WithoutDict{%         \begin{pspicture}[showgrid](-5,-5)(5,5)         \multido{\io=1+1}{15}         {%             \pstVerb{/Angles 0 def /CPx 1 def /CPy 0 def}% reset             \def\points{(0,0)(1,0)}% reset             \multido{\ii=1+1}{\io}{\xdef\points{\points(!1 \ii\space updateA Angles PtoC updateCP)}}             \expandafter\psrline\points             \psline(!CPx CPy)         }         \end{pspicture}}          \def\WithDict{%         \begin{pspicture}[showgrid](-5,-5)(5,5)         \multido{\io=1+1}{15}         {%             \pstVerb{tx@Dict begin /Angles 0 def /CPx 1 def /CPy 0 def end}% reset             \def\points{(0,0)(1,0)}% reset             \multido{\ii=1+1}{\io}{\xdef\points{\points(!1 \ii\space updateA Angles PtoC updateCP)}}             \expandafter\psrline\points             \psline(!CPx CPy)         }         \end{pspicture}}          \begin{document}     \WithoutDict     \WithDict     \end{document}      which produces the following outputs. ![enter image description here](http://i.stack.imgur.com/yZNdu.png)![enter image description here](http://i.stack.imgur.com/jbjzz.png) ## Question `\WithoutDict` is different from `\WithDict` only in `tx@Dict` that `\WithoutDict` does not use. The use of `tx@Dic` in `\WithDict` was done by Christoph in his answer here. I really don't understand why I need it. So the question is,   1. What is PostScript dictionary for?   2. How to use it in a simple but not trivial example?   3. How do I know whether or not I need it? Hopefully the answer can be used as a crash-course tutorial.


title: Spacing in list with math environment

text: Check out the following example. I would like to write the code as in the second list, but get output equivalent to the other two. However, there is a lot of extra vertical space after the third item of the second list, and I don't know why, or what to do about it.               \documentclass{article}          \newenvironment{listitem}{\item}{}          \begin{document}          \begin{enumerate}          \item     Lorem ipsum dolor sit amet, consectetur adipiscing elit.          \item     Lorem ipsum dolor sit amet, consectetur adipiscing elit.          \item     Lorem ipsum dolor sit amet, consectetur adipiscing elit.     \[         2 + 2 = 4     \]          \item     Lorem ipsum dolor sit amet, consectetur adipiscing elit.          \end{enumerate}          \hrule          \begin{enumerate}          \begin{listitem}     Lorem ipsum dolor sit amet, consectetur adipiscing elit.     \end{listitem}          \begin{listitem}     Lorem ipsum dolor sit amet, consectetur adipiscing elit.     \end{listitem}          \begin{listitem}     Lorem ipsum dolor sit amet, consectetur adipiscing elit.     \[         2 + 2 = 4     \]     \end{listitem}          \begin{listitem}     Lorem ipsum dolor sit amet, consectetur adipiscing elit.     \end{listitem}          \end{enumerate}          \hrule          \begin{enumerate}          \begin{listitem}     Lorem ipsum dolor sit amet, consectetur adipiscing elit.     \end{listitem}          \begin{listitem}     Lorem ipsum dolor sit amet, consectetur adipiscing elit.     \end{listitem}          \begin{listitem}     Lorem ipsum dolor sit amet, consectetur adipiscing elit.     \[         2 + 2 = 4     \]     \end{listitem}     %     \begin{listitem}     Lorem ipsum dolor sit amet, consectetur adipiscing elit.     \end{listitem}          \end{enumerate}          \end{document}


title: To label Question environment

text: My minimum code               \documentclass{article}     \usepackage[framemethod=tikz]{mdframed}          \mdfdefinestyle{ans}{       linecolor=cyan,       backgroundcolor=yellow!20,         frametitlebackgroundcolor=green!40,         frametitlerule=true     }     \newenvironment{question}[1]{%         \begin{mdframed}[style=ans,frametitle={Question: #1}]     }{%         \end{mdframed}%     }%          \begin{document}     \begin{question}     \label{masi} % PROBLEM here, since label not working!     {Question body here? What is your question?}     Answer is this and this. Lorem yea.        \end{question}     \end{document}      which has developed from discussion but where label does not work. **How can you use label in a such environment?**


title: H-264 mp4 video plays on an iPhone when embedded in a PDF via Acrobat, but not via media9

text: Is there a bug in the `media9` package that causes H-264 mp4 files to embed properly and play properly on a computer, but not an iPhone? I embedded the exact same mp4 video file in Acrobat X Pro (Mac OS 10.6.8) using the video tool under Multimedia, in which case the video played perfectly in Acrobat X Pro and ezPDF Reader on the iPhone. However, when I embedded the exact same video file via media9 (testing both `VPlayer.swf` and `StrobeMediaPlayback.swf`), the file played in Acrobat, but showed up as a blank media folder icon in ezPDF Reader. Clicking on that folder threw up an error message of               Media playback failure. Can not play format.      My LaTeX2e distribution is MacTeX 2012. I am using the LaTeX engine in TeXShop.


title: Is there a distinct command for \widowpenalty and \clubpenalty in footnotes?

text: I have found that setting `\widowpenalty=10000\clubpenalty=10000` in the main document has not prevented widows and clubs from appearing occasionally in footnotes in a long and complex document I am working on. I eliminated those widows and clubs by adding the same commands to a new command for creating footnotes:               \newcommand\footy[1]      {\footnotemark{}%       \footnotetext{\widowpenalty=10000\clubpenalty=10000\relax#1}%      }      but it seems to me that this is rather wasteful since it calls the two penalty commands over and over again. Is there, instead, a pair of commands that specify widow and club penalties for footnotes, and that only need to be called once?


title: Using \clearpage breaks \hyperref bookmarks

text: From this question I have used               \usepackage{titlesec}     \newcommand{\sectionbreak}{\clearpage}      to ensure that sections start on their own page. However when using the `hyperref` package this results in the section bookmarks pointing to the end of the previous section instead of the start of the new one. Here is a MWE:               \documentclass{article}     \usepackage[pdftex]{hyperref} % Generate PDF links and bookmarks.     \hypersetup{       bookmarks=true,       bookmarksnumbered=true     }          \usepackage{titlesec}     \newcommand{\sectionbreak}{\clearpage}          \begin{document}     \section{First}     Some text          \section{Second}     More Text          \end{document}      If you use Adobe Reader or Preview on OSX and use the bookmarks you will notice that the second bookmark will be on the first page at the end of the previous section and not on the second page where the second section starts. How can I fix this?


title: Problem with special characters comments in listings package

text: I'm employing the listings package to show VHDL code in my document in a nice way, to do so, I have defined my own version of VHDL, thus:               \documentclass{article}     \usepackage{listings}     \usepackage[usenames,dvipsnames]{xcolor}     \lstdefinelanguage{VHDL}{       morekeywords=[1]{         library,use,all,entity,is,port,in,out,end,architecture,of,         begin,and,or,Not,downto,ALL       },       morekeywords=[2]{         STD_LOGIC_VECTOR,STD_LOGIC,IEEE,STD_LOGIC_1164,         NUMERIC_STD,STD_LOGIC_ARITH,STD_LOGIC_UNSIGNED,std_logic_vector,         std_logic       },       morecomment=[l]{--}     }          \colorlet{keyword}{blue!100!black!80}     \colorlet{STD}{Lavender}     \colorlet{comment}{green!80!black!90}     \lstdefinestyle{VHDL}{       language     = VHDL,       basicstyle   = \footnotesize \ttfamily,       keywordstyle = [1]\color{keyword}\bfseries,       keywordstyle = [2]\color{STD}\bfseries,       commentstyle = \color{comment}       breaklines=true,                % sets automatic line breaking       tabsize=3                                % sets default tabsize to 2 spaces     }      The output formatting is almost perfect but for the comments, where the program substitudes the white-spaces for the "breaklines" word. This code:               \begin{document}     \begin{lstlisting}[style=vhdl]          -- attribute s : string;     signal partial_from_static : std_logic_vector(3 downto 0) := (others => '1');     signal partial_to_static : std_logic_vector(3 downto 0) := (others => '1');     signal static_from_partial : std_logic_vector(3 downto 0) := (others => '1');          -- instantiation of instBusMacro     instBusMacro : BM_V5_L4_R4_single     Port Map (         RH0 => '1',     \end{lstlisting}     \end{document}      Gives this output: breaklines--breaklines breaklinesattributebreaklines breaklinessbreaklines breaklines:breaklines breaklinesstringbreaklines; signal partial_from_static : std_logic_vector (3 downto 0) := ( others => '1 '); signal partial_to_static : std_logic_vector (3 downto 0) := ( others => '1 '); signal static_from_partial : std_logic_vector (3 downto 0) := ( others => '1 '); breaklines--breaklines breaklinesinstantiationbreaklines breaklinesofbreaklines breaklinesinstBusMacro instBusMacro : BM_V5_L4_R4_single Port Map ( RH0 => '1', Both the comments and the keywords are correctly recognised, as their formatting has change accordantly, but those "breaklines" are driving me nuts. What I have learned so far: The listings package documentation says that the "other" type of characters (!,-,> and more) aren't allowed inside the comment definition, so I'm pretty sure here is the problem. It also says that in other part of the documentation is shown how to include them, but I only have been able to find how to use those characters as keywords, which I find useless for commenting. Thank you all and sorry if I made some etiquette mistake, it's my first time posting here. **Edit:** I had forgotten to put a coma in:                 commentstyle = \color{comment}       breaklines=true,      So trivial mistake, little to see here.


title: sectionname + number in header with fancyhdr

text: I want to have section name + number on the left side in the header, and a predefined text on the right side. Also want to have `subsection` / `subsubsection name + number`, if the subsection is long enough. This is what I have.               \documentclass[11pt,norsk,a4paper]{article}     \usepackage{ucs,babel}     \usepackage[utf8x]{inputenc}     \usepackage{fancyhdr}          % title and so on          \begin{document}          \pagestyle{fancy}     \renewcommand{\sectionmark}[1]{\markright{#1}{}}          \fancyhf{}          \rhead{\fancyplain{}{Prosessrapport}} % predefined ()     \lhead{\fancyplain{}{\rightmark }} % 1. sectionname, 1.1 subsection name etc     \cfoot{\fancyplain{}{\thepage}}      What I get from this, is the subsection name without number. And the subsection name + number. UPDATE:               \documentclass[11pt,norsk,a4paper]{article}     \usepackage{ucs,babel}     \usepackage[utf8x]{inputenc}     \usepackage{fancyhdr}          \title{sd}     \date{}          \begin{document}     \maketitle          \pagestyle{fancy}     \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}          \fancyhf{}          \rhead{\fancyplain{}{$<$Name of the report$>$}} % predefined ()     \lhead{\fancyplain{}{\rightmark }} % 1. sectionname, 1.1 subsection name etc     \cfoot{\fancyplain{}{\thepage}}     \newpage     \section{section}     \newpage     \subsection{subsection}     \newpage     \subsubsection{subsubsection}          \end{document}      On the last page (4), I have a subsubsection, but the header says subsection. Is there any way to make it say subsubsection?


title: Errors in tables then runaway argument at \begin{document}

text: I am new to LaTeX and keep having this re-occurring problem. I create a table and notice a mistake (incorrectly specifying the number of columns or something) because the pdf won't compile (I am using 'pdfLaTeX'). I stop the compilation and fix the table. When I try to re-run the pdf I get the error message:               Runaway argument?     {\contentsline {subsection}{\numberline {6.3}General comments o      ! File ended while scanning use of \@writefile.     <inserted text>                  \par      l.47 \begin{document}      Once this happens no matter what I do the pdf won't run and the .synctex.gz file is 'busy'. I have to copy and paste all my (corrected) code into a new TeX works file and then it re-runs fine! I suspect it has something to do with the fact that LaTeX is still thinking about the erroneous table. How can I completely break the compilation process and stop this from happening?


title: Using XeLaTeX + BiBTeX in TeXWorks

text: I'm trying to define a run configuration for using XeLaTeX with BiBTeX from within TeXWorks, but I'm coming up empty. I tried following this guide and adapt it to what I wanted to do, and ended up with this:               program: xelatex     argument: "%1.tex" && bibtex "%1" && xelatex "%1.tex" && xelatex "%1.tex"      but when I run it by hitting `Ctrl`+`T` I get the following message: > This is XeTeX, Version 3.1415926-2.3-0.9997.5 (TeX Live 2011)   >  restricted \write18 enabled.   >  entering extended mode > > * and then nothing happens. How do I configure TeXWorks to run XeLaTeX+BiBTeX+XeLaTeX+XeLaTeX when I hit "compile"? For extra credit, the run configuration should not run more times than necessary, i.e. not all four runs if no references have changed.


title: Error when combining a chain and matrix with TikZ

text: I am getting started with TikZ and would like to create complex flow chart. To get used to the package, I want to start simple. However, I already fail at making a simple chain in combination with a matrix. The code shown in the minial example below throws the error: `no shape named chain-2 is known`. Why is that? Where is my error?               \documentclass{article}          \usepackage{tikz}                       %% Create drawings in LaTeX         \usetikzlibrary{matrix,shapes,arrows,positioning,chains}          \begin{document}          \tikzstyle{block} = [rectangle, fill=blue!20, minimum height=3em, minimum width=6em, font=\footnotesize]          \begin{tikzpicture}         \matrix[row sep=1mm, column sep=2 mm] {         % Central row:             \node (p1)          []      {.};                    &             \node (stoffVor)    [block] {Stoffvorbereitung};    &             \node (p2)          []      {.};                    &             \node (haupt)       [block] {Hauptanlage};          &             \node (stoffNach)   [block] {Stoffnachbereitung};\\         };                \begin{scope}[start chain]             \chainin (p1);             \chainin (stoffvor);             \chainin (p2);           \end{scope}     \end{tikzpicture}          \end{document}


title: Contest: Show Off Your Skillz in TeX & Friends [TeX.sx birthday]

text: ### Submission Deadline and Voting are over, thank you for participating! * * * # Results ## Academic   1. Gonzalo Medina – 31   2. Andy – 19   3. cmhughes – 11   4. mbork – 6 ## Other   1. Yiannis Lazarides – 38   2. szantaii – 20   3. Ant – 15   4. Paulo Cereda – 14   5. Count Zero – 13   6. Aditya – 12   7. Andrew Stacey – 9   8. Max Lambertini – 7 The votes were counted at the end of the one week voting period, Nov. 25, 2011 14:00 UTC. Congratulations to Gonzalo and Yiannis! And a big thank you to the twelve submitters, the high number of votes and views shows that the community took great interest in your work. As for the prizes, I think we're still waiting to hear back from Stack Exchange, so you'll have to be patient, sorry `:(`. * * * ![](http://i.stack.imgur.com/KroGW.png)![](http://i.stack.imgur.com/KroGW.png) * * * And here's the contest post itself: # What's going on? TeX.sx turned one on November 11, 2011. This contest is part of our celebrations. This question doesn't meet the normal question form requirements on this site, but it is considered an exception, and was approved of on meta. # What's the task? Show off the knowledge in TeX & friends that you've gathered over the time. Include things that a more-or-less everyday document can **benefit** from. **Final number of submissions:** 12 # Any conditions my document has to fulfill?   * ## Form     * Limit your document to **a few pages** , maximally three or four. Additional pages for a title page, table of contents, an index etc. are allowed.     * All common formats (LaTeX, Plain TeX, ConTeXt) and engines (pdfTeX, XeTeX, LuaTeX) are allowed. However, the **"ingredients"** are limited to things provided on **CTAN** or otherwise **_easily_** publicly and freely **available** , so that everybody can reproduce and compile the document.     * The **source** _must_ be **included** and you agree that other users can **reuse** your code.     * **Annotate** your source extensively, so that non-expert users can understand which package and which hack does what.   * ## Contents     * Your document should mainly be **text** , but content doesn't matter -- feel free to show the most beautiful _lorem ipsum_ ever. Reuse of something you have already written earlier is fine as well.     * Academic paper-like submissions are as welcome as cooking recipes, role-playing game sheets, CVs or **anything** text-based that can be **produced with TeX & friends**. [see "Update"]     * Include whatever **visual stimuli** you can think of, e.g. figures, tables, margin notes, background pictures, drop caps / initials — but in the end, it has to **look _good_ , not cluttered**.     * Make it typographically, aesthetically and perhaps even funwise **maximally appealing**. # How do I participate?   * Post your submission, in an answer to this question and delete it immediately — in consequence, it won't be publicly visible, but the site moderators can restore it later.    * When you add a new answer, please edit the question to update the current number of submissions.   * Include 1) screenshots of your output, 2) the full compilable code, and 3) links to any additional material that needs to be downloaded. Specify if a particular compiler or compiling sequence is required. This question will be locked on Nov. 18, 14:00h UTC, so that no more answers can be added. Then all answers will be undeleted and voting starts. # Prizes? Yes, there will most likely be prizes, but it hasn't been decided yet which in particular, see Which prizes for contests?. Besides that, chances are you enjoy TeX & friends at any rate, there are the usual answer badges to win (no reputation though), and the community can benefit from contributions enormously! # Who determines the winner; who votes? ## You do! Once the submissions are visible, you can vote for all submissions that you want to support. Thus, each TeX.sx user has as many votes as there are submissions, but each submission can only get one vote from each user. Downvoting is possible but, but strongly discouraged. If you feel you have to downvote, please explain why in a comment (e.g. if a document is in HTML instead of TeX or one of its friends). You can determine what you consider a good contribution, things to consider are:   * Are above conditions met?   * Is the submissions useful for other users of TeX & friends?   * Is the source comprehensibly annotated?   * **Do you _enjoy_ the submission?** Voting ends after a week, I'll try to note down the vote counts Nov. 25 around 14h UTC, these will determine the winner, regardless of votes cast afterwards. * * * ### A note to high rep users You might be able to see the temporarily deleted submissions. You've proven trustworthy to the community in the past, so just pretend you couldn't see them. Please lock the question on Nov. 18, 14:00h UTC and undelete the answers. Rollback any edits to the contributions after this deadline. Any help in overseeing this contest is highly appreciated. * * * **Update** (per meta)   1. There is a limit of **three submissions per user**.   2. There are two **categories** : **academic** and **other**. Please indicate to which one your submission belongs. The result of the voting will be split into these categories. * * * None of this is in any way legally binding. TeX.sx and I reserve the right to change all conditions of this contest at any point as it seems reasonable to us. (We don't plan to, though.)


title: Variable box size from input text

text: How can I make a framed box such that, when spacing is added in the correct places, the box height is exactly 15 cm? Explicitly, how do I define a `\newcommand` taking in three inputs `{A}{B}{C}` and displaying a framed box with the value of `x` computed from the sizes of A, B and C from below to make the box exactly 15cm:               A     \vspace{x}     B     \vspace{x}     C      As I'm trying to learn one thing at a time, a LaTeX answer is preferred, though feel free to post other solutions!


title: Tikz-timing: using an arrow for a vertical line like G (glitch) symbol?

text: I just asked this question: Does the program counter always have to change (upon an instruction tick)? - Stack Overflow, where I used the following code:               % min-timing.tex     % pdflatex min-timing.tex                               # to obtain min-timing.pdf     % convert -density 300x min-timing.pdf min-timing.png   # to obtain min-timing.png          % \documentclass[border=0]{standalone} % incorrectly crops image - use minimal + preview     \documentclass{minimal}          % minimal doesn't have \scriptsize, \tiny:     \makeatletter     \def\scriptsize{\@setfontsize{\scriptsize}{7}{8pt}}     \def\tiny{\@setfontsize{\tiny}{5}{6pt}}     \def\ttiny{\@setfontsize{\ttiny}{4}{5pt}}     \makeatother          \usepackage{tikz}     \usetikzlibrary{arrows,chains,matrix,positioning,scopes,snakes,decorations.markings}     \usepackage{tikz-timing}     \usetikztiminglibrary[rising arrows]{clockarrows}     \usetikztiminglibrary{advnodes}          \usepackage[graphics,tightpage,active]{preview}     \PreviewEnvironment{tikzpicture}     \newlength{\imagewidth}     \newlength{\imagescale}          \usepackage{helvet}          \begin{document}               \begin{tikztimingtable}[%         timing/nodes/advanced,         timing/dslope=0.1,         timing/name/.style={font=\sffamily\scriptsize},         timing/d/text/.style={font=\sffamily\ttiny},       ]       %       % start timing diagram       %       \textcolor{black}{Instruction} & [black]         Z 2D{push}    4D{mov}     4D{sub}     4D{movl}    4D{mov}     2D{leave}   2D{ret}     2D{...} \\ %       \textcolor{black}{PC Address} & [black]         Z 2D{8048394} 4D{8048395} 4D{8048397} 4D{804839a} 4D{80483a1} 2D{80483a4} 2D{80483a5} 2D{...} \\ %       \textcolor{red}{Instruction tick} & [red]         S G 2{S}      G 4{S}      G 4{S}      G 4{S}      G 4{S}      G 2{S}      G 2{S}      G 2{S}  \\ %       \textcolor{brown}{Clock} & [brown]         Z 2{C}        4{C}        4{C}        4{C}        4{C}        2{C}        2{C}        2{C}    \\ %       %       % end timing diagram       %       % there must NOT be an uncommented line before \extracode!       %     \extracode       \tablerules       \tablegrid     \end{tikztimingtable}          \end{document}      ... to obtain this image: ![min-timing.png](http://i.stack.imgur.com/jAK7Y.png) I was wandering - (how) is it possible to have the G (glitch) symbols in "Instruction tick" be rendered as an "up arrow", like the rising clock edge?


title: Automatic width of floats

text: I need to automatically compute the width of tables and graphics; including the total width of a graphic that contains subfigures. I would also like the code to include a minimum width parameter to be used in case the tables or figures are narrow. I appreciate any assistance provided by members. I added a minimal working example below. Martin, I would like to see the code you mentioned. Thank you to all who replied.               \documentclass{article}     \usepackage[demo]{graphicx}     \usepackage{subfig}     \newlength{\floatwidth} % The code should determine this value     \newenvironment{mytext}%          environment name         {\newline\hspace*{-.15in}\begin{minipage}{\floatwidth}\textbf{mytext: }\begin{itshape}}% begin code         {\end{itshape}\end{minipage}}     \begin{document}     \setlength{\floatwidth}{4.4in}     \begin{figure}[tbp]         \begin{center}             \caption{Figure Caption}             \subfloat[First figure]{\label{fig:firstfig}\includegraphics{figure1}} \qquad             \subfloat[Second figure]{\label{fig:secondfig}\includegraphics{figure2}}             \begin{mytext}                 Acceptable! The text in this environment is left justified on the left side of the left-most figure. If the text is long enough, it should wrap at the right side of the right-most figure.             \end{mytext}         \end{center}     \end{figure}     \end{document}


title: biblatex: Different formatting for citations v. bibliography

text: I'm using the `authoryear` style, and am obliged to format the authors' names as normal text at the point of citation, but in small caps in the bibliography. Here's my first, simpleton's MWE:               \documentclass[a4paper,12pt,oneside]{memoir}     % ----------------------------------------------------------     \usepackage[%         style=authoryear,         bibstyle=authoryear,         firstinits=true,         backend=biber,     ]{biblatex}     % ----------------------------------------------------------     \renewcommand*{\mkbibnamelast}[1]{\textsc{#1}}     \renewcommand*{\mkbibnameprefix}[1]{\textsc{#1}}     % ----------------------------------------------------------     \addbibresource{biblatex-nature.bib}     \addbibresource{caliente-bib.bib}     \nocite{*}     % ----------------------------------------------------------     \begin{document}          \parencite{AkcelikBirosGhattasLongVanBloemenWaanders2003}          % ==========================================================     \raggedright     \printbibliography     \end{document}      Now, that half works; the author names in the bibliography are in small caps, but, unfortunately, so is the citation in the text (rendered approximately): > (AKCELIK, BIROS, GHATTAS, et al. 2003) Am I tinkering in the right place? Is there some simple way I can test, in `\mkbibxxx`, whether I'm in the text or in the bibliography? Should I look elsewhere? Can I hope for a "simple" solution?? Environment: TeXLive 2011+, latexmk, biblatex 2011/07/29 v1.6, biber 0.9.5 `caliente-bib.bib` is here. I don't remember why I used this...


title: Appendix Numbering

text: I am using this piece of code so that my chapters appear as Chapter One instead of Chapter 1               \makeatletter     \patchcmd{\@makeschapterhead}{\thechapter}{\Numberstring{chapter}}{}{}     \patchcmd{\chaptermark}{\thechapter}{\NUMBERstring{chapter}}{}{}     \makeatother      It is working very well for the numbered chapters. The problem is, even my appendix is titled as Appendix One. Is there a way I can leave the numbered chapters as Chapter One, Chapter Two etc, but have the appendix numbered as Appendix A, Appendix B etc?


title: Preprocessing Latex: What is your workflow? Your tools?

text: I know, for various reason, some users preprocess their latex file using `Perl` or `sed`, say. I'm considering doing this to, so I would like to seek your guidance, to smooth my entry in this area. My use case is a simple macro expansion preprocessing               If $\ep$ is small...   -->  If $\epsilon$ is small...      So that a compilation session becomes               doc.tex  --preprocessor-->  post.tex  --pdftex--> post.pdf      And the following issues arise   1. There is generally a mismatch between line numbers in `doc.tex` and `post.tex`. So that `pdftex` error messages points to a line in `post.tex`. But, really, one wants the line number in `doc.tex`.    2. The same for `synctex`. Backward and foward search are with respect to `post.tex`. But, one really wants them to be with respect to `doc.tex`.   3. Sometimes, one wants to go back and forth from `doc.tex` and `post.tex`. The `preprocessor` knows the corresponds between lines of the two documents. But then, how to put this knowledge in a workable way. I mean, text editors does not have out-of-the-box support for these backward-forward trips. So, do you know some software, workflow or technics which will flatten (1)-(3)? I look around, but I could only find example of `Perl` or `sed` preprocessing scripts. I never saw the question of the workflow discuss somewhere. **EDIT** The line mismatch can originate from _big_ expansion               A function is continuous if         \multiline_continuity_definition_I_often_use     Hence ...       where the definition is expanded to               \begin{description}             \item[Standard]              $\forall \epsilon ... $              \item[Nonstandard]             $x \approx y ... $          \end{description}      **Edit 2** The point of this question is to discuss preprocessing technics. My examples are very simplistic, but I hope they catch the main challenge of a preprocessing session.


title: How to single label a point in pgfplots with text?

text: This seems like it should be straightforward but I'm new to using pgfplots. I have been using this awesome box plot code and would like to be able to add a single point How can I make:               \addplot[color = black, mark = *, nodes near coords,every node near coord/.style={anchor=180}]coordinates {( 0, -1)};      Label with a text label (say `mylabel`) rather than the value (-1) which is displayed? The total code is (combined with box plotting code):               \begin{filecontents}{testdata.dat}     %x whiskerbottom boxbottom median boxtop whiskertop       0  -0.573413   -0.528268   -0.641948 -0.483655 -0.794368        \end{filecontents}          \begin{tikzpicture}     \begin{axis} [         xtick={0},         xticklabels=test,          box plot width=10mm]          \boxplot [black]{testdata.dat}     %I've modified things to get to this point but cannot seem to figure out how to add a text label to it     \addplot[color = black, mark = *, nodes near coords,every node near coord/.style={anchor=180}]coordinates {( 0, -1)};          \end{axis}     \end{tikzpicture}


title: Adjust markeredge style independent of line style in pgfplots

text: I'm struggling to get a NICE line plot with a dashed line and markers at the moment. I boiled it down in the following bit of code. There it seems that the line style (dashed) is used for the markeredge line style, which is not what I want. Does anyone know a way around that? It looks quite messy when using "filled" markers.               \documentclass{article}     \usepackage{pgfplots}     \pgfplotsset{compat=1.9}     \begin{document}     \begin{figure}     \centering     \begin{tikzpicture}       \begin{axis}[           xlabel={$xlabel$},           ylabel={ylabel},           clip mode=individual,           xmin=0.4, xmax=4.1,           ymin=0.001, ymax=0.2,           axis on top,           width=12cm,           height=12cm,           ]           \addplot [thick,dashed, blue, mark=o, mark size=5, mark options={rotate=180}]           coordinates {           (0.5,0.050434357296103)           (1,0.0078648549533149)           (1.5,0.0106056739726252)           (2,0.0693259848345091)           (2.5,0.0521069487623915)           (3,0.0870245544201076)           (4,0.121893601793102)           };           \addplot [thick,dashed, green, mark=*, mark size=5]           coordinates {           (0.5,0.12)           (1,0.15)           (3,0.18)           };                 \end{axis}     \end{tikzpicture}     \end{figure}     \end{document}


title: Nodes near coord overlapping...how to shift up

text: ![enter image description here](http://i.stack.imgur.com/GCbJb.jpg) I am using nodes near coords but as you can see the values on the bottom are overlapping. I have tried placing them manually but that hasn't worked either...How to just shift up the nodes so they do not overlap with eachother or the line!? Thank you!!!!!               \documentclass{article}     \usepackage{pgfplots}     \usetikzlibrary{decorations.markings}     \begin{document}                    \begin{tikzpicture}              \begin{axis}[     compat=newest,      height=0.4\textheight,     enlarge y limits={upper, value=0.3},     ymin=0,     xtick=data,     xtick={\empty},     ytick=data,     enlarge x limits = 0.5,     bar width=24pt,     title={},     symbolic x coords={0,5},     y axis line style={opacity=0},     yticklabels={\empty},     ytick style={draw=none},     axis on top,     major grid style=white,     nodes near coords             ]          \addplot [red, line width=2pt]coordinates {(0,.1) (5,.83)};     \addplot [blue, line width=2pt]coordinates {(0,.12) (5,2.4)};     \end{axis}     \end{tikzpicture}     \end{document}


title: Hooking in before \documentclass

text: In the consequence of a previously asked question (Is it possible to hook in after options have been processed in a certain package or class?) I had the idea of a hook that adds code even before `\documentclass` is called. So sticking to the technique presented in the mentioned post one could try               \let\savedDC\documentclass     \renewcommand{\documentclass}[2][]{%       \typeout{my stuff here}       \savedDC[#1]{#2}     }      Or directly in Form of a hook macro:               \newcommand{\BeforeDocumentclass}[1]{%     \renewcommand{\documentclass}[2][]{%       #1       \savedDC[##1]{##2}     }}      Assuming these definitions were made after using `\documentclass` (Otherwise no hook is needed), this will fail due to the fact that they will have no actual effect on the use of `\documentclass`. Or in short: To define a hook that puts stuff before `\documentclass` you need just exactly the same hook. Is there a way/procedure to get rid of this recursivity? **Summerizing Edit:** From the comments arise two possible ways. 1) The `filecontents` package: From the docu I understood that the usage must be exactly the same as the "old" filecontents environment; i.e. it writes something into an external file which can be retrieved through `input`. Til yet I dont get how to write a macro that invoces the `input` command in order to get the desired result. [Per memoriam: I try to figure out with this question how to write a macro like `\BeforeDocumentclass{<sth>}` or `\begin{beforedocumentclass} <sth> \end{beforedocumentclass}`] that moves the code before documentclass or maybe to the very beginning.               <sth>     \documentclass{someclass}     ...     \BeforeDocumentclass{<sth>}     ...      ] 2) The `initex` mechanism: By using google I just found out that it is (somehow?) a alternative compiler; nowadays accessable through the -ini- option. But I could not find out how it does actually work. If anyone has a link to a documentation or anything similar, i would be very grateful.


title: How to put label and voltage on same object in CircuiTikZ?

text: If I type the following code there is no problem:               \begin{circuitikz}[american]     \draw (0,0) to[R, l^=$R_4$, v=$V_1^+$, -*] (0,2) --(0,4);     \end{circuitikz}      But the polarity is not the one I need. And also I would like to change the position of the voltage and the label. If I type the following code, there's an error               \begin{circuitikz}[american]     \draw (0,0) to[R,  l^=$R_4$, v_>=$V_1^+$, -*] (0,2) --(0,4);     \end{circuitikz}      **Errors:**               ! Argument of \language@active@arg> has an extra }.<inserted text>\par                                                        (0,0) to[R, l^=$R_4$, v_>=$V_1^+$, -] (0,2)          !  Paragraph ended before \language@active@arg> was complete.<to be read again>\ par                                                        (0,0) to[R, l^=$R_4$, v_>=$V_1^+$, -] (0,2)          ! Missing \endcsname inserted.<to be read again> \advance l.12 (0,0) to[R, l^=$R_4$,                                                                    v_>=$V_1^+$, -*] (0,2) --(0,4)          ! Package pgfkeys Error: I do not know the key '/tikz/circuitikz/v_\advance \pa     r@deathcycles \@ne ' and I am going to ignore it. Perhaps you misspelled it.     See the pgfkeys package documentation for explanation.      Why does this happen only when I change the voltage configuration? By the way this is the complete code of the circuit I'm doing.               \documentclass{article}         \usepackage{latexsym,amsmath,amssymb,amsfonts,cancel}        \usepackage[latin1,utf8]{inputenc}           \usepackage[T1]{fontenc}     \usepackage[spanish]{babel}                   \usepackage{pstricks}                        \usepackage{tikz}     \usetikzlibrary{calc}     \usepackage{circuitikz}     \usepackage{siunitx}     \usepackage{setspace}     \usepackage[rflt]{floatflt}          \begin{document}         \begin{circuitikz}[american]       \draw (0,0) node[ground]{}       (1.2,4.5) node[op amp] {}       (0,2) to[R, l^=$R_4$, v=$V_1^+$, *-] (0,0)       (0,2)--(0,4)        (2.5,2) to[R, l^=$R_3$, i=$i_1$] (0,2)       (2.5,2) to[short, *-](2.5,3.5)       (2.5,3.5) to[R, l^=$R_2$, -*] (4.7,3.5)       (4.7,3.5) to[R, l^=$R_1$] (6.7,3.5)       (6.7,4.5) to[short, -*, i=$i _o$] (6.7,3.5)       (2.2,4.5) to[short, -o] (7.5,4.5)        (3.5,2) node[op amp,xscale=-1] {}       (4.7,1.5) node[ground]{}       (4.7,2.5) --(4.7,3.5)       (0,5) node[ocirc] {}       {[ anchor=east] (0,5) node {$V_i$}}       {[ anchor=west] (7.5,4.5) node {$V_o$}}       {[ anchor=north] (2.5,2) node {$V_o^\prime$}};           \end{circuitikz}      \end{document}       ![what I needed to do](http://i.stack.imgur.com/LWhf2.png)


title: Tikz: drawing a straight line down in a rotated scope

text: I would like to draw a straight line down from `(P)` to `y = -2cm`. I tried issuing `\draw[rotate = -45, xshift = 0.1cm, >=stealth, |<->|] (P) -- +(0, -1cm);` but this doesn't cancel the initial rotation.               \documentclass[tikz]{standalone}     \begin{document}     \begin{tikzpicture}     \begin{scope}[rotate = 45]       \draw (-0.5cm, -1cm) rectangle (0.5cm, -2cm) coordinate (P);     \end{scope}     \end{tikzpicture}     \end{document}      **Edit:** In my initial workings, I used `(0.5cm, -2cm)` and not the label `(P)`. The coordinate values produce a different result and resulted in a new question: Tikz: rotating point coordinates over a labelled coordinate


title: How to Change tabsize in tabbing-enviroment?

text: I did a lot of Google searches, but I did not found any ideas how to change the tabsize (~~ the indent) for a tab in the tabbing-environment. I think the indent is set to around 4 characters. But how can I minimize it?


title: Brace spanning multiple rows in a table and horizontal alignment

text: I'm a beginner trying to do an brace inside a table, that is spanning multiple rows. I assume the best way to achieve this is to do a two-row tabular environment, with an array environment for the lower line inside a multiple row. My code for doing this would be:               \begin{tabular}{ l c r }     $T=0$ & $T=1$ & $T=2$ \\     $-1$ & \multicolumn{2}{l}{$\left\{      \begin{array}{l l}     0 & R\\     1 & 0 \\     \end{array} \right.$} \\     \end{tabular}      Now, the result doesn't quite look like what I want, in the sense that the last column of the array block is not aligned with the last column of the table ( the `$T=2$`...). I could always push those a little bit left using `~~~`, but is there an easier, more elegant way to have a similar result?


title: Retrieve a table with a Macro

text: I would like to retrieve a table with a Command which is using an new environment including a table.   So basically something like:               \begin{measurtab}{Test 2110}     \value{0.0}{0.0}     \end{measuretab}        should bring up something like this:   ![measuretab](http://i.stack.imgur.com/3cXwf.png) I have tried to do the following as a minimum example but I am struggling with the number of arguments and how to use counters properly. I am no TeXpert so I hope you can help me with what I am doing wrong.               \documentclass{scrreprt}           \usepackage[T1]{fontenc}          \usepackage[utf8]{inputenc}          \usepackage{babel}          \usepackage{amsmath, amsfonts, amssymb, enumerate, verbatim, scrpage2, xcolor, array, graphicx, tabularx, wrapfig, booktabs}               \newcounter{measureNo}     \setcounter{measureNo}{1}       \newcommand\messwert[1][\stepcounter{MessNr}]{\theMessNr & lol & lol}          \newenvironment{measuretab}[3]       {\begin{tabularx}{|c|r|r|}       \hline                               \multicolumn{3}{c}{THE TITLE}\\       \hline       \# & Zeit [ms] & Geschwindigkeit [\nicefrac{m}{s}]\\       \hline       }     {\end{tabularx}}          \begin{document}          \begin{measurtab}{Test 2110}     \value{0.0}{0.0}     \end{measuretab}          \end{document}


title: New line in math mode and indent this line

text: How can I have a indented new line in math mode? The line after `\newindentedline` should be indented and start in a new line.               \[         X \subset Y \Rightarrow \forall x \in X: x \in Y \newindentedline             \Rightwarrow X \subset Y     \]


title: Specifying level 2 style for a tree in Tikz

text: The idea is to produce the org charts automatically by application code reading a database and calculating the node counts and sizes based on the names of teammates and their hierarchy. After reading the PGF manual pp. 319-220, I devised the below MWE in order to draw a sample static org chart:               \documentclass[10pt,landscape,ansibpaper]{article}     \usepackage{tikz}          \usepackage{geometry}     \geometry{         left=2em,         right=2em,         top=2em,         bottom=2em,     }          \usetikzlibrary{trees}     \tikzstyle{every node}=[draw=black, thin, minimum height=3em]          \begin{document}     \footnotesize     \begin{tikzpicture}[         supervisor/.style={%             text centered, text width=12em,             text=black         },         teammate/.style={%             text centered, text width=12em,             text=black         },         subordinate/.style={%             grow=down,             xshift=-3.2em, % Horizontal position of the child node             text centered, text width=12em,             edge from parent path={(\tikzparentnode.205) |- (\tikzchildnode.west)}         },         level1/.style ={level distance=4em,anchor=west},         level2/.style ={level distance=8em,anchor=west},         level3/.style ={level distance=12em,anchor=west},         level4/.style ={level distance=16em,anchor=west},         level 1/.style={edge from parent fork down,sibling distance=14em,level distance=5em}     %   level 2/.style={edge from parent fork down,sibling distance=28em,level distance=5em}     ]         \node[anchor=south,supervisor](super){Supervisor\\Supervisory position\\Location}[]         child{node [teammate] {Teammate6\\Position4\\Location4}             child{node [teammate] {Teammate61\\Position4\\Location4}                 child[subordinate,level1] {node {Subordinate161}}                 child[subordinate,level2] {node {Subordinate261}}}             child{node [teammate] {Teammate62\\Position4\\Location4}                 child[subordinate,level1] {node {Subordinate162}}                 child[subordinate,level2] {node {Subordinate262}}}               child{node [teammate] {Teammate62\\Position4\\Location4}                 child[subordinate,level1] {node {Subordinate162}}                 child[subordinate,level2] {node {Subordinate262}}}           }         child{node [teammate] {Teammate7\\Position5\\Location5}             child{node [teammate] {Teammate7\\Position5\\Location5}                 child[subordinate,level1] {node {First\\Subordinate}}                 child[subordinate,level2] {node {Subordinate2}}                 child[subordinate,level3] {node {Third\\Teammate}}                 child[subordinate,level4] {node {Longtext-\\teammate}}}             child{node [teammate] {Teammate7\\Position5\\Location5}                 child[subordinate,level1] {node {First\\Subordinate}}                 child[subordinate,level2] {node {Subordinate2}}                 child[subordinate,level3] {node {Third\\Teammate}}                 child[subordinate,level4] {node {Longtext-\\teammate}}}         };          \end{tikzpicture}          \end{document}      The output is (quite understandably) garbled: ![enter image description here](http://i.stack.imgur.com/0s2HA.png) I thought that uncommenting the `level 2` line would fix that, but it made the matters even worse: ![enter image description here](http://i.stack.imgur.com/bl53S.png) What am I doing wrong here?


title: Conflict between subfiles, bm and newtxtext

text: I have a document made up of many sub-documents. These documents can be compiled separately using LaTeX and the `subfiles` package but not when I use both `newtxtext` and `bm` as well. How can I overcome this? For example, file `main.tex`:               \documentclass{report}     \usepackage{newtxtext}     \usepackage{newtxmath}     \usepackage{bm}     \usepackage{subfiles}     \begin{document}     \subfile{sub1}     \end{document}      File `sub1.tex` in the same directory:               \documentclass[main]{subfiles}     \begin{document}     $\bm{x}$     \end{document}      The main file compiles without a problem, but trying to compile sub1 by itself reports an error but only when `newtxtext` is included. The log file tells me               Runaway argument?     {document}\ifx \reserved@a \@currenvir \else \@badend {document}\fi  \clearpage      \ETC.     ! File ended while scanning use of \reserved@a.     <inserted text>                      \par      <*> \input sub1.tex          I suspect you have forgotten a `}', causing me     to read past where you wanted me to stop.     I'll try to recover; but if the error is serious,     you'd better type `E' or `X' now and fix your file.          ! Emergency stop.     <*> \input sub1.tex          *** (job aborted, no legal \end found)      Adding a paragraph break between `$\bm{x}$` and the `\end{document}` gives the message               ! Paragraph ended before \bm@test@token was complete.      Searching for this message brings up the question Package incompatibilites: etoolbox, hyperref, and bm, standalone?. Could this be a similar problem? Adding `\listfiles` gives                *File List*        report.cls    2005/09/16 v1.4f Standard LaTeX document class        size10.clo    2005/09/16 v1.4f Standard LaTeX file (size option)     newtxtext.sty    2014/04/26 v1.27      fontaxes.sty    2014/03/23 v1.0d Font selection axes       xkeyval.sty    2006/11/18 v2.5f package option processing (HA)       xkeyval.tex    2006/11/18 v2.5f key=value parser (HA)      etoolbox.sty    2011/01/03 v2.1 e-TeX tools for LaTeX          etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)       fontenc.sty         t1enc.def    2005/09/27 v1.99g Standard LaTeX file      textcomp.sty    2005/09/27 v1.99g Standard LaTeX package        ts1enc.def    2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file     newtxmath.sty    2014/04/26 v1.27       amsmath.sty    2000/07/18 v2.13 AMS math features       amstext.sty    2000/06/29 v2.01        amsgen.sty    1999/11/30 v2.0        amsbsy.sty    1999/11/29 v1.2d        amsopn.sty    1999/12/14 v2.01 operator names       ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional      ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)        binhex.tex            bm.sty    2004/02/26 v1.1c Bold Symbol Support (DPC/FMi)      subfiles.sty    2012/05/23 Federico Garcia      verbatim.sty    2003/08/22 v1.5q LaTeX2e package for verbatim enhancements      omlntxmi.fd    2012/03/22 Fontinst v1.933 font definitions for OML/ntxmi.      omsntxsy.fd    2012/11/14 Fontinst v1.933 font definitions for OMS/ntxsy.       untxexa.fd    2012/04/16 Fontinst v1.933 font definitions for U/ntxexa.        ts1cmr.fd    1999/05/25 v2.5h Standard LaTeX font definitions       t1ntxrx.fd    2012/12/25 v1.0         sub1.tex       untxmia.fd    2012/04/16 Fontinst v1.933 font definitions for U/ntxmia.       untxsya.fd    2012/04/12 Fontinst v1.933 font definitions for U/ntxsya.       untxsyb.fd    2012/04/12 Fontinst v1.933 font definitions for U/ntxsyb.       untxsyc.fd    2012/04/12 Fontinst v1.933 font definitions for U/ntxsyc.       ***********      After installing the latest TeX Live and removing my previously installed packages, the error remains and the log file gives                *File List*      report.cls    2007/10/19 v1.4h Standard LaTeX document class      size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)     newtxtext.sty    2014/04/07 v1.25     fontaxes.sty    2014/03/23 v1.0d Font selection axes     xkeyval.sty    2012/10/14 v2.6b package option processing (HA)      xkeyval.tex    2012/10/14 v2.6b key=value parser (HA)     etoolbox.sty    2011/01/03 v2.1 e-TeX tools for LaTeX         etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)      fontenc.sty       t1enc.def    2005/09/27 v1.99g Standard LaTeX file     textcomp.sty    2005/09/27 v1.99g Standard LaTeX package       ts1enc.def    2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file     newtxmath.sty    2014/04/07 v1.25      amsmath.sty    2013/01/14 v2.14 AMS math features      amstext.sty    2000/06/29 v2.01       amsgen.sty    1999/11/30 v2.0       amsbsy.sty    1999/11/29 v1.2d       amsopn.sty    1999/12/14 v2.01 operator names      ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional     ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)       binhex.tex           bm.sty    2004/02/26 v1.1c Bold Symbol Support (DPC/FMi)     subfiles.sty    2012/05/23 Federico Garcia     verbatim.sty    2003/08/22 v1.5q LaTeX2e package for verbatim enhancements     omlntxmi.fd    2012/03/22 Fontinst v1.933 font definitions for OML/ntxmi.     omsntxsy.fd    2012/11/14 Fontinst v1.933 font definitions for OMS/ntxsy.      untxexa.fd    2012/04/16 Fontinst v1.933 font definitions for U/ntxexa.       ts1cmr.fd    1999/05/25 v2.5h Standard LaTeX font definitions      t1ntxrx.fd    2012/12/25 v1.0         sub1.tex      untxmia.fd    2012/04/16 Fontinst v1.933 font definitions for U/ntxmia.      untxsya.fd    2012/04/12 Fontinst v1.933 font definitions for U/ntxsya.      untxsyb.fd    2012/04/12 Fontinst v1.933 font definitions for U/ntxsyb.      untxsyc.fd    2012/04/12 Fontinst v1.933 font definitions for U/ntxsyc.      ***********      Inspired by the question Package incompatibilites: etoolbox, hyperref, and bm, standalone?, in `etoolbox.sty` I commented out               \patchcmd\enddocument       {\deadcycles}       {\let\AfterEndDocument\@firstofone        \@afterenddocumenthook        \deadcycles}       {}       {\let\etb@@end\@@end        \def\@@end{%          \let\AfterEndDocument\@firstofone          \@afterenddocumenthook          \etb@@end}}     {<environment>}{<code>}      This allows `sub1.tex` to be compiled on its own without error. This suggests that there is a conflict of the type described in the linked question.


title: Lecture Notes in Computer Science (LNCS) - Springer, can't see \authorrunning and \titlerunning

text: I almost finished TeXing out my Springer's article but have problems with `\authorrunning` and `\titlerunning` using `llncs`. I downloaded this: ftp://ftp.springer.de/pub/tex/latex/llncs/latex2e/llncs2e.zip and followed the example to create my own article. But, don't know why, I can't see authors and title at the top of every page of my article. Here's a MWE, I just cut my article content, still - it "does not work". Take a look:               \documentclass{llncs}          \usepackage{makeidx}                         \usepackage{floatrow}                        \usepackage{fancyhdr}                             \captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}     \floatsetup[table]{capposition=top}     \floatsetup[figure]{capposition=bottom}     \newcommand{\keywords}[1]{\par\addvspace\baselineskip     \noindent\keywordname\enspace\ignorespaces#1}               \pagestyle{fancy}     \makeatletter     \let\runauthor\@author     \let\runtitle\@title     \makeatother     \lhead{\runauthor}     \rhead{\runtitle}          \begin{document}     \frontmatter                                         \pagestyle{headings}                              \mainmatter                                           \title{my title}     \titlerunning{my title}          \author{author1 name\inst{1} and  author2 name\inst{1,2}}     \authorrunning{author1 name}          \institute{University 1 \\     \email{email1@gmail.com}     \and     University 2 \\     \email{email2@gmail.com}     }          \maketitle                      \begin{abstract}     ....     \end{abstract}          \section{Introduction}     ...     \newpage          \section{Introduction}     ...     \newpage          \section{Introduction}     ...     \newpage          \end{document}


title: Acceptable use cases for xspace; When will it fail?

text: I have used `xspace` for a long time to take care of adding space after usage of some macros. Usually, it is with a macro to format a word consistently, as in:               \documentclass[]{article}     \usepackage{xspace}     \begin{document}     \newcommand{\matlab}{\textsc{matlab}\xspace}     \newcommand{\enterprise}{\emph{USS Enterprise\nocorr}\xspace}     For me, \matlab is the best; I like to program in \matlab.          The \enterprise was a famous ship.     \end{document}      In a recent question, I made the comment that > _The`xspace` package is very nice to avoid the need for `{}` at every use of > a macro defined in such a manner._ It was replied to me that > _Many people say so, but the author of xspace isn't so sure:_ Drawbacks of > xspace The conclusion at the referenced post is "if you find it useful, fine, it's there. But personally I _[David Carlisle, original author of`xspace`]_ wouldn't recommend it." Yet, an answer not too long after by egreg seems to use `xspace` without hesitation, recommending it implicitly in the use of simple macros, e.g.:               \usepackage{xspace}          \newcommand{\Poincare}{Poincar\'e\xspace}     \newcommand{\adele}{ad\`ele\xspace}     \newcommand{\Cech}{\v{C}ech\xspace}     \newcommand{\Erdos}{Erd\H{o}s\xspace}     \makeatletter     \newcommand{\etale}{\'etal\@ifstar{\'e}{e\xspace}}     \makeatother      So, my questions come down to these three:   1. Are there any acceptable (non-controversial) use cases for `xspace`? (perhaps the case as shown above from egreg, similar to my original example?)   2. What types of cases might the use of `xspace` actually cause problems? (Is it just things like the italic correction of the `\enterprise` example above?)   3. If problems in spacing are caused via a macro, will `xspace` fail in the same way with every use of that macro, or will it be dependent on the context where the macro is used?


title: Whitespace problems with DVIPNG with LaTeX

text: I am trying to use LaTeX to output DVI files, then use DVIPNG to make images for, say, a website. The problem is when I take something like this:               \documentclass{article}     \pagestyle{empty}     \begin{document}     Hello World     \end{document}      and run LaTex on it, then run DVIPNG on the resultant DVI file, I get an image with lots of whitespace to the left and above the text. I have two questions: One, how do I remove the whitespace to the left and about the "Hello World"? And two, how do I make the text larger? I have done this before correctly, I just don't remember how.


title: How to translate and rotate the heading of landscaped pages?

text: # Objective _**How to change the heading of landscaped pages from_** ![alt text](http://i.stack.imgur.com/vYydq.png) _**to_** ![alt text](http://i.stack.imgur.com/0rLMU.png) _**?_** # Minimal Code               \documentclass{book}     \usepackage[a5paper,hmargin=3cm,vmargin=5cm]{geometry}     \usepackage{lscape,lipsum}          \begin{document}     \chapter{One}     \lipsum[1]          \section{One One}     \lipsum[2]          \newgeometry{hmargin=5cm,vmargin=3cm}          \begin{landscape}     \lipsum[3-5]     \end{landscape}          \restoregeometry     \lipsum[6]          \end{document}      # Edit 1 (my real scenario layout) In my real scenario, the left-right margins should not be occupied by headings. ![alt text](http://i.stack.imgur.com/BIMZ0.png)


title: How to adjust or remove page numbers on a landscape page within a portrait document?

text: > **Possible Duplicate:**   >  How to translate and rotate the heading of landscaped pages? I have a document that is typset in portrait, using the article class, that contains a single landscape page (to accommodate a large table). I want to have the page numbers in the center of the footer for every page, so I'm using `\pagestyle{plain}`. However, when I use the `\usepackage{pdflscape}` package and `\begin{landscape}`, the page number is on the left side, in the center, which is directly overlapping my table. I guess `pdflscape` only rotates the contents, not the page numbers. I need this page number in the same place as the others: at the bottom of the page in the center. Using `\thispagestyle{plain}` or `\thispagestyle{headings}` doesn't change it all either.


title: Rotate one whole page 90degrees in a document including header and footer created with fancyhdr

text: > **Possible Duplicate:**   >  How to translate and rotate the heading of landscaped pages? I have a thesis with header+footer on each page created using the `fancyhdr` package. On one page I have an oversized table which is rotated using the `lscape` package. How can the header and footer for this page only also be rotated such that they are the same direction as the table? MWE below.               \documentclass[a4paper,12pt,twoside]{book}     \usepackage{pdflscape}     \usepackage{fancyhdr}          \fancyhf{}     \pagestyle{fancy}      \fancyhead[CO,CE]{This is my heading}     \fancyfoot[LE,RO]{This if my footer: \thepage}          \begin{document}          \begin{landscape}         \centering         \begin{table}             \begin{tabular}{ll}                     1 & 2 \\                     3 & 4 \\             \end{tabular}         \end{table}     \end{landscape}          \end{document}


title: Using Hebrew in TexWorks

text: I'd like to write proofs in Hebrew with TeXWorks on Ubuntu 10.4. I'm completely new to LaTeX ... I have Hebrew support installed, but I'm not sure how to proceed regarding writing Hebrew mixed with math equations in TeXWorks. Is there any special setup which needs to be done?


title: Make page numbers distinct in index produced by bibleref package

text: I'm using the the `bibleref` package, along with the `attrib`, `verse`, and `multind` packages, to cite verses from the bible and produce an index at the end of the document with the verse list and corresponding page numbers. Here is an MWE:               \documentclass[11pt,a4paper]{article}     \usepackage[T1]{fontenc}          % Quoting Bible passages     \usepackage{attrib}     \def\PreTrib{} \def\PostTrib{} % We'll do our own parens, thanks!     \usepackage{verse}     \usepackage{bibleref}     % Custom macros     \def\V#1 {\(^{#1}\)}     \def\vattrib#1#2{\attrib{(\ibibleverse{#1}#2)}}          % Indexing of Bible verse citations      \usepackage{multind}     \makeindex{scripture}     \renewcommand{\biblerefindex}{\index{scripture}}     \biblerefstyle{default}     \begin{document}          \begin{verse}     \V{4} Thy father made our yoke grievous: now therefore ease thou somewhat the grievous servitude of thy father, and his heavy yoke that he put upon us, and we will serve thee. \vattrib{IIChronicles}{(10:4)}     \end{verse}          \clearpage                  \begin{verse}             \V{1} In the beginning God created the heaven and the earth. \vattrib{Genesis}{(1:1)}             \end{verse}          \clearpage          \printindex{scripture}{Index of Scripture References}          \end{document}      The problem is that the index (shown below) produced by the above code puts the page numbers mighty close to the verse citations, and only separated by a comma, so that is almost looks like the page numbers are part of the citations. ![enter image description here](http://i.stack.imgur.com/olfIf.png) How can I make the page numbers clearly distinct from the verse/chapter numbers? For example, how can I align the page numbers on the right side of the document with leading ldots? Or, how can I add the word "page" immediately to the left of the page numbers? Or any other creative solution someone can think of...?


title: Longtable vs. supertabular: Which is right for which job?

text: I have a fixed-column long table, with much text inside, that spans about three pages. I set it using the `supertabular` package, and for the most part it is working (I will still have to go back to manually tweak a few things once the document is complete). However, I sometimes wonder if `longtable` would have been a better choice. Looking for troubleshooting tips for tables in this site, I noticed that there are a little over three times as many questions tagged for `longtable` than there are for `supertabular`. I could speculate that this is either because `supertabular` has fewer undesirable side-effects or because `longtable` is the preferred package, therefore more people will have problems with it. I have tried them both, and by putting enough time into them I have gotten the desired results; however, the question still nags me: _which one is the right one (or the better one) for which type of long-table?_


title: Why do I get different accents?

text: 1) \begin{ttfamily}\verb 'OR'1'='1 \end{ttfamily}           2) \begin{ttfamily}\verb SELECT userid FROM CMSUsers WHERE user = 'foo' AND password = 'bar'; \end{ttfamily}      I'd like to have the accents like the ones I get in 1) also in 2) I'm wondering, the code is the same but the results are different. Can someone tell me why?


title: Error in amsmath as primitive \eqno no longer primitive

text: I am trying to typeset (with XeLaTeX) a simple Tufte-LaTeX example (http://tufte-latex.googlecode.com/files/Week5Lecture.tex) and getting an error message like the following:               /usr/local/texlive/2011/texmf-dist/tex/latex/amsmath/amsmath.sty:2496: LaTeX Er     ror: Unable to properly define \@@eqno; primitive \eqno no longer primitive.          See the LaTeX manual or LaTeX Companion for explanation.     Type  H <return>  for immediate help.      ...                                                        l.2496 \@saveprimitive\eqno\@@eqno      Is it obvious to an expert what the problem might be? Or should I supply more information? Edit: The minimum nonworking example is:               \documentclass[bidi]{tufte-handout}     \usepackage{amsmath}      The [bidi] is significant, I suspect this means bidirectional and provides support for right to left Hebrew.


title: How to hide the table of content's heading?

text: Is there any chance to hide the "Table of contents" heading that `\tableofcontents` generates? If figured that `\renewcommand\contentsname{}` works (it sets the title to "", an empty string), but it does not remove the heading completely - the space is still blocked.


title: Search & Replace Script for TeXworks

text: Does anyone have an example for a search & replace lua script that I can use with TeXworks. I have a rather large document here (about 3'000 pages DIN A5) which I need to update continously. To change `$`to `\$` and various other replacements I would like to run a 'replace-all' script which makes all the replacements in a single run. This could be quite useful when one has to take text from e.g. MS Word or the WWW.


title: Cleveref's \crefrange and mixed equations and subequations

text: This example doesn't work with the latest version of `cleveref`. The line Refer to `\crefrange{eqa}{eqc}`. gives the output:               Refer to ?? 1–3.      It used to work before. Can anyone explain how to fix it?               \documentclass{article}          \usepackage{amsmath,cleveref}          \begin{document}          \begin{subequations}     \label{eqa}     \begin{align}     a &= b\\     c &= d     \end{align}     \end{subequations}          \begin{subequations}     \label{eqba}     \begin{align}     e &= f\\     g &= h     \end{align}     \end{subequations}          \begin{equation}     \label{eqc}     i = j     \end{equation}          Refer to \crefrange{eqa}{eqc}.          \end{document}


title: Renaming the bibliography page using BibTeX

text: Is there a way to rename (or do away with the name of) the bibliography page that is output using BibTeX? If so, is the name dependent on the bibliographystyle, or is it something inherent within the BibTeX functionality?


title: Renaming referências bibliográficas to referências (Brazil)

text: > **Possible Duplicate:**   >  Renaming the bibliography page using BibTeX   >  Code to title the bibliography 'References' instead of Bibliography How do I rename Referências Bibliográficas to Referências?               \documentclass[a4paper]{book}     \usepackage[utf8]{inputenc}     \usepackage[T1]{fontenc}     \usepackage[brazil]{babel}     \usepackage{lipsum}          \begin{document}          \lipsum[1-4]          \begin{thebibliography}{99}          \bibitem[\textit{Lang}]{lang} LANG, Serge. {\sl \'Algebra Linear.}          \end{thebibliography}          \end{document}      I need 'Referências' only


title: Changing style file for bibliography

text: How do I change the 'plainnat' style file of `natbib` so that the title of the Bibliography is "References" and not "Bibliography"? Note: This is required for thesis corrections and I would rather keep plainnat than change to some other format.


title: Multiple citations styles in the body text (biblatex), based on keywords

text: I've been looking for a while, but I don't manage to use multiple citation styles with biblatex, depending on different keywords contained in the .bib file. I already use keywords to sort my bibliography, using `\printbibliography[keyword=primary]` and `\printbibliography[notkeyword=primary]`. I would like, the same way, to differentiate primary and secondary sources in the text of my thesis. My goal is to use only `\autocite` in the body text. Depending on the keyword of the reference (=primary or not), I'd like my primary sources to automatically appear in footnotes (precisely using `\footfullcite`), and my secondary sources to appear in traditional authoryear style in the body text. Is there a way to define it so in the preamble? Maybe using categories?


title: \ref giving incorrect number for \label in custom environment

text: I have defined a custom environment (using the _tocloft_ package, thanx to Juan) that looks like:               \newcommand{\listscriptname}{List of Scripts}     \newlistof[chapter]{script}{spt}{\listscriptname}     \def\thescript{\thechapter-\arabic{script}}     \newenvironment{script}[2][]       { \vspace{3mm}\hspace{3mm}         \colorbox{orange}{\refstepcounter{script}         \textbf{Script~\thescript #1:code/#2.groovy}}         \addcontentsline{spt}{script}            {\protect\numberline{\thescript}#1~~code/#2.groovy}       }       {}      which I use like:               \begin{script}{FooBar}     \label{script:FooBar}     BitStream.     \end{script}      And refer to it with:               Script~\ref{script:FooBar}.      But instead of the script environment number, I get the number of the section. What am I doing wrong (I did try several variations...)?


title: What is the best way to prepare a two-column paper in LaTeX?

text: Scientific papers are usually set in a two-column lay-out. Over years I have tried to find a good solution for typing such documents until I arrived at this website.   All my efforts until now did not deliver acceptable results and included a lot of hacking. The most troublesome thing is setting figures. Many graphs do not need to span over two columns but would nicely fit into one column. Yet, I could not find an acceptable way to do that in LaTeX. Therefore the question: **What _is_ the best way to prepare a two-column paper in LaTeX?**


title: Getting the number associated with a \chardef'ed control sequence

text: I'd like to have access to the number associated to a box by giving its control sequence. This control sequence is defined by `\newbox` using `\chardef` so a "control sequence box" expands to something like `\char"1A`. I'd like to get that hexadecimal `1A`. Here is what I did so far.               \documentclass{article}          \begin{document}     \newbox\mybox          \edef\temp{%       \def\noexpand\stripchar\detokenize{\char"}##1\noexpand\endstripchar{##1}}     \temp          \def\printboxnumber#1{%       \expandafter\stripchar\meaning#1\endstripchar}          \printboxnumber\mybox     \end{document}      The `\detokenize` is there to take care of `\catcode` change due to the use of `\meaning` in `\printboxnumber`. Unfortunately, I get               ! Use of \stripchar doesn't match its definition.     <inserted text> \char"                           1A     l.13 \printboxnumber\mybox      What's wrong?


title: Using \pgfmathparse and \ifnum for a TikZ checkerboard

text: I am trying to produce a 6-by-6 checkboard of small circles, alternating colour between red and black. To do this I have attempted to use `\pgfmathparse` and `\ifnum` in order to decide if to colour a circle red or back:               \documentclass[11pt]{article}     \pagestyle{empty}     \usepackage{tikz}     \begin{document}     \begin{tikzpicture}     \foreach \x in {0,...,5} \foreach \y in {0,...,5}     {       \pgfmathparse{mod(\x+\y,2)}       \ifnum\pgfmathresult=0{\path[fill=black] (\x*0.5cm,\y*0.5cm) circle (0.1cm);}       \else{\path[fill=red] (\x*0.5cm,\y*0.5cm) circle (0.1cm);}\fi     }     \end{tikzpicture}     \end{document}      Although the code errors when I attempted to run it through `pdflatex` with `! Missing = inserted for \ifnum.` and `! Missing number, treated as zero.` it does produce the expected result. What precisely am I doing wrong with regards to the calculation and how should one go about producing such a picture?


title: Typeset a number with many digits in the align environment

text: Questions like this have been asked before, Here and here, but neither of these are within a math enviroment. In context, I would like to type set the approximate solution to an integral to 100 digits.               \begin{align*}     I &=  \left[\left[\cos(1) + \operatorname{Si}(1)\right] - \left[-\left(\operatorname{Si}(0)-\frac{\pi}{2}\right)\right]\right] \\     I &=  \cos(1) + \operatorname{Si}(1) -\frac{\pi}{2} \\     I &\approxeq\num{-0.08441095055957388688903177037359518055393632433151889234592026720612077182783481670736342350213473343}     \end{align*}      For an minimal example, try to typeset               \begin{align}     \pi \approxeq 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796782354781636009341721641219924586315030286182974555706749838505494588586926995690927210797509302955321165344987202755960236480665499119881834797753566369807426542527862551818417574672890977772793800081647060016145249192173217214772350141441973568548161361157352552133475741849468438523323907394143334547762416862518983569485562099219222184272550254256887671790494601653466804988627232791786085784383827967976681454100953883786360950680064225125205117392984896084128488626945604241965285022210661186306744278622039194945047123713786960956364371917287467764657573962413890865832645995813390478027590099465764078951269468398352     \end{align}      It appears that `\num` from `siunitx` doesn't work, nor does `numprint`. Does anyone have a solution? # Final Awnser The final macro that I went with is:               \newcommand{\longnum}[1]{%         \parbox[t]{\dimexpr\linewidth-5em\relax}{\num[group-separator={\egroup\egroup\)\egroup\,\linebreak[0]\bgroup\(\iffalse\)\fi\bgroup\bgroup}]{#1}\dots}%     }      This will only work for 8.5in width paper and equations of the form `X =`. To make it work for other places, change the `-5em`. Using `linegoal` did not work for me, as it made the equation not fit the margins.


title: Source of Image in List of Figures

text: I need to have my sources, for example from image files, in my list of figures.               \documentclass[10pt,a4paper]{article}     \usepackage[list=true]{subcaption}     \usepackage{graphicx}     \usepackage{tocloft}     \setcounter{lofdepth}{2}     \makeatletter     \newcommand{\figsourcefont}{\footnotesize}     \newcommand{\figsource}[1]{%       \addtocontents{lof}{%         {\leftskip\cftfigindent          \advance\leftskip\cftfignumwidth          \rightskip\@tocrmarg          \figsourcefont#1\protect\par}%       }%      }     \makeatother          \begin{document}     test     \begin{figure}[h]         \centering         \begin{subfigure}[b]{0.5\textwidth}             \includegraphics[width=\textwidth]{test1.jpg}             \caption{Caption1}             \figsource{Source1}         \end{subfigure}%         \begin{subfigure}[b]{0.5\textwidth}             \includegraphics[width=\textwidth]{test1.jpg}             \caption{Caption2}             \figsource{Source2}         \end{subfigure}         \caption{Caption}         \figsource{Source}     \end{figure}     \listoffigures     \end{document}      Which gives me something like this: ![MWE](http://i.stack.imgur.com/Beh3l.png) # Problem: I need to have the Source-Captions right under the entry, with subfigures It's totally messed up. # What I need:                    List of Figures          1    Caption ............................................. 1          URL: http://tex.stackexchange.com          (a)    Caption1 ..................................... 2          URL: http://tex.stackexchange.com          (b)    Caption2 ..................................... 3      Hope somebody can help me, thanks,


title: Exam Class : Starting question with question number in circle

text: I'm studying exam class to generate question paper sample tex file is mentioned below:               \documentclass[addpoints,answers,10pt]{exam}     \usepackage{multicol}     \usepackage[T1]{fontenc}     \usepackage{graphicx}     \usepackage{tabularx}     \usepackage{nonfloat}     \usepackage{lmodern}     \usepackage{textcomp}     \usepackage{ifpdf}     \usepackage[export]{adjustbox}     \begin{document}   \begin{multicols}{2} \begin{questions}     \question[4] Question      \begin{choices} \choice Option A     \choice Option B     \choice Option C     \choice Option D      \end{choices}     \end{questions}     \end{multicols}     \end{document}      How Can I Start question with , question id in circle ; something mentioned in the image below? ![Circle](http://i.stack.imgur.com/9yW2F.png)


title: how to typeset RTL document with two columns flush AND two-column footnotes

text: I'm working on a set of documents in Hebrew. My general workflow is I type reStructuredText, run it through `rst2xetex` and then typeset with XeLaTeX. What I can't figure out how to do is create a two-column document with paragraph footnotes or twocolumn footnotes. The closest approximation is using the `twocolumn` class option, but I really don't like the way the columns are done like two separate pages. I want the columns to be aligned at the bottom, as the `multicol` package does, and the footnotes to flow from first column to second column. If it's possible to do this with `memoir` that would be fantastic, but so far I haven't much luck with that as it doesn't seem to play nice with `hyperref`, on which rst2xetex relies heavily. I tried 'disabling' hyperref following docutils instructions, as I don't need it, but I still get errors in the xetex output. Here is the basic template, with a few comments removed:               \documentclass[a4paper,12pt]{article}     % generated by Docutils <http://docutils.sourceforge.net/>     % rubber: set program xelatex     \usepackage[no-sscript]{xltxtra} % loads fixltx2e, metalogo, xunicode, fontspec     \defaultfontfeatures{Scale=MatchLowercase}     \usepackage{ifthen}          \setmainfont[AutoFakeBold=2]{SBL Hebrew}          %%% Fallback definitions for Docutils-specific commands     % numeric or symbol footnotes with hyperlinks     \providecommand*{\DUfootnotemark}[3]{%       \raisebox{1em}{\hypertarget{#1}{}}%       \hyperlink{#2}{\textsuperscript{#3}}%     }     \providecommand{\DUfootnotetext}[4]{%       \begingroup%       \renewcommand{\thefootnote}{%         \protect\raisebox{1em}{\protect\hypertarget{#1}{}}%         \protect\hyperlink{#2}{#3}}%       \footnotetext{#4}%       \endgroup%     }          % hyperlinks:     \ifthenelse{\isundefined{\hypersetup}}{       \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}       \urlstyle{same} % normal text font (alternatives: tt, rm, sf)     }{}          \usepackage[rldocument,extrafootnotefeatures]{bidi}     \RTLcolumnfootnotes     \twocolumnfootnotes          %%% Body     \begin{document}          \section*{\phantomsection%       איך עושים את זה%       \addcontentsline{toc}{section}{איך עושים את זה}%       \label{id1}%     }          טיפול מיתולוגיה מדע או, מה אודות המלחמה עוד. נבחרים איטליה טכנולוגיה זכר     בה, או רבה\DUfootnotemark{id2}{id5}{1} שנורו יידיש למחיקה     <-- etc. -->     %     \DUfootnotetext{id5}{id2}{1}{%     ציון א     }     \end{document}     % vim: set ft=tex: %      If I add `multicol` and wrap the main part of the document in a `multicols` environment, the footnotes end up in two columns under the left column only, unless I take out the extrafootnotefeatures. Then I have an attractive two columns on top but only one column of footnotes on the bottom!


title: How to suppress Table of Contents section numbers?

text: I am using the following to suppress the numbering of `\section`s:               \makeatletter     \renewcommand\@seccntformat[1]{}     \makeatother      But in my `\tableofcontents`, the section numbers still appear. Is there a way to remove them?


title: Deactivate all \alt,\uncover in beamer (for printing)

text: I have a big latex beamer that uses `\alt`, `\uncover`, ... to create "animations". My goal is to deactivate all these commands temporary (let's say : just use the last state/slide each time there's this kind of thing) to print my document. Is there a global command to do this or have I to do all this manually (comment manually the commands / or (simpler but still really long) suppress manually pages from the output) ? Thanks very much in advance for your help.


title: Strange border on PNG images in pdf

text: I make figures in powerpoint, export them as pngs, and include them in my document. I sometimes get strange borders around them, sometimes around indivual elements of the ppt file, like this (black boxes are just censoring): ![pic](http://i.stack.imgur.com/Ls5eV.jpg) It doesn't print, but looks bad on the screen. Any tips to get rid of it?


title: Problems rendering BeamerTex Postscript specials in WinEdt 6.0

text: I have a beamer `.tex` file which I know works perfectly on TexShop. However, when I `texify` the same document on WinEdt 6.0, the document does not display properly. No images appear, and anytime I try to scroll down the document, I get a message saying:               MiKTeX Problem Report     Some PostScript specials could not be rendered.     Data:     Error: /undefined in H.S     Operand stack:        --nostringval--   PermitFileReading   --nostringval--   PermitFileWriting   --nostringval--     Execution stack:        %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1914   1   3   %oparray_pop   1913   1   3   %oparray_pop   1897   1   3   %oparray_pop   1787   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--     Dictionary stack:        --dict:1166/1684(ro)(G)--   --dict:0/20(G)--   --dict:78/200(L)--   --dict:95/300(L)--   --dict:17/200(L)--     Current allocation mode is local     MiKTeX GPL Ghostscript  9.00: Unrecoverable error, exit code 1      What can I do to prevent this error and display everything properly? _**Update_** This is how I setup my code:               \documentclass[10pt]{beamer}       \usetheme{Warsaw}       \setbeamertemplate{navigation symbols}{}          \setbeamercolor*{palette secondary}{use=structure,fg=white,bg=structure.fg!60!blue}     \setbeamercolor*{palette tertiary}{use=structure,fg=white,bg=orange!85!blue}          \def\colorize<#1>{%      \temporal<#1>{\color{black!20}}{\color{black}}{\color{black!20}}}          \usepackage{palatino}     \usepackage{graphicx}     \usepackage{amsmath}     \usepackage{amssymb}          \title{My Groundbreaking Presentation}     \author{You Know Who}     \date{\today}          % note: do NOT include a \maketitle line; also note that this title     % material goes BEFORE the \begin{document}          % have this if you'd like a recurring outline     \AtBeginSection[]  % "Beamer, do the following at the start of every section"     {     \begin{frame}<beamer>     \tableofcontents[currentsection]  % show TOC and highlight current section     \end{frame}     }          \begin{document}          \begin{frame}     \titlepage     \end{frame}          \begin{frame}     \frametitle{First Slide}     \begin{figure}[h!]         \includegraphics[width=3in]{picture.eps}     \end{figure}     \end{frame}          %etc...          \end{document}


title: \everymath and author color

text: Consider the following example:               \documentclass[11pt]{paper}     \usepackage[usenames]{color}          \definecolor{foo}{rgb}{0.75,0.0,0.0}     \everymath{\color{foo}}          \title{something}     \author{someone}     \begin{document}     \maketitle     this is some math: $a^2$.      \end{document}      The math is colored red as intended. However, the author list is also colored. If I comment out the `\everymath` command, then both the author and the math change back to black. I understand the function of `\everymath`, but I didn't realize that it affects author specification as well. Is this a known feature ?


title: Is there a way to limit the scope of \usepackage?

text: When I tried to use the `breqn` package suggested by an answer to the question How do I break a long equation over lines It managed to break a whole bunch of unrelated equations (equations that did not use its functionality), including a definition for the control sequence `\mf` which I had previously defined myself. Is there a way to limit the scope of a `\usepackage` declaration so that its (positive and negative) effects are limited to a particular segment of a document? I have tried putting it inside an environment, but get the following error:               ! LaTeX Error: Can be used only in preamble.


title: How put tick and cross mark around a node in tikz?

text: I want to draw something like this: ![enter image description here](http://i.stack.imgur.com/I8kaX.png) This is my tikz code:               \documentclass{article}     \usepackage{tikz}     \usetikzlibrary{arrows}     \usetikzlibrary{trees}               \tikzstyle{bag} = [text width=8em,     text centered]          \tikzstyle{bag_mod} = [text width=2em,     text centered]          \tikzstyle{bag_rect} = [draw=black,rectangle, black,text width=8em,     text centered]          \tikzstyle{bag1} = [draw=black,rectangle, black,text width=4em,     text centered]                    \begin{document}     \begin{tikzpicture}[-,>=stealth',level/.style={sibling distance = 2.5cm/#1,       level distance = 1cm}]      \node [bag] {$||$}         child{node[bag] {$\&\&$}           child{node[bag] {$enabled$}}           child{node[bag] {$\&\&$}               child{node[bag1,left] {$tcas\_eq$}}               child{node[bag_rect,right] {$intent\_not\_known$}}            }         }         child{node[bag] (A) {$!$}           child{node[bag] (B) {$tcas\_eq$}}         }     ;      %\node [draw=red, fit= (A) (B)] {};     \end{tikzpicture}     \end{document}      And this is the output: ![enter image description here](http://i.stack.imgur.com/DijEF.png) I have two questions:   1. How to put tick and cross mark as shown in the first figure?   2. How to draw a rectangle containing two node? Example: I want to draw a single rectangle enclosing `!` and `tcas_eq` (right side of the root). How to do that?


title: How to control spacing in end of itemize?

text: This refers to my previous question How to reduce space in begining but not in end of itemize Now I need to control spacing in the last of itemize like I could control in the beginning as suggested in previous question. How can I control it?


title: How to generate text and timing diagram together using tikz-timing package?

text: I am new to TeX and I am trying to create a document which has regular text, paragraphs etc and also a timing diagram somewhere in between. I am using the TikZ timing package. Here is an example of what I am trying to do. Create a section. Write some text. Add a timing diagram. End section and on to the next section. Here is the code sample I tried.               \documentclass{article}     \usepackage{tikz-timing}[2009/12/09]     \usepackage[active,tightpage]{preview}     \PreviewEnvironment{tikzpicture}     \setlength{\PreviewBorder}{1mm}     \pagestyle{empty}          \begin{document}     %     % Defining foreground (fg) and background (bg) colors     \definecolor{bgblue}{rgb}{0.41961,0.80784,0.80784}%     \definecolor{bgred}{rgb}{1,0.61569,0.61569}%     \definecolor{fgblue}{rgb}{0,0,0.6}%     \definecolor{fgred}{rgb}{0.6,0,0}%     %               \begin{section}      1.  Timing diagram of SR Flip Flop         Here is the timing diagram of SR flip flop.                 \begin{tikztimingtable}[         timing/slope=0,         % no slope         timing/coldist=2pt,     % column distance         xscale=2.05,yscale=1.1, % scale diagrams         semithick               % set line width       ]       \scriptsize clock     & 7{C}                              \\       S                     & [fgblue] .75L h 2.25L H LLl       \\       R                     & [fgblue]  1.8L .8H 2.2L 1.4H 0.8L \\       Q                     &          L .8H 1.7L 1.5H LL       \\       $\overline{\mbox{Q}}$ &          H .8L 1.7H 1.5L HH       \\       Q                     & [fgred]  HLHHHLL                  \\       $\overline{\mbox{Q}}$ & [fgred]  LHLLLHH                  \\     \extracode      \makeatletter      \begin{pgfonlayer}{background}       % Draw shaded backgrounds       \shade [right color=bgblue,left color=white]          (7,-8.45) rectangle (-2,-4.6);       \shade [right color=bgred,left color=white]          (7,-12.8) rectangle (-2,-8.6);       % Add background grid lines       \begin{scope}[gray,semitransparent,semithick]         \horlines{}         \foreach \x in {1,...,6}           \draw (\x,1) -- (\x,-12.8);         % similar: \vertlines{1,...,6}       \end{scope}       % Add labels       \node [anchor=south east,inner sep=0pt]         at (7,-8.45) {\tiny clocked};       \node [anchor=south east,inner sep=0pt,fgred]         at (7,-12.8) {\tiny positive edge triggered};      \end{pgfonlayer}     \end{tikztimingtable}%     %     \end{section}      \end{document}      I am expecting the pdf to show the text first and then the timing diagram, but only the timing diagram is being generated. Can somebody please help me? Thanks