I compile my tex file with xelatex

and I want to renew the \lstlistlistingname

In this case, I just use \renewcommand to do this job.

It success if I put this command after package in tex file

but how can I move this command to .sty file.

Notice, The new lstlistlistingname is some CJK character and the file encoding with UTF-8

  • ? Where is your problem. If it is a personal style you can use utf8 chars if you want. – Ulrike Fischer Jun 21 '12 at 17:46
  • Do you input CJK enconding first and then redefine lstlistlistingname? – robert.marik.cz Jun 21 '12 at 19:07
  • Which .sty file do you put it in? Please provide a miniaml working example. – Leo Liu Jun 22 '12 at 10:04

This example works for me:

The package:

% encoding: UTF-8
% ccode.sty
\ProvidesPackage{ccode}[2012/06/22 test listings]

The test document:

% encoding: UTF-8
% foo.tex
#include <stdio.h>
int main()
    puts("Hello world.");
    return 0;

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.