I've spent few days already trying to properly include a Java source file dynamically in a tex file. The text is included. However the lines don't wrap.

The following is the "srinked" project


\usepackage[left=2.54cm, right=2.54cm, top=2.54cm, bottom=2.54cm]{geometry}  





%% All duplicates have been commented out  



\usetikzlibrary{calc, shapes, backgrounds}  
\usepackage{amsmath, amssymb}  



\lstdefinestyle{MyJavaListStyle} {  



Begining of the document.  


    static void testMe() {  
        String[][] arrTest = {  

                { "John ", "Doe", "24a", "121", "new McGill College",  
                        " a Suite 32", "2r223", "Montréal Name Of The Town1"  
                        "", "Québec", "K1A 2E3W3", "Canada" },  
                { "Zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzmabcdefghijklmnopqrstuvwxyzmabcdefghijklmnopqrs", "GivenNameZabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzmabcdefghijklmnopqrstuvwxyzmabcdefghij",  
                        "new McGill College McGill College McGill College McGill Collegea",  
                        " a Suite 32", "2r223",  
                        "Montréal Long City Name On My So So It Is Split onto",  
                        "", "Québec", "K1A 2E3", "Canada" }, };  

                                    String cpfn = m_busCompCCP.getFieldValue("CIC EAI Person Family Name"); // **report**  
                                    String cpgn = m_busCompCCP.getFieldValue("CIC EAI Person Given Name") ; //**report**  
                                    String ctdob = m_busCompCCP.getFieldValue("CIC EAI Person Textual Birth Date"); // **report**  

                                    try {  
                                        oAR.sCICPrimaryGivenName = cpgn;  
                                        oAR.sCICTextualDOB = ctdob;  
                                        // we have the data, add-it to the  
                                        // result set  

                                                                            // addonlythearchived ones; redundant check, should have been  
                                                                                                           // filtered already at the search spec BC                                        
                                        //if (status.equals(archivedENU) || status.equals(archivedFRA))  

                                    } catch (Exception exa) {  
                                                .println("Error adding a row from the result set:"  
                                                        + exa.toString());  
                                    bFound6 = m_busCompCCP.nextRecord();  
                                bFound5 = m_busCompCACO.nextRecord();  
                            bFound4 = m_busCompCPOC.nextRecord() ;  
                        bFound3 = m_busCompCAMC.nextRecord();  
                    bFound2= m_busCompAMAR.nextRecord();  



$$Retrieve\ methods$$  


Continuation of the document.


Images: first wrap

another wrap

  • 4
    It is much easier to help if you make your example a complete document that people can run locally and test answers. – David Carlisle Feb 12 '15 at 19:37
  • related: tex.stackexchange.com/questions/175719/… – jub0bs Feb 13 '15 at 8:29
  • 2
    Thank you for posting a working example! At the same time, much of your code does not seem to be relevant to the question you're asking here. Please limit the example to only the code required for your issue to appear. You can have a look at this guide for how to prune your code for this purpose. – Reinstate Monica - M. Schröder Feb 16 '15 at 22:00
  • 1
    After some testing it may look like the hyphenat package is somehow the culprit, but you should investigate this yourself, and it would be nice if you reduced your example as Martin mentions above. – Torbjørn T. Feb 18 '15 at 12:21
  • Hi Torbj\orn. Taking out the hypenat package works nearly perfect. The exceptions are when a line have too many spaces before wrapping. I'm adding a screen shot. – Iosif Tanasescu Feb 18 '15 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.