Edit 2: At the bottom I have updated the question after incorporating the answer from here:  I created a function to display a command in bold with optionally giving the man page section in parenthesis. \usepackage{xparse} \newcommand*{\man}[2][]{%    \textbf{#2}\IfNoValueF{#1}{(#1)}% }  Now I also want to be able to create an index entry for these commands. So I created a wrapper command: \newcommand*{\mani}[2][]{%    \man[#1]{#2}%    \index{#2@\man[#1]{#2}}% }  However, sometimes I want to create an index entry using the same formatting, but not print the command in the running text. Here is a MWE: \documentclass{memoir} \usepackage{xparse} \newcommand*{\man}[2][]{%    \textbf{#2}\IfNoValueF{#1}{(#1)}% } \newcommand*{\mani}[2][]{%    \man[#1]{#2}%    \index{#2@\man[#1]{#2}}% } \makeindex  \begin{document} Only an index entry: \index{ssh-keygen@\man[1]{ssh-keygen}} Hello world  Command and index entry: \mani[1]{ssh-keygen}  \printindex \end{document}  The file output.idx contains two lines, the second containing an additional space. The question thus is, why is there an additional space and how can I fix it so there is no additional space? \indexentry{ssh-keygen@\man[1]{ssh-keygen}}{1} \indexentry{ssh-keygen@\man [1]{ssh-keygen}}{1}  Edit 1: I've added a screenshot of the result of this extra space: two identical index entries are printed.  Update I have updated my code as per the provided solution but I now get an error message which I do not understand. \documentclass{memoir} \usepackage{xparse} \makeindex \NewDocumentCommand\man{om}{%    \textbf{#2}\IfNoValueF{#1}{(#1)}% } \makeatletter \newcommand*{\mani}{%    \@bsphack    \begingroup    \@sanitize    \@mani } \newcommand*{\@mani}[2][]{%    \man[#1]{#2}%    \@wrindex{#2@\string\man[#1]{#2}}% } \makeatletter   \begin{document} Two separate commands: \man[1]{ssh-keygen}\index{ssh-keygen@\man[1]{ssh-keygen}} Hello world  One command: \mani[1]{ssh-keygen}  \printindex \end{document}  OverLeaf states:  The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.  The log file reports: ! Missing number, treated as zero. &lt;to be read again&gt;                     { l.25     One command: \mani[1]{ssh-keygen}                                            A number should have been here; I inserted `0'. (If you can't figure out why I needed to see a number, look up `weird error' in the index to The TeXbook.)
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.
38035
Does anyone know a package for ?    Failing that, is anyone interested in writing a command to create one? I'm thinking of something that would have optional and configurable separators above and below (e.g., lines or large quotation marks), and option to float left, right, or center. Ideally the command should print the argument and the pull quote so you do not have to duplicate the text that you want to quote.   To avoid duplicating existing questions, perhaps we should focus on single column documents, so that the pull quote has to be boxed?
45642
Say I have written two commands, CommandA and CommandB. I wish to have a third command that takes inputs to determines which of the two previous commands to execute. Very naively this how I would try and accomplish this as shown below, however, it does not work.  \newcommand{CommandA}{     \hspace{5mm} } \newcommand{CommandB}{     \vspace{5mm} } \newcommand{C}[1]{     \Command#1 }   So if I call \C{A}, as written I would really execute \CommandA.
121312
I'm trying to run the command ssh -o StrictHostKeyChecking=no but I'm a bit lost as to how to run it. I've tried running it from a shell script, but the output was the man page or settings that lists out all the parameters.   I then tried running that command from the shell (Cygwin) itself, but got the same man output. How do I run the command? Do I need to provide credentials or anything?
107255
On Linux (or any other OS that uses the man tool), there are typically several sections of the manual. Often, a given entry (such as echo or printf) exists in multiple sections, but not all of them. Is there a simple way to check which sections of the manual that entry can be found in?  Obviously, one can try man [section] [entry] and just run through every section in the manual, but honestly, I'm not even sure what the complete list of sections is (or how to find that definitively), and I'm looking for something a little less brute-force.
124165
I understood the very basic concept of how to use /etc/network/interfaces, but all I find online are examples, example after example, which I can copy-paste from. What I miss is an explanation of the syntax, an explanation of the meaning of the commands and which order the commands require. I want to understand, because most of the time copy-paste is not enough, because I'm not working on a fresh machine, so I can't just overwrite existing configurations because it would break a lot of stuff. man interfaces was not very helpful since it is written very complicated.  Example questions I have: what does inet in an iface line mean exactly (I could not even find it in the manpage), what does manual in an iface line mean exactly (many examples use it, but according to manpage it needs an extra config file then, which the examples don't present), when do I use or need them? When not? When I create a bridge, what exactly happens to the interfaces?
89914
Examples  I've recently found examples of using pairs of enclosing braces {}, with nothing in between the opening and closing braces, as arguments to commands and even to their options:  cat foo | xargs -I{} echo {}  find . -size 0 -exec rm -i {} \;  No Documentation  My problem is that I cannot find a documentation in the  that describes the usage of {} in such context as in the examples above.  I do not think it is a , because a dollar sign must precede the enclosing braces in a parameter expansion as in ${}.  It cannot be a  either, because it takes the form of {x..y[..incr]}, where x and y are not optional.  It also cannot be a  either, because {} is used as arguments.  Questions   What does a pair of enclosing braces {} even mean, in general, as an argument to any command that accepts it? Where can I find a documentation that describes the usage of {} as arguments?
2671
For some teaching I've been doing, I'd like to have code from two different languages side-by-side.  To do so, I hacked together a newcommand which uses a tabular environment to arrange two verb environments, but the problems are myriad:   Indentation can only be accomplished by changing spaces to ~'s Any math symbols have to be escaped with \, which requires knowing which ones to escape and which ones not to (can't escape the &lt;'s for instance, otherwise it complains) The &lt;- assignment operator gets changed into an upside down !- when compiled.   The listings environment doesn't work either.  Error message is:  Runaway argument? ! Forbidden control sequence found while scanning use of \lst@next. &lt;inserted text&gt;                  \par  l.23 \codeListing{x &lt;- y}{f(g(x))}   Here's some code to reproduce the problem:  \documentclass[english]{article} \usepackage[latin9]{inputenc} \usepackage{geometry} \begin{document}  \newcommand{\codeListing}[2]{ \begin{tabular}{p{8cm} p{8cm}} \begin{lstlisting} #1 \end{lstlisting} &amp; #2\tabularnewline \end{tabular} }  \section{verbatim test} \begin{verbatim} logLik &lt;- function(x) {    y &lt;&lt;- x^2+2   return(sum(sqrt(y+7))) } \end{verbatim}  \section{codeListing test} \codeListing{}{ logLik &lt;- function(x) \{   ~~y &lt;&lt;- x\^2+2  ~~return(sum(sqrt(y+7)))  \}  }  \end{document}   Is there any way to make a newcommand wrap parameter-passed code?  It doesn't have to be keyword-highlighted or do any of the other tricks that the fancier packages do; it just has to preserve whitespace and no interpret code as latex commands.
122840
I want to create a collection of exercises. For this I constructed an environment for the exercises:  \documentclass[12pt,a4paper]{article} \usepackage[utf8]{inputenc}  \newcounter{wf} \setcounter{wf}{0}  \newcounter{Aufg} \setcounter{Aufg}{0}  \newcommand{\Punkte}{0}  \newenvironment{Aufgabe}[1]{% \renewcommand*{\Punkte}{#1}% \nopagebreak% \begin{list}{}{} \item[]% \makebox[0pt][l]{%       \hspace{-1cm}\refstepcounter{Aufg}\textbf{\arabic{Aufg}}}%}% \ignorespaces}{ \ifnum \Punkte&gt;0 \hspace*{0pt} \hfill \mbox{(\Punkte\ BE)} \fi% \end{list}% }  \begin{document} \begin{Aufgabe}{5} This is exercise number one. Topic: Alpha \end{Aufgabe} \begin{Aufgabe}{4} And here we have exercise number two. Topic: Beta \end{Aufgabe} \begin{Aufgabe}{2} Finally exercise number three. Topic: Gamma \end{Aufgabe} \end{document}   I also have substructures for the exercises (exercise A2.1.1 or so) but I want to keep it simple here and just take a look on the exercise numbers.  For an index normally I would write \index{Alpha} in exercise number one (and Beta in two and gamma in three) and this would give me:   Alpha   1  Beta    1  Gamma   1  Because it refers to the page number. But what I really want is an index which gives me the exercise number. So for example using \myindex{Alpha} in exercise one (and Beta in two and Gamma in three) and it should result to  Alpha   1  Beta    2  Gamma   3  Or if there is a more complex structure and exercises with the same topic it should be like this:  Alpha   A2.2; A3.4  Beta    B1.1; B1.2.1; B1.2.2  Gamma   A1; B5.4   and so on.   Do you have any ideas for this special problem?  Thank you in advance for your help.
13962
I often see things like     read man xyz   For more information read xyz's man page.   see info xyz    so I wonder:   How can I get help on terminal commands generally? What exactly are these man and info pages?   How can I find and view them?
15709
I want to print two files in two columns -- first file on the left side and second on the right side. paste doesn't do the job, because it can only insert a character as delimiter, so if first file lines have different length output will be twisted: $ cat file1 looooooooong line line $ cat file2 hello world $ paste file1 file2 looooooooong line   hello line    world  If it was a command to add trailing spaces like fmt --add-spaces --width 50 the problem would be solved: $ paste &lt;(fmt --add-spaces --width 50 file1) file2 looooooooong line                                 hello line                                              world  But I don't know a simple way to do this. So how to merge and print several files horizontally without twisting? Actually, I just want to look at them simultaneously.  UPD: command to add trailing spaces does exist (for example, xargs -d '\n' printf '%-50s\n') But solution like $ paste &lt;(add-trailing-spaces file1) file2  does not work as expected when file1 has fewer lines than file2.
6700
A sample /etc/group file contains the following entries:  root:*:0: adm:!:4:logcheck antoine:x:1000:   The man pages I've read (Debian &amp; OSX) says the second field is to store a group password.  As they are rarely used, an asterisk * or a x is usually placed in it rather than leaving it blank.  The shadow man page also says that this second field should store the result of the crypt function.  And if an invalid result is stored (such as * or !) it means the password cannot be used as authentication method.  Does that hold true for the group file as well?  Why do I end up with 3 different characters in my group file all having the same meaning?  Can I safely change all to *?
117627
I followed the advice on the question  to try to make a custom command that displays a custom title page, but it is not working.   ./article.tex:17: You can't use `\spacefactor' in vertical mode.\@ -&gt;\spacefactor                   \@m l.17 \makecustomtitle  Sorry, but I'm not programmed to handle this case; I'll just pretend that you didn't ask for it. If you're in the wrong mode, you might be able to return to the right one by typing `I}' or `I$' or `I\par'. ./article.tex:17: Missing $ inserted.&lt;inserted text&gt;                 $ l.17 \makecustomtitle  I've inserted a begin-math/end-math symbol since I think you left one out. Proceed, with fingers crossed. ./example.tex:17: You can't use `\spacefactor' in math mode.\@ -&gt;\spacefactor                   \@m l.17 \makecustomtitle  Sorry, but I'm not programmed to handle this case; I'll just pretend that you didn't ask for it. If you're in the wrong mode, you might be able to return to the right one by typing `I}' or `I$' or `I\par'. ./example.tex:17: Missing $ inserted.&lt;inserted text&gt;                 $ l.17 \makecustomtitle  I've inserted a begin-math/end-math symbol since I think you left one out. Proceed, with fingers crossed.   What follows is the simplified code:  \documentclass[12pt]{article}  \newcommand{\makecustomtitle}{ \begin{titlepage}   \makeatletter    \@title by \@author    \makeatother \end{titlepage} }  \begin{document} \title{Please, be my title} \author{Andres Riofrio}  \makecustomtitle  Take on me.  \end{document}
38606
The man command brings up a nice manual for many programs, but how can I use it more effectively? For example man gcc brings:  NAME        gcc - GNU project C and C++ compiler  SYNOPSIS        gcc [-c|-S|-E] [-std=standard]            [-g] [-pg] [-Olevel]            [-Wwarn...] [-Wpedantic]            [-Idir...] [-Ldir...]            [-Dmacro[=defn]...] [-Umacro]            [-foption...] [-mmachine-option...]            [-o outfile] [@file] infile...         Only the most useful options are listed here; see below for the        remainder.  g++ accepts mostly the same options as gcc. .... many text   But what if I need only some part of it? What is the best way to jump to the section where -Idir is described, for example?
105082
I understand that the  package provides a command \patchcommand that can be used to add material at the beginning and/or end of the replacement text of an existing macro. It works for macros with any number of normal arguments but has limitations for macros with optional arguments.   was introduced to take care of the above limitations as well as provide some additional functionality.   Now, when I try to comprehend the usage of the above packages by reading the user documentations (, ), I get the feeling that they move to implementation details a little too quickly compared to other package documentations. There are not enough explanations or examples.  I also tried to grasp the concepts by reading the  and more or less understood whatever is presented there. However, that is not enough.  So, do you think we can ask for a complete tutorial on the usage of patchcmd and xpatch? Explaining the usage of the relevant commands like \patchcmd, \pretocmd and \apptocmd as well as, \xpatchcmd, \xpretocmd and \xapptocmd with sufficient examples should suffice.
55549
I usually go to stackexchange when I face programming terminal and I spend most of time trying to append four spaces before my pasted programming code.  Is there any faster way to do it from a terminal? What would you do?
109089
Between the footnote line and the first footnote on that page, I need to add a double-space. I've tried using the \ command, but it adds a space after the number. Does anyone know a way for me to do this?