Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The problem is this: I want to use in the custom class file (named thesis.cls), a different language than English, Greek to be specific. In the .tex file I loaded the babel package with the command

\usepackage[greek,english]{babel}

that is, English as my main language. Also to change language in the .tex file I use

\newcommand{\gr}{\selectlanguage{greek}}
\newcommand{\en}{\selectlanguage{english}}

Now inside the .cls file I want to create the text below for the .tex file.

%%%%%%%%%%%%%%%%%%
\newcommand\Declaration[1]{
\btypeout{Declaration of Authorship}
\addtotoc{Declaration of Authorship}
\thispagestyle{plain}
\null\vfil
%\vskip 60\p@
\begin{center}{\huge\bf{\gr{Δήλωση Προστασίας Πνευματικών Δικαιωμάτων}}\par}\end{center}
%\vskip 60\p@
{\normalsize #1}
\vfil\vfil\null
%\cleardoublepage
}
%%%%%%%%%%%%%%%%%%%

My problem is that the Greek sentence

<<Δήλωση Προστασίας Πνευματικών Δικαιωμάτων>>

is output in a machine-like language. How can I write it in Greek?

%%%%%%%%%%
%thesis.cls (excerpt)
%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesClass{Thesis}
              [2007/22/02 v1.0
   LaTeX document class]

% declaration of options
\newif\ifdext@languagechosen

\DeclareOption{greek}{%
  \PassOptionsToPackage{greek}{babel}
  \dext@languagechosentrue
}
\DeclareOption{english}{%
  \PassOptionsToPackage{english}{babel}
  \dext@languagechosentrue
}

\def\baseclass{book}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\baseclass}}
\def\@checkoptions#1#2{
  \edef\@curroptions{\@ptionlist{\@currname.\@currext}}
  \@tempswafalse
  \@tfor\@this:=#2\do{
    \@expandtwoargs\in@{,\@this,}{,\@curroptions,}
    \ifin@ \@tempswatrue \@break@tfor \fi}
  \let\@this\@empty
  \if@tempswa \else \PassOptionsToClass{#1}{\baseclass}\fi
}
\@checkoptions{11pt}{{10pt}{11pt}{12pt}}
\PassOptionsToClass{a4paper}{\baseclass}
\ProcessOptions\relax
\LoadClass{\baseclass}
\newcommand\bhrule{\typeout{------------------------------------------------------------------------------}}

\newcommand\Declaration[1]{
\btypeout{Declaration of Authorship}
\addtotoc{Declaration of Authorship}
\thispagestyle{plain}
\null\vfil
%\vskip 60\p@
\begin{center}{\huge\bf{\tg{Δήλωση Προστασίας Πνευματικών Δικαιωμάτων}}\par}\end{center}
%\vskip 60\p@
{\normalsize #1}
\vfil\vfil\null
%\cleardoublepage
}

Here is my LaTeX file

%%%%%%%%%%%%%%%%%%%%%%%%%%%
.tex file
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[11pt, a4paper, oneside]{Thesis} % Paper size, default font size and one-sided paper
\usepackage{kmath,kerkis} % The order of the packages matters; kmath changes the default text font
\usepackage[greek,english]{babel}
\usepackage[utf8x]{inputenx}
share|improve this question
    
\bf should be changed into \bfseries; also the babel package already has \textgreek that you can try instead of your \gr command. Are you loading inputenc with the utf8 option? –  egreg Oct 3 '13 at 9:24
    
i've tried textgreek also but i have problem with the accentuation.Instead of <<Δήλωση Προστασίας Πνευματικών Δικαιωμάτων>> i get <<Δηλωση Προστασιας Πνευματικων Δικαιωματων>> I use \usepackage[utf8x]{inputenx}.If i use \usepackage[utf8]{inputenc} i'm getting the error ! LaTeX Error: Command \textAlpha unavailable in encoding LGR –  kostas Oct 3 '13 at 9:31
    
Can you try typesetting the following short document? \documentclass{article} \usepackage[utf8x]{inputenc} \usepackage[greek,english]{babel} \begin{document} \textgreek{Δήλωση Προστασίας Πνευματικών Δικαιωμάτων} \end{document} –  egreg Oct 3 '13 at 9:46
    
Yes this does the job!...but how i can make it work with the way i want?under the .cls it seems its more complicated to make it work... –  kostas Oct 3 '13 at 9:59
    
Please, be specific where the class you're using can be looked at. –  egreg Oct 3 '13 at 10:03

1 Answer 1

Don't modify the class. I think to have downloaded the one you refer to. I took the Thesis.tex file and changed the first line (with \documentclass) into

\documentclass[a4paper, 11pt, oneside]{Thesis}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage[greek,english]{babel}
\makeatletter
\renewcommand\Declaration[1]{%
  \btypeout{Declaration of Authorship}
  \addtotoc{Declaration of Authorship}
  \thispagestyle{plain}
  \null\vfil
  \vskip 60\p@
  \begin{center}\huge\bfseries
    \textgreek{Δήλωση Προστασίας Πνευματικών Δικαιωμάτων}
  \end{center}
  \vskip 60\p@
  {\normalsize #1}
  \vfil\vfil\null
  \cleardoublepage
}
\makeatother

and the Declaration page became like so

enter image description here

I just had to fix the encoding of the Chapters/Chapter1.tex file and the compilation ran smoothly with a TeX Live 2012 and also with the 2013 release. I suggest you to update your TeX distribution, and to change the utf8x option into utf8.

share|improve this answer
    
Thanks for the help.I got it working without changing anything in the .tex file...i just had to place the %\newcommand\Declaration[1]{ \btypeout{Declaration of Authorship} \addtotoc{Declaration of Authorship} \thispagestyle{plain} \null\vfil %\vskip 60\p@ \begin{center} {\huge\bf{\gr{Δήλωση Προστασίας\\Πνευματικών Δικαιωμάτων}}\par} \end{center} %\vskip 60\p@ {\normalsize #1} \vfil\vfil\null %\cleardoublepage }%after declaring the packages in the .cls file.thanks again guys –  kostas Oct 3 '13 at 11:12

Your Answer

 
discard

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.