Using MiKTeX with PDFLaTeX on Windows I want to create an environment that contains two minipages; the first one has a description item, and the second has a small text (or picture). This piece of code works as I want: { \noindent \begin{minipage}{0.5\textwidth} \begin{description}     \item[Label] Description \end{description} \end{minipage}\hfill \begin{minipage}{0.3\textwidth}     Second minipage \end{minipage} }  I wanted to create a macro or environment to make it easy for me to introduce this kind of content. So I create the following environment with two arguments: \newenvironment{myenvironment}[2]% 1:label, 2:second minipage text {%     \noindent     \begin{minipage}{0.5\textwidth}     \begin{description}         \item[#1] % Description }% {%     \end{description}     \end{minipage}\hfill     \begin{minipage}{0.3\textwidth}         #2     \end{minipage} }  But when I try to use it with \begin{myenvironment}{Label}{Second minipage text} Description text \end{myenvironment}  I get Illegal parameter number in definition of \endmyenvironment. pointing to the line that finishes the newenvironment declaration. After some hours struggling with this I tried using double hashes (##) and got two new different errors: You can't use `macro parameter character #' in restricted horizontal mode and You can't use `macro parameter character #' in internal vertical mode. This time the errors were pointing to the lines when I wanted to use the environment, but had no complaints on the definition. What am I doing wrong?
10721
Environments are allowed to have arguments, but reference to those arguments can only appear in the opening code of the environment, and not the closing code.  What is the reason for this, and are there preferred ways around it?  e.g.  \newenvironment{foo}[1]% {some code #1} % allowed {some code #1} % not allowed
16304
In comments, mini-Markdown sometimes has a different syntax for backticks within backticks: when the code starts and/or ends with a backtick, one needs escaping. In those cases, could mini-Markdown also support adding one space to the delimiters, just like Markdown does?  Markdown:   Use any unique number of backticks in the delimiter to allow for (other sequences of) backticks in the code itself: ```code with `embedded```` backticks``` yields code with `embedded```` backticks. Add one additional space to the delimiters above if the code fragment starts and/or ends with backticks, : `` `code with `embedded```` backticks` `` and Perl's `` $` `` yield `code with `embedded```` backticks` and Perl's $`.   Mini-Markdown (for comments):    as in Markdown†. The Markdown extra-space . Instead, this  single opening and closing backticks, and escaping of all embedded backticks: `\`code with \`embedded\`\`\`\` backticks\`` and `$\``.   I realize that the current escaping should always be supported to preserve the existing comments. But maybe mini-Markdown could also support the extra space.  † One could also escape, like `code with \`embedded\`\` backticks`, which however does not work in Markdown. Until today, I thought this escaping was required in comments. But today I realized that Markdown and mini-Markdown behave almost the same.
81218
I am trying to do a new environment or command (i tried both) where i can put in the name, description and code of a Method in c++ and it gives me a new section with the MethodName, the code listed and the description below. But i am not able to use the listings environment in a new command or new environment.. Consider my MWE   \documentclass[a4paper,11pt]{article} \usepackage{listings}  \newcommand{\method}[3] { \section{#1}\label{#1} \begin{lstlisting} #2 \end{lstlisting} #3 }   \begin{document}  \method{MethodName}{Method Void MethodName()}{Description of the Method blablabla}  \end{document}   How can I fix this?   I would prefer to do it using a macro since I don't need an ending.
17059
Consider the following minimal example:  \documentclass{article}  \setlength{\parindent}{0mm}  \usepackage{paralist} \usepackage{tabto}  \begin{document}  \NumTabs{3} \begin{inparaenum} \item text \tab\item text \tab\item text \tab\item text \tab\item text \tab\item text    \end{inparaenum}  \end{document}   Which results in:    It does exactly what I want, but I was wondering whether it was possible to create an environment, say tabbedEnum so that we can eliminate the use of the \tab, in particular, that the first case doesn't need a tab but all others do. Something of the form:   \begin{tabbedEnum}[3] \item text \item text \item text \item text \item text \item text \end{tabbedEnum}
41969
I'm creating a style file, and want to store the body text of the abstract environment so that I can put it on my custom titlepage. I could have required that my users enter the abstract as  \customabstract{Abstract text goes here}`   which I would have implemented as something like  \newcommand{\customabstract}[1]{\gdef\abstracttext{#1}}   However, I would prefer that the user is able to use environment notation,  \begin{customabstract}Abstract text goes here\end{customabstract}   To do this, I thought I could define something like  \newenvironment{customabstract}{\gdef\abstracttext\bgroup}{\egroup}   But this definition makes \abstracttext expand to \bgroup, which is not what I wanted. I tried to solve the problem by \expandafter,  \newenvironment{customabstract}{\expandafter\gdef\expandafter\abstracttext\bgroup}{\egroup}   but this results in a runaway error.  Is there any way to acheive what I want? Answers that helps me understand the inner workings of TeX (instead of just referring to a custom package) are preferred.
20304
I am trying to build a table inside a LaTeX 3 command. A MWE:  \documentclass{article} \usepackage{xparse}  \ExplSyntaxOn \NewDocumentCommand{\createTable}{ m m }{     \begin{tabular}{|c*{#2}{|c}|}         \hline         \int_step_inline:nnnn {1} {1} {#1} {             ##1             \int_step_inline:nnnn {1} {1} {#2} {                 &amp; x             }             \\\hline         }     \end{tabular} } \ExplSyntaxOff  \begin{document}      \createTable{5}{4}  \end{document}   This gives me following ouput in which the column lines of the first column are too long:    In order to solve this problem I read questions         Though I still did not understand the actual nature of the problem (or its given solutions), I was able to reproduce the solution from .  \documentclass{article} \usepackage{xparse}  \ExplSyntaxOn \DeclareDocumentCommand{\fillRow}{ m m }{     #1     \int_step_inline:nnnn {1} {1} {#2} {     &amp; x     }     \\\hline }  \DeclareDocumentCommand{\BuildTable}{ m }{     \begin{tabular}{|c*{#1}{|c}|}     \hline }  \def\endBuildTable{     \end{tabular} } \ExplSyntaxOff  \begin{document}      \begin{BuildTable}{4}         \fillRow{1}{4}         \fillRow{2}{4}         \fillRow{3}{4}         \fillRow{4}{4}         \fillRow{5}{4}     \end{BuildTable}  \end{document}   This code outputs the desired result. But I don't like it because it needs 3 commands instead of 1 (minor issue). But most of all because of the verbose, redundant and inflexible syntax to generate the table. Therefore I decided to make an abstraction by putting the table-generating-commands in another command:  \documentclass{article} \usepackage{xparse}  \ExplSyntaxOn \DeclareDocumentCommand{\fillRow}{ m m }{     #1     \int_step_inline:nnnn {1} {1} {#2} {     &amp; x     }     \\\hline }  \DeclareDocumentCommand{\BuildTable}{ m }{     \begin{tabular}{|c*{#1}{|c}|}     \hline }  \def\endBuildTable{     \end{tabular} }  \DeclareDocumentCommand{\putTogether}{ m m }{     \begin{BuildTable}{#2}         \int_step_inline:nnnn {1} {1} {#1} {             \fillRow{##1}{#2}         }     \end{BuildTable} } \ExplSyntaxOff  \begin{document}      \putTogether{5}{4}  \end{document}   But this brought me back to my original problem because the column lines of the first column are too long again.  Could anyone   explain to me what exactly is wrong with my original code; what the difference is between the second and the third code fragments; how to edit my (original) code in order to solve my problem?
27271
I'm using the following syntax for my code snippets  \begin{minipage}{\textwidth} \begin{lstlisting}[caption=&lt;something&gt;, label=&lt;something&gt;] The REST Endpoint URL     is http://api.flickr.com/services/rest/  To request the flickr.test.echo service,     invoke like this:    http://api.flickr.com/services/rest/       ?method=flickr.test.echo&amp;name=value  By default, REST requests will send a REST response. \end{lstlisting} \end{minipage}   and I would like to have  \begin{code}[&lt;caption&gt;, &lt;label&gt;] ... code ... \end{code}   which would behave exactly the same.   So I tried this thing but it won't compile and I can't spot the problem  \newenvironment{code}[2][]%     {         \minipage{\textwidth}          \lstset{             basicstyle=\ttfamily,             breaklines=true,             captionpos=b,             frame=bottomline,             extendedchars=true         }         \begin{lstlisting}[caption=#1, label=#2]     }     {         \end{lstlisting}         \endminipage     }   Error when running pdflatex  ! Package inputenc Error: Unicode char \u8:�\expandafter not set up for use with LaTeX.  See the inputenc package documentation for explanation. Type  H &lt;return&gt;  for immediate help.
33517
I currently have several environments from mdframed that have a large number of options that are shared between them. The situation looks like  \newmdtheoremenv[options0,options1]{env1}{Environment 1} \newmdtheoremenv[options0,options2]{env2}{Environment 2} \newmdtheoremenv[options0,options3]{env3}{Environment 3}   etc., where in place of options0, etc, there are a long list of various options like backgroundcolor=red!1, leftmargin=0.5in, etc. I would prefer not to write out all the arguments in options0 repeatedly for each of these environments, and I was wondering if I could use a macro to do this. I tried  \newcommand{\myopts}{options0} \newmdtheoremenv[\myopts,options1]{env1}{Environment 1} \newmdtheoremenv[\myopts,options2]{env2}{Environment 2} \newmdtheoremenv[\myopts,options3]{env3}{Environment 3}   but it did not work, telling me that there is a Package kvsetkeys error. Any suggestions?
2548
If I create a custom environment based on the equation environment, I get a spacing issue: the next line of text after my environment closes doesn't start on the left margin.  Example code:  \documentclass{article} \begin{document} \newenvironment{myenv}{\begin{equation}}{\end{equation}} \noindent $| \leftarrow$ this is the left margin. \begin{myenv} e ^{i \pi} + 1 = 0 \end{myenv} $| \leftarrow$ this isn't the left margin. \end{document}   Output:    Removing the newline after \end{myenv} solves the spacing problem, but the resulting code is not readable.  Of course, in this example I could just use the equation environment itself. My real issue involves a more complex custom environment that suffers from the same problem, and which also includes an equation environment within it.
123457
I'm creating a technical document with lots of index entries. To reduce typing I defined an index command that typesets the word to be indexed using \emph{}:  \newcommand{\ind}[1]{\index{#1@\emph{#1}}}   I turns out the .ind file gets different entries when I use this command, compared to typing the \index{} command myself: the entries created with the \ind{} command get two spaces inserted before the { of the \emph command. Consequently, the index will contain two entries for the same word if I use both the \ind{} command and the \index{} command (e.g. when defining a region using   \index{someword@\emph{someword}\(}   to start a region for that word.   Here is an MWE:  \documentclass[a4paper]{article}  \usepackage{makeidx} \makeindex  \newcommand{\ind}[1]{\index{#1@\emph{#1}}}  \begin{document} Testing our self-defined command\ind{italictext}. This is the normal way\index{italictext@\emph{italictext}}.  \printindex \end{document}   The contents of the .ind corresponding file is:  \begin{theindex}    \item \emph  {italictext}, 1   \item \emph{italictext}, 1  \end{theindex}   Note 1: my actual use case is not with \emph{}, but with \lstinline{} from the listings package, but this simplified example already shows the problem. I observed the same behaviour when using the imakeidx package.  Note 2: using \DeclareRobustCommand instead of \newcommand doesn't change anything.  Note 3: I am actually using a KOMA class documentclass, so the scrindex package would be an option since the spacing problem doesn't appear there (in fact, both entries end up as one index entry with a single space between the \emph and opening { in the .ind file. However, with that package I haven't managed to get the page numbers for the index entries hyperlinked when using the hyperref package.
18641
I want to create a   How can I create a formfield with N fields, each 5 mm wide with separations like in the picture?    At the moment I use a workaround with a for loop, but this renders the code hard to maintain. Finally I need a function \formline{N}{cellwidth}{label}{value} to create the complete formfield and fill it with an optional value:   The following code is available on .   \documentclass[a4paper,11pt]{article} \usepackage[utf8]{inputenc} \usepackage{tikz} \usetikzlibrary{shapes}  \thispagestyle{empty} % no pagenumber. The form should be a stand alone macro... later.  \definecolor{SEPAOrange}{RGB}{254,213,161} \definecolor{SEPADOrange}{RGB}{253,185,19} \definecolor{SEPABlindcolor}{RGB}{255,0,0} \begin{document} \begin{tikzpicture}[x=1 mm, y=-1mm] \pgfmathsetmacro{\yh}{4.2333} % y heigth step defined as 1/6 inch =&gt; 1/6 * 25.4 mm = 4.2333 mm \pgfmathsetmacro{\xs}{9} % x start (own definition) \pgfmathsetmacro{\xe}{141.5} % x end (own definition) \pgfmathsetmacro{\widefield}{4.9859} % def: 134.62 mm / 27 \pgfmathsetmacro{\narrowfiels}{3.9594} % def: 134.62 mm/ 34  \filldraw[draw=black,color=SEPAOrange] (7.62, 4.5*\yh) rectangle (149.86-7.62,105.83-1); %orange background  \filldraw[draw=black,color=white] (\xs, 5*\yh) rectangle (\xe, 6.5*\yh -1.5); %Recepient 27 Char \foreach \x in {1,...,26} {  \draw[color=SEPAOrange, line width=0.3mm] (7.62 + \x*\widefield, 5*\yh ) -- (7.62 + \x*\widefield, 6.5*\yh);  \draw[color=SEPAOrange, line width=0.7mm] (7.62 + \x*\widefield, 5.8*\yh ) -- (7.62 + \x*\widefield, 6.5*\yh); }  \filldraw[draw=black,color=white] (\xs, 7*\yh) rectangle (\xe, 8.5*\yh -1.5); %IBAN 34 Char \foreach \x in {1,...,33}  \draw[color=SEPAOrange, line width=0.3mm] (7.62 + \x*4, 7*\yh ) -- (7.62 + \x*4, 8.5*\yh);  \filldraw[draw=black,color=white] (\xs, 9*\yh) rectangle (\xe, 10.5*\yh -1.5); %BIC \filldraw[draw=black,color=white] (\xe-12*5, 11*\yh) rectangle (\xe, 12.5*\yh -1.5); %Value 12 Char  \filldraw[draw=black,color=white] (\xs, 13*\yh) rectangle (\xe, 14.5*\yh -1.5); %Subject1 \filldraw[draw=black,color=white] (\xs, 15*\yh) rectangle (\xe, 16.5*\yh -1.5); %Subject2 \filldraw[draw=black,color=white] (\xs, 17*\yh) rectangle (\xe, 18.5*\yh -1.5); %Subject3  \filldraw[draw=black,color=white] (\xs, 19*\yh) rectangle (\xs+22*5, 20.5*\yh -1.5); % IBAN 22 Char  \filldraw[draw=black,color=white] (149.86-17.59, 19* \yh) rectangle (\xe, 20.5*\yh -1.5); % counter \filldraw[draw=black,color=white] (\xs, 21* \yh) rectangle (42.52, 24.5*\yh); % date \filldraw[draw=black,color=white] (42.52+5, 21*\yh) rectangle (149.86-17.59, 24.5*\yh); % signature  \draw[color=SEPADOrange] (0, 4.5 *\yh) --(149.86, 4.5*\yh); upper dark orange line \draw[color=SEPADOrange] (0, 20.5 *\yh) --(149.86, 20.5*\yh); lower dark orange line \draw[draw=black,color=black, line width=0.3mm] (0,0) rectangle (149.86,105.83); % black border %\draw[align=left] at (\yh,\yh) {SEPA-Überweisung};  \end{tikzpicture} \end{document}
90655
I'm coding a TeX file and although the .pdf is correctly rendered, I'm using "stone age" tools to code it. As some examples, I use \\ to leave a line space between two paragraphs, or \noindent in every paragraph I start. Basically, I'm just using the basic TeX data I have to code a paper, but I'm sure there are things that can be replaced with much better and appropriate codes, since I get badness 10000. This is the console:  *geometry* detected driver: pdftex ("C:\Archivos de programa\MiKTeX 2.9\tex\latex\amsfonts\umsa.fd") ("C:\Archivos de programa\MiKTeX 2.9\tex\latex\amsfonts\umsb.fd") Underfull \hbox (badness 10000) in paragraph at lines 10--11 [1{C:/Documents and Settings/All Users/Datos de programa/MiKTeX/2.9/pdftex/conf ig/pdftex.map}] Overfull \hbox (10.8009pt too wide) detected at line 49 \OML/cmm/m/it/14.4  [] \OT1/cmr/m/n/14.4 + 1 = [] [] \OML/cmm/m/it/14.4 x \OT1 /cmr/m/n/14.4 + [] [] \OML/cmm/m/it/14.4 x [2] Overfull \hbox (26.66542pt too wide) in alignment at lines 80--82  [][][] [] [3] Overfull \hbox (23.60692pt too wide) detected at line 90 \OML/cmm/m/it/14.4  [] \OMS/cmsy/m/n/14.4 &gt;&lt;C:/Archivos de programa/MiKTeX 2 .9/fonts/type1/public/amsfonts/symbols/msbm10.pfb&gt;   How could I clean up these errors, which I'm guessing are basic?
117940
Every now and then I use the description list environment  \begin{description} \item[foo]  foo is good \item[bar]  bar is bad \end{description}   to create lists with non-numerical labels. Unfortunately the description list does not support the label-reference pair as normal latex: i.e. if I write  \begin{description} \item[foo] \label{foo} foo is good .... \end{description} .... For good things (see, for example \ref{foo})...    the reference does not point to the item in the list. Instead it points to the closest environment that supports labeling (usually the subsection). So instead of showing the text foo (in boldface), it shows something like 2.2.1 (the subsection corresponding to where the description environment is sitting).  My question: is there a way or a package which allows references to description list items? My current work-around is to just type the text myself in the spot (since I named it myself, and it is not numbered, the formatting is unlikely to change the label =). But one of the good things about the label/reference pairs in latex is the implementation in pdflatex that allows in PDF hyperlinks between references and the objects referred to, this I cannot replicate myself.   Edit: let me rephrase my question. The primary goal is not to display \ref to something other than what LaTeX thinks the \label is. There are many ways to deal with it, some of which outlined in Michael Underwood's helpful answer below. What I am looking at is whether there exists an implementation of a list environment which is like the built-in description environment in that the displayed "title" for the list item is completely customized, while having support for \labels. (The built-in description environment does not support \labels, whereas the built-in enumerate environment does not support customized "title"s.) The enumitem package adds some customizability to the environments, but as far as I can tell it doesn't support exactly what I want.
111103
I'm writing a document where some text portions are confidential and would therefore like to create an environment (e.g. confidential) which I can then exclude from the PDF by simply setting a variable or option.  Is there any way of doing this in LaTeX, or better yet, is there a package for this?
91411
I'm trying to write a key:value environment which would allow me to create a dual columns tables where the columns are separated by colons.  Typically, I've implemented this using parbox in my own class file:  \makeatletter \newenvironment{keylist}{\global\setlength{\parindent}{0pt}}{} \newlength{\@keyvalueXposition} \setlength{\@keyvalueXposition}{0.5\textwidth} \newcommand{\keyvalue}[2]{     \parbox[t]{\@keyvalueXposition}{#1}     :     \parbox[t]{\@keyvalueXposition}{#2}     \\ } \makeatother   Which is typically used like this on the user-side:  \begin{keylist}     \keyvalue{Foo que lorem ipsum          } {Foofoo                           }     \keyvalue{Bar foobar                   } {Bar bar ipsum                    }\\     \keyvalue{Baz norf                     } {Bazbaz                           }     \keyvalue{Qux lorem ipsum              } {Qux lorem qux                    } \end{keylist}   Soon I realized my implementation was lacking this use case: allow lines to have only one element without printing the colon. Also, I began to use, in my class file, tabularx with booktabs to have great spaced lines in my tables.  \begin{tabularx}{\textwidth}{ X@{ : }X }\toprule     Foo que lorem ipsum &amp; Foofoo\\\midrule     Bar foobar &amp; Bar bar ipsum\\[\baselineskip]     Baz norf &amp; Bazbaz\\     Qux lorem ipsum &amp; Qux lorem qux\\\bottomrule \end{tabularx}   * where [\baselineskip] is used to simulate linebreaks, implemented simply using \\ in the previous implementation using parbox.  While this was working nice up to now, this was quite a hassle to use. I decided to replace the above solution by an environment alias, defined like this:  \newenvironment{keylisting} {\tabularx{\textwidth}{ X@{ : }X }} {\endtabularx}   which would give me  \begin{keylisting}\toprule     Foo que lorem ipsum &amp; Foofoo\\\midrule     Bar foobar &amp; Bar bar ipsum\\[\baselineskip]     Baz norf &amp; Bazbaz\\     Qux lorem ipsum &amp; Qux lorem qux\\\bottomrule \end{keylisting}   In the case where a line has only one item, we need to create an empty item for the second column, like this  Foo bar &amp;\\   However, a colon is printed between both columns. According to what I found in the documentation, using  \multicolumn{2}{l}{Foo bar}\\ is the solution. However, for a reason I don't know when we prefix that statement by [\baselineskip], the latter isn't interpreted by the LaTeX kernel. If you use the following example, you will see the differences between the two lines with [\baselineskip]]: the first one is not interpreted. I prefixed the statement by 10 to clearly see it isn't interpreted.      \documentclass{report}     \usepackage[margin=2cm]{geometry}     \linespread{1.2}     \usepackage{tabularx}     \usepackage{booktabs}     \usepackage{float}     \newenvironment{keyval}     { \tabularx{\textwidth}{ X@{ : }X } }     { \endtabularx }     \begin{document}     \begin{keyvalue}         Foo bar lorem ipsum           &amp; Lorem ipusm que \\         Some number                   &amp; 12 3456 789  8  \\         \multicolumn{2}{l}{This is some comment}  \\[10\baselineskip]         Yet some number               &amp; 987 65432 1     \\         Foo bar                       &amp; 163883495778    \\[\baselineskip]         Bar lorem ipsum               &amp; 2013-04-12      \\     \end{keyvalue}     \end{document}   Thanks for your help.
92291
How is it possible to use the end-of-line character as a macro parameter ? I would like something along the lines of :  \def\mymacro#1\endlinechar{Content:#1} \mymacro First content \mymacro Second content   Giving the following output :  Content: First content Content: Second content   I have tried \endlinechar and \^^M but it does not work that easily.
103278
I am using the package multicol to typeset a one-column (spanning the entire text width) heading and a two-column main text block. In order to do so, I begin the multicols environment along with the start of the text block. The one-column heading spans a small fraction of the text height in the front page and I need to set a footnote there, before starting the two-column environment. I'd like to have that footnote typeset under the first column in the two-column running text. How could I possibly do this?   Moreover, I'd like to have the footnotes typeset in a single column under one of the text columns -- I don't even mind having them as two-column footnotes, but what I do not want is a footnotes layout spanning the entire text width. I have tried with the command \twocolumnfootnotes from the class memoir, with the packages ledmac, dblfnote, and even with ftnright (the latter complains about its being used in a single-column document, due to that one-column heading). None has proved useful in this setting. As a less than MWE, just to convey a more concrete depiction of my scenario, let us consider:  \documentclass{memoir}  \usepackage{multicol}  \begin{document}  A single-column heading\footnote{Here I have my footnote.}  \begin{multicols}{2} Here I am in the two-column environment, and I want my footnotes being set in accordance with the document's ``columnwidth''.\footnote{A footnote in the two-column environment.} \end{multicols}   \end{document}