PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Zeilenumbruch in listings-Umgebung erzwingen?



Flo_Beyer
15-08-2014, 11:26
Hallo, ich möchte gern eine sehr lange XML in einem Latex-Dokument darstellen.
Das Problem ist, dass in dem Dokument kein Zeilenumbruch ist und damit aus einer langen Zeile besteht.
Gibt es eine möglichkeit, dass die Zeile automatische umgebrochen wird, ohne Rücksicht darauf, ob ein Wort zu Ende ist oder nicht?

Hier mein Code:



\documentclass[]{scrartcl}

\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{listings}

\usepackage{color}
\definecolor{gray}{rgb}{0.4,0.4,0.4}
\definecolor{darkblue}{rgb}{0.0,0.0,0.6}
\definecolor{cyan}{rgb}{0.0,0.6,0.6}
\definecolor{maroon}{rgb}{0.5,0,0}
\lstset{
basicstyle=\ttfamily,
columns=fullflexible,
showstringspaces=false,
commentstyle=\color{gray}\upshape
}

\lstdefinelanguage{XML}
{
basicstyle=\ttfamily,
morestring=[s]{"}{"},
morecomment=[s]{?}{?},
morecomment=[s]{!--}{--},
commentstyle=\color{darkgreen},
moredelim=[s][\color{black}]{>}{<},
moredelim=[s][\color{red}]{\ }{=},
stringstyle=\color{blue},
identifierstyle=\color{maroon}
}

\begin{document}
\section{example metafile}

\begin{lstlisting}[language=XML]
<?xmlversion="1.0"encoding="UTF-8"standalone="no"?><re:EarthObservationxmlns:re="http://schemas.rapideye.de/products/productMetadataGeocorrected" re_standard_product_version="4.0" version="1.2.1" xmlns:eop="http://earth.esa.int/eop" xmlns:gml="http://www.opengis.net/gml" xmlns:opt="http://earth.esa.int/opt" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.rapideye.de/products/productMetadataGeocorrected http://schemas.rapideye.de/products/re/4.0/RapidEye_ProductMetadata_GeocorrectedLevel.xsd"><gml:metaDataProperty><re:EarthObservationMetaData><eop:identifier>3654123_2014-02-08_RE5_3A_177608</eop:identifier><eop:acquisitionType>NOMINAL</eop:acquisitionType><eop:productType>L3A</eop:productType><eop:status>ARCHIVED</eop:status><eop:downlinkedTo><eop:DownlinkInformation><eop:acquisitionStation codeSpace="urn:eop:RE:stationLocation">Svalbard</eop:acquisitionStation><eop:acquisitionDate>2014-02-08T09:16:37.943948Z</eop:acquisitionDate></eop:DownlinkInformation></eop:downlinkedTo><eop:archivedIn><eop:ArchivingInformation><eop:archivingCenter codeSpace="urn:eop:RE:stationLocation">BER</eop:archivingCenter><eop:archivingDate>2014-02-08T11:39:42Z</eop:archivingDate><eop:archivingIdentifier codeSpace="urn:eop:RE:dmsCatalogueId">15537173</eop:archivingIdentifier></eop:ArchivingInformation></eop:archivedIn><eop:processing><eop:ProcessingInformation><eop:processorName>DPS</eop:processorName><eop:processorVersion>4.0.6</eop:processorVersion><eop:nativeProductFormat>GeoTIFF</eop:nativeProductFormat></eop:ProcessingInformation></eop:processing><re:license><re:licenseType>20131017-SARL - Single User</re:licenseType><re:resourceLink xlink:href="http://info.rapideye.com/license/20131017_SARL_SingleUser.txt" xlink:title="RE EULA"/></re:license><re:versionIsd>4.0</re:versionIsd><re:orderId>177608</re:orderId><re:tileId>3654123</re:tileId><re:pixelFormat>16U</re:pixelFormat></re:EarthObservationMetaData></gml:metaDataProperty><gml:validTime><gml:TimePeriod><gml:beginPosition>2014-02-08T09:15:26Z</gml:beginPosition><gml:endPosition>2014-02-08T09:16:59Z</gml:endPosition></gml:TimePeriod></gml:validTime><gml:using><eop:EarthObservationEquipment><eop:platform><eop:Platform><eop:shortName>RE00</eop:shortName><eop:serialIdentifier>RE-5</eop:serialIdentifier><eop:orbitType>LEO</eop:orbitType></eop:Platform></eop:platform><eop:instrument><eop:Instrument><eop:shortName>MSI</eop:shortName></eop:Instrument></eop:instrument><eop:sensor><re:Sensor><eop:sensorType>OPTICAL</eop:sensorType><eop:resolution uom="m">6.5</eop:resolution><re:scanType>PUSHBROOM</re:scanType></re:Sensor></eop:sensor><eop:acquisitionParameters><re:Acquisition><eop:orbitDirection>DESCENDING</eop:orbitDirection><eop:incidenceAngle uom="deg">9.980000e+00</eop:incidenceAngle><opt:illuminationAzimuthAngle uom="deg">1.680250e+02</opt:illuminationAzimuthAngle><opt:illuminationElevationAngle uom="deg">4.177254e+01</opt:illuminationElevationAngle><re:azimuthAngle uom="deg">2.761400e+02</re:azimuthAngle><re:spaceCraftViewAngle uom="deg">8.328400e+00</re:spaceCraftViewAngle><re:acquisitionDateTime>2014-02-08T09:16:37.943948Z</re:acquisitionDateTime></re:Acquisition></eop:acquisitionParameters></eop:EarthObservationEquipment></gml:using><gml:target><re:Footprint><gml:multiExtentOf><gml:MultiSurface srsName="EPSG:4326"><gml:surfaceMembers><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>3.274167534464338e+01 3.504388331635541e+01 3.273704283732177e+01 3.531047539325740e+01 3.251174840173721e+01 3.530469153181017e+01 3.251634118353972e+01 3.503876561821361e+01 3.274167534464338e+01 3.504388331635541e+01</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMembers></gml:MultiSurface></gml:multiExtentOf><gml:centerOf><gml:Point srsName="EPSG:4326"><gml:pos>3.262675e+01 3.517445e+01</gml:pos></gml:Point></gml:centerOf><re:geographicLocation><re:topLeft><re:latitude>3.274167534464338e+01</re:latitude><re:longitude>3.504388331635541e+01</re:longitude></re:topLeft><re:topRight><re:latitude>3.273704283732177e+01</re:latitude><re:longitude>3.531047539325740e+01</re:longitude></re:topRight><re:bottomRight><re:latitude>3.251174840173721e+01</re:latitude><re:longitude>3.530469153181017e+01</re:longitude></re:bottomRight><re:bottomLeft><re:latitude>3.251634118353972e+01</re:latitude><re:longitude>3.503876561821361e+01</re:longitude></re:bottomLeft></re:geographicLocation></re:Footprint></gml:target><gml:resultOf><re:EarthObservationResult><eop:browse><eop:BrowseInformation><eop:type>QUICKLOOK</eop:type><eop:referenceSystemIdentifier codeSpace="EPSG">4326</eop:referenceSystemIdentifier><eop:fileName>3654123_2014-02-08_RE5_3A_177608_browse.tif</eop:fileName></eop:BrowseInformation></eop:browse><eop:product><re:ProductInformation><eop:fileName>3654123_2014-02-08_RE5_3A_177608.tif</eop:fileName><eop:size uom="KB">244181</eop:size><re:productFormat>GeoTIFF</re:productFormat><re:spatialReferenceSystem><re:epsgCode>32636</re:epsgCode><re:geodeticDatum>WGS_1984</re:geodeticDatum><re:projection>WGS 84 / UTM zone 36N</re:projection><re:projectionZone>36</re:projectionZone></re:spatialReferenceSystem><re:resamplingKernel>CC</re:resamplingKernel><re:numRows>5000</re:numRows><re:numColumns>5000</re:numColumns><re:numBands>5</re:numBands><re:rowGsd>5</re:rowGsd><re:columnGsd>5</re:columnGsd><re:radiometricCorrectionApplied>true</re:radiometricCorrectionApplied><re:geoCorrectionLevel>Precision Geocorrection</re:geoCorrectionLevel><re:elevationCorrectionApplied>FineDEM</re:elevationCorrectionApplied><re:atmosphericCorrectionApplied>false</re:atmosphericCorrectionApplied></re:ProductInformation></eop:product><eop:mask><eop:MaskInformation><eop:type>UNUSABLE DATA</eop:type><eop:format>RASTER</eop:format><eop:referenceSystemIdentifier codeSpace="EPSG">32636</eop:referenceSystemIdentifier><eop:fileName>3654123_2014-02-08_RE5_3A_177608_udm.tif</eop:fileName></eop:MaskInformation></eop:mask><opt:cloudCoverPercentage uom="%">0</opt:cloudCoverPercentage><opt:cloudCoverPercentageQuotationMode>AUTOMATIC</opt:cloudCoverPercentageQuotationMode><re:unusableDataPercentage uom="%">0</re:unusableDataPercentage><re:bandSpecificMetadata><re:bandNumber>1</re:bandNumber><re:percentMissingLines>0.000000000000000e+00</re:percentMissingLines><re:percentSuspectLines>0.000000000000000e+00</re:percentSuspectLines><re:binning>1x1</re:binning><re:shifting>1</re:shifting><re:masking>111</re:masking><re:radiometricScaleFactor>9.999999776482582e-03</re:radiometricScaleFactor></re:bandSpecificMetadata><re:bandSpecificMetadata><re:bandNumber>2</re:bandNumber><re:percentMissingLines>0.000000000000000e+00</re:percentMissingLines><re:percentSuspectLines>0.000000000000000e+00</re:percentSuspectLines><re:binning>1x1</re:binning><re:shifting>1</re:shifting><re:masking>111</re:masking><re:radiometricScaleFactor>9.999999776482582e-03</re:radiometricScaleFactor></re:bandSpecificMetadata><re:bandSpecificMetadata><re:bandNumber>3</re:bandNumber><re:percentMissingLines>0.000000000000000e+00</re:percentMissingLines><re:percentSuspectLines>0.000000000000000e+00</re:percentSuspectLines><re:binning>1x1</re:binning><re:shifting>1</re:shifting><re:masking>111</re:masking><re:radiometricScaleFactor>9.999999776482582e-03</re:radiometricScaleFactor></re:bandSpecificMetadata><re:bandSpecificMetadata><re:bandNumber>4</re:bandNumber><re:percentMissingLines>0.000000000000000e+00</re:percentMissingLines><re:percentSuspectLines>0.000000000000000e+00</re:percentSuspectLines><re:binning>1x1</re:binning><re:shifting>1</re:shifting><re:masking>111</re:masking><re:radiometricScaleFactor>9.999999776482582e-03</re:radiometricScaleFactor></re:bandSpecificMetadata><re:bandSpecificMetadata><re:bandNumber>5</re:bandNumber><re:percentMissingLines>0.000000000000000e+00</re:percentMissingLines><re:percentSuspectLines>0.000000000000000e+00</re:percentSuspectLines><re:binning>1x1</re:binning><re:shifting>1</re:shifting><re:masking>111</re:masking><re:radiometricScaleFactor>9.999999776482582e-03</re:radiometricScaleFactor></re:bandSpecificMetadata></re:EarthObservationResult></gml:resultOf></re:EarthObservation>
\end{lstlisting}

\end{document}

klops
15-08-2014, 13:30
Siehe Abschnitt 4.10 der Anleitung zum Paket listings.

Flo_Beyer
15-08-2014, 13:50
Danke, hat geklappt:



\begin{lstlisting}[language=XML,breaklines=true]

...