Seite 1 von 1

Dollarzeichen in programm Umgebung

Verfasst: Mi 21. Jan 2009, 10:45
von freaksta
Hallo Leute!

Ich bin neu hier und habe auch gleich ein erstes Problem. Ich bin im Moment am schreiben eines Artikels in Latex. Dazu habe ich das ganze mit dieser Umgebung erweitert um Programmteile einbinden zu können:
% Use a small font for the verbatim environment
\makeatletter  % makes '@' an ordinary character
\renewcommand{\verbatim@font}{
  \ttfamily\tiny\itshape\catcode`\<=\active\catcode`\>=\active }
\makeatother % makes '@' a special symbol again
%
% Prettyprint of XML
\usepackage{float}
\floatstyle{ruled}
\newfloat{program}{h}{lop}
\floatname{program}{Code}
%
Nun habe ich aber das Problem, dass ich in einer Programm Umgebung ein $ Zeichen brauche. Normal sollte er ja einfach das rausschreiben was in dieser Umgebung steht...aber es kommt statt Dollar ein Pfund-Zeichen (das komische L)...

...weiß einer Rat?

Danke schonmal!

Dollarsymbol

Verfasst: Mi 21. Jan 2009, 12:45
von Stefan Kottwitz
Hallo,

willkommen im Forum!
Wenn Du ein Minmimalbeispiel zeigst, könnten wir das Problem konkret nachvollziehen.

Viele Grüße,

Stefan

Verfasst: Mi 21. Jan 2009, 13:46
von DonCube
Also Stefans Rat solltest du zunächst beherzigen. Aber vielleicht meinst du einfach ein $ Zeichen in deinem Dokument? Versuch mal \$. Das müsste gehen.

Verfasst: Do 22. Jan 2009, 11:50
von freaksta
Achja, stimmt...sorry, hier ist das Beispiel:
\documentclass[a4paper]{article}

% Use a small font for the verbatim environment
\makeatletter  % makes '@' an ordinary character
\renewcommand{\verbatim@font}{
  \ttfamily\tiny\itshape\catcode`\<=\active\catcode`\>=\active }
\makeatother % makes '@' a special symbol again
%
% Prettyprint of XML
\usepackage{float}
\floatstyle{ruled}
\newfloat{program}{h}{lop}
\floatname{program}{Code}
%

\begin{document}

\begin{program}
\begin{verbatim}

$   \$

\end{verbatim}
\caption{Example for dollar}
\label{code:creator}
\end{program}

\end{document}
escapen funktioniert nicht, da er alle zeichen einfach rausschreibt...keine ahnung warum das dann mitm $ nicht geschieht...

...danke schonmal für die Bemerkungen!

Schriftcodierung

Verfasst: Do 22. Jan 2009, 12:12
von Stefan Kottwitz
Hallo,

es funktioniert mit
\usepackage[T1]{fontenc}
Viele Grüße,

Stefan

Verfasst: Do 22. Jan 2009, 12:53
von freaksta
Super!!! Dankeschön :)

Es funktioniert damit zumindest schon mal in meinem Minimalbeispiel...leider mit dem Style den ich verwenden muss nicht...

Schriftcodierung

Verfasst: Do 22. Jan 2009, 19:07
von Stefan Kottwitz
Hallo,

Du könntest Deine Vorlage als Anhang hier posten, dann kriegen wir das sicher auch hin. Oder versuche, aus der Vorlage heraus ein Minimalbeispiel zu produzieren, durch schrittweise Reduktion. Evtl. poste die Einstellungen der Vorlage, die mit Schriftart bzw. Schriftcodierung zu tun haben.

Viele Grüße,

Stefan

php code ausgeben mit $ und "

Verfasst: Mi 24. Feb 2010, 16:32
von SWNbg
Hallo,
das ist mein php-Script.
<?php

/********************************************
PayReceipt.php

This file is called after the user clicks on a button during
the Pay process to use PayPal's AdaptivePayments Pay features.
The user logs in to their PayPal account.
Called by sp_...php
Calls  CallerService.php,and APIError.php.
********************************************/

require_once '../lib/AdaptivePayments.php';
require_once 'web_constants.php';

session_start();

			try {
				
		        /* The servername and serverport tells PayPal where the buyer
		           should be directed back to after authorizing payment.
		           In this case, its the local webserver that is running this script
		           Using the servername and serverport, the return URL is the first
		           portion of the URL that buyers will return to after authorizing payment                */
		
		           $serverName = $_SERVER['SERVER_NAME'];
		           $serverPort = $_SERVER['SERVER_PORT'];
		           $url=dirname('http://'.$serverName.':'.$serverPort.$_SERVER['REQUEST_URI']);
		
		
		           /* The returnURL is the location where buyers return when a
		            payment has been succesfully authorized.
		            The cancelURL is the location buyers are sent to when they hit the
		            cancel button during authorization of payment during the PayPal flow                 */
		
		           $returnURL = $url. "../";
		           $cancelURL = $url. "../";
		           //$currencyCode =$_REQUEST['currencyCode'];
		           $currencyCode = "EUR";
		           //$email = $_REQUEST["email"];
		           $email = "buyer_1257249283_pre@domain.tld";
				   //$preapprovalKey = $_REQUEST["preapprovalKey"];
				   $preapprovalKey = "PA-nummer";	
		           $requested='';
		           //$receiverEmail='';
		           $receiverEmail = 'seller_1265314515_biz@domain.tld';
		           $amount='';
		           $count= count($_POST['receiveremail']);
		           //$customerID = $_REQUEST["customerId"];
		           $customerID = "2072355";
		           $memo = $_REQUEST["memo"];
		           $memo = "Matrikelnummer: " . $customerID . "<br /> Verwendungszweck: " . $memo;
		                                 
		           $payRequest = new PayRequest();
		           $payRequest->actionType = "PAY";
				   $payRequest->cancelUrl = $cancelURL ;
				   $payRequest->returnUrl = $returnURL;
				   $payRequest->clientDetails = new ClientDetailsType();
				   $payRequest->clientDetails->applicationId ="APP-1JE4291016473214C";
		           $payRequest->clientDetails->deviceId = "127001";
		           $payRequest->clientDetails->ipAddress = "127.0.0.1";
		           /*customerId*/
		           $payRequest->clientDetails->customerId = $customerID;
		           
		           $payRequest->currencyCode = $currencyCode;
		           $payRequest->senderEmail = $email;
		           $payRequest->requestEnvelope = new RequestEnvelope();
		           $payRequest->requestEnvelope->errorLanguage = "en_US";
		           if($preapprovalKey != "")
		           {
		           	$payRequest->preapprovalKey = $preapprovalKey ;
		           }          	
		           $receiver1 = new receiver();
		           //$receiver1->email = $_POST['receiveremail'][0];
		           $receiver1->email = $receiverEmail;
		           $receiver1->amount = $_REQUEST['amount'][0];
		           
		           //$receiver2 = new receiver();
		           //$receiver2->email = $_POST['receiveremail'][1];
		           //$receiver2->amount = $_REQUEST['amount'][1];
		           	
		           $payRequest->receiverList = array($receiver1);
		           	           	
		           $payRequest->memo = $memo;
		           		           	
		           /* Make the call to PayPal to get the Pay token
		            If the API call succeded, then redirect the buyer to PayPal
		            to begin to authorize payment.  If an error occured, show the
		            resulting errors
		            */
		           $ap = new AdaptivePayments();
		           $response=$ap->Pay($payRequest);
		           
		           if(strtoupper($ap->isSuccess) == 'FAILURE')
					{
						$_SESSION['SOAPFAULT']=$ap->getLastError();
						$location = "APIError.php";
						header("Location: $location");
					
					}
					else
					{
						$_SESSION['payKey'] = $response->payKey;
						if($response->paymentExecStatus == "COMPLETED")
						{
							//$location = "../sp_details.php";
							$location = "../";
							header("Location: $location");
						}
						else
						{
							$token = $response->payKey;
							$payPalURL = PAYPAL_REDIRECT_URL.'_ap-payment&paykey='.$token;
		                    header("Location: ".$payPalURL);
						}
					}
			}
			catch(Exception $ex) {
				
				$fault = new FaultMessage();
				$errorData = new ErrorData();
				$errorData->errorId = $ex->getFile() ;
  				$errorData->message = $ex->getMessage();
		  		$fault->error = $errorData;
				$_SESSION['SOAPFAULT']=$fault;
				$location = "APIError.php";
				header("Location: $location");
			}

?>
Den binde ich wie alle meine Listings per
\lstinputlisting[caption={sp-receipt.php - Datenverarbeitung},label=code:sp_receipt.php]{listings/webapp/sp_receipt.php}
ein.

Leider kommen 101 Fehlermeldung, hauptsächlich zu den $- und "-Zeichen.

Jemand einen Rat?

Vielen Dank.

Gruß Stefan