Adding C++ code snippets in LaTeX using “listings”

We will always have to use code snippets in LaTeX.  The method I use to implement this is using the package listings.

I add an example here.


and later

  // Set up FW Lite for automatic loading of CMS libraries
  // and data formats.   As you may have other user-defined setup
  // in your rootlogon.C, the CMS setup is executed only if the CMS
  // environment is set up.
  TString cmsswbase = getenv("CMSSW_BASE");
  if (cmsswbase.Length() > 0) {
    // The CMSSW environment is defined (this is true even for FW Lite)
    // so set up the rest.
    cout << "Loading FW Lite setup." << endl;

Leave a comment

Filed under LaTeX

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s