我想用希腊语替换“Secon”和“SubSecon”这两个词。我还想让目录正确显示所有内容。这是我的代码:
\documentclass{article}
\renewcommand{\thesection}{Secon \arabic{section}}
\renewcommand{\thesubsection}{SubSecon \arabic{subsection}}
\begin{document}
\tableofcontents
\section{A section}
\subsection{First subsection}\label{subsec:first}
Some text from subsection \ref{subsec:second}.
\subsection{Second subsection}\label{subsec:second}
Some text from subsection \ref{subsec:first}.
\end{document}
答案1
您可以像平常一样使用希腊语:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[greek,english]{babel}
\renewcommand{\thesection}{\foreignlanguage{greek}{Ενότητα} \arabic{section}}
\renewcommand{\thesubsection}{\foreignlanguage{greek}{Υποδιαίρεση} \arabic{subsection}}
% I trust Google translate :))
\begin{document}
\tableofcontents
\section{A section}
\subsection{First subsection}\label{subsec:first}
Some text from subsection \ref{subsec:second}.
\subsection{Second subsection}\label{subsec:second}
Some text from subsection \ref{subsec:first}.
\end{document}
然而输出结果极其混乱。
您应该使用titlesec
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[greek,english]{babel}
\usepackage{titlesec}
\titleformat{\section}{\Large\bfseries}
{\foreignlanguage{greek}{Ενότητα} \thesection\quad}{0pt}{}
\titleformat{\subsection}{\large\bfseries}
{\foreignlanguage{greek}{Υποδιαίρεση} \thesubsection\quad}{0pt}{}
% I trust Google translate :))
\begin{document}
\tableofcontents
\section{A section}
\subsection{First subsection}\label{subsec:first}
Some text from subsection \ref{subsec:second}.
\subsection{Second subsection}\label{subsec:second}
Some text from subsection \ref{subsec:first}.
\end{document}
如果您的文档全部是希腊语,请考虑将babel
希腊语设置为全球语言。