Quantcast
Channel: Active questions tagged copy-paste - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 84

How can I make source code included with minted copyable?

$
0
0

Is it possible to make source code with minted copyable?

Here is a minimal example how I include source code (completely, with minimal java code, on GitHub):

\documentclass{beamer}\usepackage[utf8]{inputenc} % this is needed for german umlauts\usepackage[ngerman]{babel} % this is needed for german umlauts\usepackage[T1]{fontenc}    % this is needed for correct output of umlauts in pdf\usepackage{minted}         % needed for the inclusion of source code\begin{document}    \section{Section}    \subsection{MySubSection}    \begin{frame}{Blubtitle}        \inputminted[linenos=true, numbersep=5pt, tabsize=4, fontsize=\small]{java}{IataCode.java}    \end{frame}\end{document}

When I copy the results, I get this:

public class IataCode {public static void printIATACodes(String[] myArray) {for (int i = 0; i < myArray.length; i++) {System.out.println(myArray[i]);}}7public static void main(String[] args) {String[] iataCodes = new String[4];// Flughafen MüncheniataCodes[0] = "MUC";// Flughafen Berlin BrandenburgiataCodes[1] = "BER";// Flughafen AugsburgiataCodes[2] = "AGB";printIATACodes(iataCodes);}89101112131415161718}

But I would like to get this:

public class IataCode {    public static void printIATACodes(String[] myArray) {        for (int i = 0; i < myArray.length; i++) {            System.out.println(myArray[i]);        }    }    public static void main(String[] args) {        String[] iataCodes = new String[4];        // Flughafen München        iataCodes[0] = "MUC";        // Flughafen Berlin Brandenburg        iataCodes[1] = "BER";        // Flughafen Augsburg        iataCodes[2] = "AGB";        printIATACodes(iataCodes);    }}

So, I basicly want to know if I can achieve this (see compiled PDF and minimal source code example to try it yourself) for minted, too.


Viewing all articles
Browse latest Browse all 84

Latest Images

Trending Articles



Latest Images