I'm doing a project where I need programming source code printed throughout a PDF, with syntax highlighting and keeping the original spacing and indentation intact so copy/pasting works. Because I also need the fontspec package, I can't use the answer from . I've been able to get it almost perfect with the listings package, but, although it prints the indenting fine, all leading indents/spaces aren't copyable!  I have tried most of the listings settings, many random hacks found online (most resulted in crashes or weird underscores rather than spaces), minted (crashed xetex (and yes, I am using --shell-escape)), verbatim, and verbments (crashed xetex also).  This is what I have so far:  \documentclass[12pt]{article}  \usepackage{color} \usepackage{fancyvrb} \usepackage{listings} \usepackage{textcomp}  \usepackage{fontspec} \setmonofont[Scale=0.8, Path=/usr/share/fonts/OTF/]{Inconsolata.otf}  %\setmonofont[Scale=0.8]{inconsolata} % can't find the font unless I do the above...  \lstset{     basicstyle=\small\ttfamily,     keywordstyle=\color{red},     identifierstyle=,     commentstyle=\color{blue},     stringstyle=\color{green},     showstringspaces=false,     tabsize=4,     numbers=left,     captionpos=b,     numberstyle=\tiny,     keepspaces=true,     numbers=none,     columns=fullflexible,     fancyvrb=true,     language=python     }  \begin{document}  And so we have the following...  \begin{lstlisting} # sample code def main():     i = 0     while i &lt; 5:         print(i)         i += 1 \end{lstlisting}  \end{document}   Note that this appears fine on the pdf, but it loses the indentation spaces on copy/paste. Surely, by now, there is an up-to-date solution that will work with xelatex and not be pdf-viewer specific?
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.
Rasterizing a plot make axes ticks invisible Can I put \fbox along the diagonal so that they touch each other? Moving Grub to a new drive to get rid of Windows Where does the Mac store account pictures? I took a picture to add to my account on Mac.   Now I want to use it on messenger, but I can't find it. On the account config, it's too small. I need to find the original.   Where are the accout pictures stored on a Mac? How do I calculate the power consumed by a lightbulb? How can I get sql string, generated by Linq2SQL ORM? The Degree of Zero Polynomial. I wonder why the degree of the zero polynomial is $-\infty$ ?  I heard that, it is $-\infty$ to make the formula $\deg(fg)=\deg(f)+\deg(g)$ hold when one of these polynomials is zero. However, if that was the only reason we could have said that it is $\infty$ instead. Are there any open source alternative to Landscape? I have a question about inheritance in Java.  I have two classes A and B , and class B, inherits from A:  public class A {      public A() {          System.out.println("Hi!");      } }   public class B extends A {      public B() {          System.out.println("Bye!");      }       public static void main(String[] args) {          B b = new B();      } }   When I run program B, the output is:  Hi! Bye!      Question : why the constructor of class A is invoked, when I create and object of class B ?    I know that B inherits everything from A - all instance or class variables, and all methods, and in this sense an object of B has all characteristics of A plus some other characteristics defined in B. However, I didn't know and didn't imagine that when I create an object of type B, the constructor of A is also invoked. So, writing this:  B b = new B();   creates Two objects - one of type B, and one of type A.  This is getting interesting,   can somebody explain why exactly this happens? How can I add four spaces before each lines of programs code in terminal How to represent a list as a cycle UK Visitor Visa: Required Time or Interval Between Visits? Tracking down an old sci-fi book I'm trying to track down an old sci-fi book I read when I was a teenager.  The book was at the Cottage Grove, OR Public Library around 1982-1985.  The plot followed a brother and sister who were scientists or spies, or both.  The brother once used a series of pills to change his weight, height and appearance.  Towards the end of the book, the brother takes a space ship that his sister invented, removes a governor so that he can travel faster than the speed of light and goes back in time several hours.  This is really vague, but thanks for any leads you can share. Page-wide table in two-column mode I want a table that is as wide as the whole page in a document with option twocolumn. The table has to be inserted on the bottom of the page, but that is not necessary.  I've tried:  \begin{table*}[b]   ... \end{table*}   But that puts the table at the end of the document instead of on the same page.  I also tried:  \twocolumn[   \begin{table}[b]     ...   \end{table} ]   But that gives me an error: ! Argument of \@xfloat has an extra }. Combining \twocolumn and the star mark gives the same error.  What's the right way to do this? Can a class overload methods that also exist in the publicly inherited interface? It seems like this is unambiguous and useful, but compilers (VC, Intel, GCC) all complain, at least by my construction. Below is a toy example. The inherited rebound() function has two clear overloads, yet this will not compile.  If you rename the rebound() method in either class, it works fine, but if they share the same member function name (even though they're overloaded with different argument types!) you get a fatal error of "too few arguments to function call."  The workaround is trivial (I'll just rename the methods) but I'm just trying to understand if this is a C++ restriction (and why it would be).   #include  class Bound { public:   Bound() : x0(0.0), x1(0.0) {};   Bound(double x) : x0(x), x1(x) {};   double width() const {return x1-x0;}   void rebound(const Bound *a, const Bound *b); private:   double x0, x1; };  void Bound::rebound(const Bound *a, const Bound *b) {   if (a && b) {     x0=std::min(a->x0, b->x0);     x1=std::max(a->x1, b->x1);   } }  class Node : public Bound { public:   Node(double x) : Bound(x), left(0), right(0) {};   Node(Node *a, Node *b) : left(a), right(b) {rebound();}   void rebound() { rebound(left, right); } private:   Node *left;   Node *right; };   int main() {   Node A(1.0);   Node B(2.0);   Node C(&A, &B); } (a) Solve the equation $yu_x+xu_y=0$  with the condition $u(0,y) = e^{-y^2}$. (b) In which region of the xy plane is the solution uniquely determined?     I did the first part but I don't understand how to do part b.  I read   But I don't understand how the argument is based. A more clear explanation is appreciated Isomorphism between $\mathbb{C}^* $ under multiplication with $\mathbb{C}$ under addition. Does there exists an Isomorphism between $\mathbb{C}^* $ under multiplication with $\mathbb{C}$ under addition.  Attempt In my opinion It does not exists.  If there exists such an isomorphism say $\phi :\mathbb{C}^* \to \mathbb{C}$ then, from the fact that Isomorphism takes identity to identity we have $$\phi \left( 1 \right)=0$$  From the fact      Given $\phi:G \to H$ be an isomorphism, then For a fixed integer $k$ and a fixed group element $b$ in $G$, the   equation $x^k=b$ has the same number of solutions in $G$ as does   the equation $x^k=\phi\left(b\right)$ in $H$.   We have $x^4=1$ and $x^4=0$ must have same number of solutions, but the solutions to these equations are 4 and 1 only. I need to compile between two and four times before I see changes I make in the editor (TeXstudio) and each time I compile, a new .tex file is created with random letters and numbers at the end.   For example, If I create the file hello.tex and compile two to four times I'll get the file,   hello.tex.QU6664      then I make some small changes in the editor and compile two to four times I'll get the additional file,   hello.tex.Ak6664   After continuing to do this (each time compiling between two to four times before I see the changes I made), I now have many files that look like  hello.tex.QU6664, hello.tex.Ak6664, hello.tex.YX6664, hello.tex.sN6664, hello.tex.Ss6664, ...   A little bit of additional information (in case it's relevant): Everything was working fine up until a few days ago, i.e. only needed to compile once and only the file hello.tex was created. I still only get one .aux,  .synctex and .pdf files. I use TeXstudio to write and compile. I don't think it has anything to do with the bibliography (I tried removing bibliography altogether and still having the same problem).  How do I prevent these additional files from appearing and only compiling once like I used to? Has anyone had a similar problem? Edit Mode Transparent Objects What developer text editors are available for Ubuntu?