TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
? 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
up vote 3 down vote accepted

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;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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