I'm using listings to display some matlab code in my latex document but i'd like to have syntax highlighting. I've tried two ways of getting syntax highlighting and neither make the code copyable. The first is:    \usepackage{listings}  \usepackage{color}  \usepackage{textcomp}  \definecolor{listinggray}{gray}{0.9}  \definecolor{lbcolor}{rgb}{0.9,0.9,0.9}  \lstset{          backgroundcolor=\color{lbcolor},          tabsize=4,          rulecolor=,          language=matlab,          basicstyle=\scriptsize,          upquote=true,          aboveskip={1.5\baselineskip},          columns=fixed,          showstringspaces=false,          extendedchars=true,          breaklines=true,          prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},          frame=single,          showtabs=false,          showspaces=false,          showstringspaces=false,          identifierstyle=\ttfamily,          keywordstyle=\color[rgb]{0,0,1},          commentstyle=\color[rgb]{0.133,0.545,0.133},          stringstyle=\color[rgb]{0.627,0.126,0.941},  }   The other way is:   \usepackage{listings} \usepackage{color}  \definecolor{dkgreen}{rgb}{0,0.6,0} \definecolor{gray}{rgb}{0.5,0.5,0.5} \definecolor{mauve}{rgb}{0.58,0,0.82} \definecolor{ideablue}{RGB}{1,24,146}  \lstset{ %   language=matlab,                % the language of the code   basicstyle=\footnotesize,           % the size of the fonts that are used for the code   numbers=left,                   % where to put the line-numbers   numberstyle=\tiny\color{gray},  % the style that is used for the line-numbers   stepnumber=1,                   % the step between two line-numbers. If it's 1, each line                                % will be numbered   numbersep=5pt,                  % how far the line-numbers are from the code   backgroundcolor=\color{white},      % choose the background color. You must add         \usepackage{color}   showspaces=false,               % show spaces adding particular underscores   showstringspaces=false,         % underline spaces within strings   showtabs=false,                 % show tabs within strings adding particular underscores   frame=single,                   % adds a frame around the code   rulecolor=\color{black},        % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. comments (green here))   tabsize=2,                      % sets default tabsize to 2 spaces   captionpos=b,                   % sets the caption-position to bottom   breaklines=true,                % sets automatic line breaking   breakatwhitespace=false,        % sets if automatic breaks should only happen at whitespace   title=\lstname,                   % show the filename of files included with     \lstinputlisting;                               % also try caption instead of title   keywordstyle=\color{ideablue},          % keyword style   commentstyle=\color{dkgreen},       % comment style   stringstyle=\color{mauve},         % string literal style   escapeinside={\%*}{*)},            % if you want to add LaTeX within your code   morekeywords={*,...},              % if you want to add more keywords to the set   deletekeywords={...}              % if you want to delete keywords from the given language }    But neither of these make the code copyable. So what can I do so that the source code is copyable?
I need to include a couple of Python code listings, where the indentation of the lines (using some number of spaces) is significant. I would like for the code listings to be copyable, so the spaces at the beginning of the line need to be be copied along with the text.  This question has been asked in various ways before (e.g. , or ). Those questions focus on making line numbers uncopyable, though.  Making the spaces at the beginning of a line copyable seems to be harder: "I am not sure it is possible to specify in the PDF (at least in a viewer-independent way) that the indentation should be copied too" (). At , Philippe Goutet suggests a solution (turning the spaces into visible spaces, and coloring them in the background color so that they appear invisible) that works using Acrobat Reader, but not all readers. He says "It works under Acrobat Reader and it's extremely pleasant to be able to quickly copy/paste code without problem (perhaps the problem can be circumvented by writing direct PDF code to tell that it's a space, I've never had the time to try)".  Is it possible to produce a PDF with a code listing with copyable real spaces at the beginning of a line?  Minimal example: The line return x should start with four spaces.  \documentclass{article}  \begin{document} \begin{verbatim} def myfunction(x):     return x \end{verbatim} \end{document}   I know that I could attach the code to the PDF as a file, but that's not what I want.
I am trying to draw a partial box around one or more words within a paragraph--that is, a rectangle with one or more sides missing. I have read the documentation for the fancybox package and it doesn't seem to be able to do what I want. I was able to produce thus ugly hack:    That's just a vertical bar | followed by a word with \overline and \uline. The trick is to connect the vertical and horizontal lines so that you have a rectangle missing just one side.  Is there an easy, general way to do this, perhaps with Tikz? I don't know enough about that package to be able to do this myself, but I'm wondering if there might be other solutions too. As the title suggests, I'd like to prove that the sum $$ \sum_{n=2}^\infty (\ln n)^{- \ln n} $$ is finite.  The root and ratio test both fail here, but  suggests that there is a comparison that can be used to show convergence.  The only thought I have is that it may help to write the terms as $e^{-\ln(n)\ln(\ln(n))}$, but this has not led me to any particular insight.  Any ideas are appreciated. How to round a number to n decimal places in Java Automatic left and right commands Is it possible to automatically "add" \left and \right commands in front of all brackets? The source code should be left intact, but LaTeX should interpret every pair of brackets as if they were preceded by such commands. This is because adding \left and \right commands is time consuming and makes source code longer and less readable. I considered defining new commands such as \lb and \rb for \left( and \right), but it doesn't seem very elegant to me: what if I also want to add square brackets for example?  Any ideas? Thanks. How to deal with bibliography items containing long URLs? Process Unicode files with BOM correctly with POSIX tools Find the value of $a^{2m}+a^m+{1\over a^m}+{1\over a^{2m}}$ Let $a$ be a complex number such that $a^2+a+{1\over a}+{1\over a^2}+1=0$  Let $m$ be a positive integer, find the value of $a^{2m}+a^m+{1\over a^m}+{1\over a^{2m}}$  My approach: I factorized equation 1 which yielded $(a+{1\over a})={-1^+_-(5^{1\over2})\over2}$  I don't know if it is of any help. So basically, I'd like to use iwconfig to connect to my wifi network when I'm not inside X. But I just don't see a way to do it in the man page. Any idea? Make a momentary switch control a toggle What are the simplest, cheapest, smallest ways to make a momentary switch produce a 2-state toggling output (latching momentary switch)?  In other words, the output is continuously low, and when you momentarily press the button/tact switch, the output changes to continuously high, and then when you press it again, it switches back to low. How to evaluate $\int_0^{2\pi} \frac{d\theta}{A+B\cos\theta}$? I'm having a trouble with this integral expression:  $$\int_0^{2\pi} \frac{d\theta}{A+B \cos\theta}$$  I've done this substitution: $t= \tan(\theta/2)$  and get: $\displaystyle \cos\theta= \frac{1-t^2}{1+t^2}$ and $\displaystyle d\theta=\frac{2}{1+t^2}dt$ where $\displaystyle \cos^2\theta/2=\frac{1}{1+t^2}$  then the integral becomes:  $$\int\frac{2 \, dt}{(A-B)t^2+(A+B)}= \sqrt\frac{A+B}{A-B} \arctan \left(\left(\sqrt\frac{A+B}{A-B} \right) t\right)$$   However, I'm not sure about the new limits since $\tan$ has period $\pi$ so what I have to do at this point to decide the new limits? And of course if you find some mistake in what I've done before, please let me know! Density function for RV The density function for a random variable X is given in terms of a constant $c$.  Find the value of $c$.  What is the corresponding distribution function?  Sketch both the density and the distribution functions. Finally, find the probabilities.  5.1 $f(x)=0$ for $x&lt;0$ and $f(x)=\frac{c}{(x+1)^4}$ for $0&gt;x$   $P(X&gt;4)$  $P(X&lt;2)$  $P(1\le\ X&lt;3)$   I get $c=3$ by taking the integral, and then I am a little confused as to why  $F(x)=1-\frac{1}{(x+1)^3}$  Is that because in solving for $c$, I ended up with $1=\frac{c}{3(x+1)^3}$, so substituting c in I get $1=\frac{1}{(x+1)^3}$?  And, then  $P(X&gt;4)=1-P(X\le\ 4)$ $=1-(1-{1}{(1+4)^3})$ $=1/125$  $P(X&lt;2)=1-{1}{(1+2)^3}$ $=26/27$  I guess I am a little confused about what $F(x)$ and $f(x)$ actually MEAN? And thus that leads to my confusion about what the differences between $&gt;$ and $&lt;$ and greater than or equal to are, etc etc in terms of the equations. The ones above I solved by comparing to the book but I still don't understand what they mean really.  So as a result, I don't really get how to solve $P(1\le\ X&lt;3)$.  5.2 $f(x)=ce^x$ for $x&lt;0$ and $f(x)=ce^{-x}$ for $0&gt;x$  5.3 $f(x)=0$ for $x&lt;-1$ or $x&gt;2$ and $f(x)=cx^2$ for $-1&lt;x&lt;2$ If a set is linearly independent, a finite subset of that set is also linearly independent Is the above statement true? If I have already proven that the set is linearly independent, is it automatically given that the subset is also linearly independent? If so, how would I go about showing that as a proof. Change date and time format from csv file without using date -d I have a .csv file contains   Data1|Data2|10/24/2017 8:10:00 AM   I want to change date and time format of column 3 as following:  From 10/24/2017 8:10:00 AM (12-Hour) to 20171024 08:10:00(24-hour).  Not using -d Getting arguments underneath \min in an align environment Excel multiple FIND formula Grammar-checking tool for use with LaTeX? I am looking for a grammar-checking tool, i.e., something that checks for mistakes such as "two dog" or "a books".  It has to work on Linux (Ubuntu).  Also, since I use macros to generate some of the prose, it has to somehow work with LaTeX.  I don't think that such checkers are LaTeX-aware, so it has to work with some compilation product of LaTeX: DVI or PDF.    If you suggest a grammar checker that checks plain text, please explain how to you extract the text.  catdvi does a nice job, but it leaves some garbage like page numbers. Wrong text instead of reference numbers with the spbasic bibiography style I am writing a paper to a Springer journal and I am trying to use   \bibliographystyle{spbasic} However, instead of the number of the reference in the list of references I get something as:     [Hundsdorfer et al(1995)Hundsdorfer, Koren, van Loon, and Verwer]   followed by the citation  What should I do to get the number in the square brackets?  \documentclass[smallextended]{svjour3} \begin{document} \cite{Hundsdorfer:adv}  \bibliographystyle{spbasic}  \bibliography{moje.bib}   % name your BibTeX data base  \end{document}   I may have to do the bibliography manually, as no Springer provided bibtex style produces the output that can be seen in the journal articles. I use ${\dot \hat E}$ to put a hat and dot on top of an E simultaneously. However, an error occurs. How do I configure internet connection for Terminal on Ubuntu 14.04? I've installed on Ubuntu 14.04 and with I've Broadband connection setup, Browser connection is OK,  but Terminal not connection via internet, when command type "sudo apt-get update" by terminal then showing me Error, see screenshot, How I can fix this ? If $f(1)=1$, then is it true that $f(n)=n$ for all $n \in \mathbb{N}\cup\{0\}$.