How to change languages before begin{document} command
I am trying to write my cv in greek and I noticed that the email wasn't in english but in greek. After that, I also noticed that the commands for changing languages don't work because the begin{document}
command is after the email
command. So, we want to write the email in english and the rest in greek. Here is my code:
documentclass[11pt,a4paper]{moderncv}
moderncvstyle{classic}
moderncvcolor{blue}
usepackage[american,greek]{babel}
usepackage{enumerate}
usepackage[scale=0.75]{geometry}
usepackage[utf8x]{inputenc}
setlength{hintscolumnwidth}{22mm}
setlength{makecvheadnamewidth}{100mm}
newcommand{gr}{selectlanguage{greek}}
newcommand{am}{selectlanguage{american}}
%---------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%---------------------------------------------------------------------------
firstname{ΟΝΟΜΑ} % Your first name
familyname{ΕΠΩΝΥΜΟ} % Your last name
title{Βιογραφικό Σημείωμα}
address{Αθήνα, Ελλάδα}
mobile{(+30) 999999999}
email{ email_in_english@help.com }
photo[100pt][0pt]{123.jpg}
%-------------------------------------------------------------------------
begin{document}
makecvtitle % Print the CV title
%---------------------------------------------------------------------------
% EDUCATION SECTION
%---------------------------------------------------------------------------
section{Εκπαίδευση}
whatever..
end{document}
If I use email{am random@gmail.com gr}
the code explodes. What should I do?
moderncv
add a comment |
I am trying to write my cv in greek and I noticed that the email wasn't in english but in greek. After that, I also noticed that the commands for changing languages don't work because the begin{document}
command is after the email
command. So, we want to write the email in english and the rest in greek. Here is my code:
documentclass[11pt,a4paper]{moderncv}
moderncvstyle{classic}
moderncvcolor{blue}
usepackage[american,greek]{babel}
usepackage{enumerate}
usepackage[scale=0.75]{geometry}
usepackage[utf8x]{inputenc}
setlength{hintscolumnwidth}{22mm}
setlength{makecvheadnamewidth}{100mm}
newcommand{gr}{selectlanguage{greek}}
newcommand{am}{selectlanguage{american}}
%---------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%---------------------------------------------------------------------------
firstname{ΟΝΟΜΑ} % Your first name
familyname{ΕΠΩΝΥΜΟ} % Your last name
title{Βιογραφικό Σημείωμα}
address{Αθήνα, Ελλάδα}
mobile{(+30) 999999999}
email{ email_in_english@help.com }
photo[100pt][0pt]{123.jpg}
%-------------------------------------------------------------------------
begin{document}
makecvtitle % Print the CV title
%---------------------------------------------------------------------------
% EDUCATION SECTION
%---------------------------------------------------------------------------
section{Εκπαίδευση}
whatever..
end{document}
If I use email{am random@gmail.com gr}
the code explodes. What should I do?
moderncv
Possible duplicate of moderncv babel english,greek issue
– doncherry
Jan 21 at 10:59
add a comment |
I am trying to write my cv in greek and I noticed that the email wasn't in english but in greek. After that, I also noticed that the commands for changing languages don't work because the begin{document}
command is after the email
command. So, we want to write the email in english and the rest in greek. Here is my code:
documentclass[11pt,a4paper]{moderncv}
moderncvstyle{classic}
moderncvcolor{blue}
usepackage[american,greek]{babel}
usepackage{enumerate}
usepackage[scale=0.75]{geometry}
usepackage[utf8x]{inputenc}
setlength{hintscolumnwidth}{22mm}
setlength{makecvheadnamewidth}{100mm}
newcommand{gr}{selectlanguage{greek}}
newcommand{am}{selectlanguage{american}}
%---------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%---------------------------------------------------------------------------
firstname{ΟΝΟΜΑ} % Your first name
familyname{ΕΠΩΝΥΜΟ} % Your last name
title{Βιογραφικό Σημείωμα}
address{Αθήνα, Ελλάδα}
mobile{(+30) 999999999}
email{ email_in_english@help.com }
photo[100pt][0pt]{123.jpg}
%-------------------------------------------------------------------------
begin{document}
makecvtitle % Print the CV title
%---------------------------------------------------------------------------
% EDUCATION SECTION
%---------------------------------------------------------------------------
section{Εκπαίδευση}
whatever..
end{document}
If I use email{am random@gmail.com gr}
the code explodes. What should I do?
moderncv
I am trying to write my cv in greek and I noticed that the email wasn't in english but in greek. After that, I also noticed that the commands for changing languages don't work because the begin{document}
command is after the email
command. So, we want to write the email in english and the rest in greek. Here is my code:
documentclass[11pt,a4paper]{moderncv}
moderncvstyle{classic}
moderncvcolor{blue}
usepackage[american,greek]{babel}
usepackage{enumerate}
usepackage[scale=0.75]{geometry}
usepackage[utf8x]{inputenc}
setlength{hintscolumnwidth}{22mm}
setlength{makecvheadnamewidth}{100mm}
newcommand{gr}{selectlanguage{greek}}
newcommand{am}{selectlanguage{american}}
%---------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%---------------------------------------------------------------------------
firstname{ΟΝΟΜΑ} % Your first name
familyname{ΕΠΩΝΥΜΟ} % Your last name
title{Βιογραφικό Σημείωμα}
address{Αθήνα, Ελλάδα}
mobile{(+30) 999999999}
email{ email_in_english@help.com }
photo[100pt][0pt]{123.jpg}
%-------------------------------------------------------------------------
begin{document}
makecvtitle % Print the CV title
%---------------------------------------------------------------------------
% EDUCATION SECTION
%---------------------------------------------------------------------------
section{Εκπαίδευση}
whatever..
end{document}
If I use email{am random@gmail.com gr}
the code explodes. What should I do?
moderncv
moderncv
edited Jan 21 at 11:20
Kurt
38.7k849162
38.7k849162
asked Jan 21 at 10:20
Γιωργος ΚαλτσαςΓιωργος Καλτσας
382
382
Possible duplicate of moderncv babel english,greek issue
– doncherry
Jan 21 at 10:59
add a comment |
Possible duplicate of moderncv babel english,greek issue
– doncherry
Jan 21 at 10:59
Possible duplicate of moderncv babel english,greek issue
– doncherry
Jan 21 at 10:59
Possible duplicate of moderncv babel english,greek issue
– doncherry
Jan 21 at 10:59
add a comment |
2 Answers
2
active
oldest
votes
In the definition of command makecvhead
(responsible to print the title with the email address) you have to change one line to:
ifthenelse{isundefined{@email}}{}{makenewlineemailsymbolprotectamemaillink{@email}protectgr}% <============
See that I added protectam
and protectgr
to get the email in english language.
So with the complete code
documentclass[11pt,a4paper]{moderncv}
moderncvstyle{classic} % head 1 body 1 foot
moderncvcolor{blue}
usepackage[american,greek]{babel}
usepackage{enumerate}
usepackage[scale=0.75]{geometry}
usepackage[utf8]{inputenc}
setlength{hintscolumnwidth}{22mm}
setlength{makecvheadnamewidth}{100mm}
newcommand{gr}{selectlanguage{greek}}
newcommand{am}{selectlanguage{american}}
makeatletter
renewcommand*{makecvhead}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
recomputecvlengths%
% optional detailed information (pre-rendering)
@initializebox{makecvheaddetailsbox}%
if@details%
defphonesdetails{}%
collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
protected@edefphonesdetails{phonesdetailsprotectmakenewlinecsnamecollectionloopkey phonesymbolendcsnamecollectionloopitem}}%
defsocialsdetails{}%
collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
protected@edefsocialsdetails{socialsdetailsprotectmakenewlinecsnamecollectionloopkey socialsymbolendcsnamecollectionloopitem}}%
savebox{makecvheaddetailsbox}{%
addressfontcolor{color2}%
if@leftbegin{tabular}[b]{@{}r@{}}fi%
if@rightbegin{tabular}[b]{@{}l@{}}fi%
ifthenelse{isundefined{@addressstreet}}{}{makenewlineaddresssymbol@addressstreet%
ifthenelse{equal{@addresscity}{}}{}{makenewline@addresscity}% if addresstreet is defined, addresscity and addresscountry will always be defined but could be empty
ifthenelse{equal{@addresscountry}{}}{}{makenewline@addresscountry}}%
phonesdetails% needs to be pre-rendered as loops and tabulars seem to conflict
ifthenelse{isundefined{@email}}{}{makenewlineemailsymbolprotectamemaillink{@email}protectgr}% <============
ifthenelse{isundefined{@homepage}}{}{makenewlinehomepagesymbolhttplink{@homepage}}%
socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
ifthenelse{isundefined{@extrainfo}}{}{makenewline@extrainfo}%
end{tabular}
}fi%
% optional photo (pre-rendering)
@initializebox{makecvheadpicturebox}%
savebox{makecvheadpicturebox}{%
ifthenelse{isundefined{@photo}}%
{}%
{%
if@left%
hspace*{separatorcolumnwidth}fi%
color{color1}%
setlength{fboxrule}{@photoframewidth}%
ifdim@photoframewidth=0pt%
setlength{fboxsep}{0pt}fi%
framebox{includegraphics[width=@photowidth]{@photo}}}%
if@right%
hspace*{separatorcolumnwidth}fi}%
% name and title (pre-rendering)
@initializelength{makecvheaddetailswidth}settowidth{makecvheaddetailswidth}{usebox{makecvheaddetailsbox}}%
@initializelength{makecvheadpicturewidth}settowidth{makecvheadpicturewidth}{usebox{makecvheadpicturebox}}%
ifthenelse{lengthtest{makecvheadnamewidth=0pt}}% check for dummy value (equivalent to ifdimmakecvheadnamewidth=0pt)
{setlength{makecvheadnamewidth}{textwidth-makecvheaddetailswidth-makecvheadpicturewidth}}%
{}%
@initializebox{makecvheadnamebox}%
savebox{makecvheadnamebox}{%
begin{minipage}[b]{makecvheadnamewidth}%
if@leftraggedrightfi%
if@rightraggedleftfi%
namestyle{@firstname @lastname}%
ifthenelse{equal{@title}{}}{}{\[1.25em]titlestyle{@title}}%
end{minipage}}%
% rendering
if@left%
usebox{makecvheadnamebox}%
hfill%
llap{usebox{makecvheaddetailsbox}}% llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced
usebox{makecvheadpicturebox}fi%
if@right%
usebox{makecvheadpicturebox}%
rlap{usebox{makecvheaddetailsbox}}% llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced
hfill%
usebox{makecvheadnamebox}fi%
\[2.5em]%
% optional quote
ifthenelse{isundefined{@quote}}%
{}%
{{centeringbegin{minipage}{quotewidth}centeringquotestyle{@quote}end{minipage}\[2.5em]}}%
par}% to avoid weird spacing bug at the first section if no blank line is left after makecvhead
makeatother
%---------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%---------------------------------------------------------------------------
firstname{ΟΝΟΜΑ} % Your first name
familyname{ΕΠΩΝΥΜΟ} % Your last name
title{Βιογραφικό Σημείωμα}
address{Αθήνα, Ελλάδα}
mobile{(+30) 999999999}
email{random@gmail.com}
%email{am random@gmail.com gr}
photo[100pt][0pt]{example-image}
%-------------------------------------------------------------------------
begin{document}
makecvtitle % Print the CV title
%---------------------------------------------------------------------------
% EDUCATION SECTION
%---------------------------------------------------------------------------
section{Εκπαίδευση}
whatever..
end{document}
you get the wished result:
Good job and great help. Works perfectly. Thank you very much.
– Γιωργος Καλτσας
Jan 21 at 11:16
add a comment |
The emaillink
macro used internally by moderncv
accepts an optional argument, but email
doesn't.
Here's a way to make email
accept the optional argument, so separating the aspects; this way, we can add typesetting instructions to the “printed” address, while stating an ASCII email address.
documentclass[11pt,a4paper]{moderncv}
moderncvstyle{classic}
moderncvcolor{blue}
usepackage[american,greek]{babel}
usepackage{enumerate}
usepackage[scale=0.75]{geometry}
usepackage[utf8]{inputenc}
usepackage{letltxmacro,xpatch}
setlength{hintscolumnwidth}{22mm}
setlength{makecvheadnamewidth}{100mm}
newcommand{gr}{selectlanguage{greek}}
newcommand{am}{selectlanguage{american}}
makeatletter
LetLtxMacromcvemaillinkemaillink
renewcommandemail[2]{%
ifrelaxdetokenize{#1}relax
edef@email{[unexpanded{#2}]{detokenize{#2}}}%
else
edef@email{[unexpanded{#2}]{detokenize{#1}}}%
fi
}
renewcommand{emaillink}[1]{expandaftermcvemaillink#1}
makeatother
%---------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%---------------------------------------------------------------------------
firstname{ΟΝΟΜΑ} % Your first name
familyname{ΕΠΩΝΥΜΟ} % Your last name
title{Βιογραφικό Σημείωμα}
address{Αθήνα, Ελλάδα}
mobile{(+30) 999999999}
email[email_in_english@help.com]{textlatin{email_in_english@help.com}}
photo[100pt][0pt]{example-image}
%-------------------------------------------------------------------------
begin{document}
makecvtitle % Print the CV title
%---------------------------------------------------------------------------
% EDUCATION SECTION
%---------------------------------------------------------------------------
section{Εκπαίδευση}
whatever..
end{document}
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f471109%2fhow-to-change-languages-before-begindocument-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
In the definition of command makecvhead
(responsible to print the title with the email address) you have to change one line to:
ifthenelse{isundefined{@email}}{}{makenewlineemailsymbolprotectamemaillink{@email}protectgr}% <============
See that I added protectam
and protectgr
to get the email in english language.
So with the complete code
documentclass[11pt,a4paper]{moderncv}
moderncvstyle{classic} % head 1 body 1 foot
moderncvcolor{blue}
usepackage[american,greek]{babel}
usepackage{enumerate}
usepackage[scale=0.75]{geometry}
usepackage[utf8]{inputenc}
setlength{hintscolumnwidth}{22mm}
setlength{makecvheadnamewidth}{100mm}
newcommand{gr}{selectlanguage{greek}}
newcommand{am}{selectlanguage{american}}
makeatletter
renewcommand*{makecvhead}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
recomputecvlengths%
% optional detailed information (pre-rendering)
@initializebox{makecvheaddetailsbox}%
if@details%
defphonesdetails{}%
collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
protected@edefphonesdetails{phonesdetailsprotectmakenewlinecsnamecollectionloopkey phonesymbolendcsnamecollectionloopitem}}%
defsocialsdetails{}%
collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
protected@edefsocialsdetails{socialsdetailsprotectmakenewlinecsnamecollectionloopkey socialsymbolendcsnamecollectionloopitem}}%
savebox{makecvheaddetailsbox}{%
addressfontcolor{color2}%
if@leftbegin{tabular}[b]{@{}r@{}}fi%
if@rightbegin{tabular}[b]{@{}l@{}}fi%
ifthenelse{isundefined{@addressstreet}}{}{makenewlineaddresssymbol@addressstreet%
ifthenelse{equal{@addresscity}{}}{}{makenewline@addresscity}% if addresstreet is defined, addresscity and addresscountry will always be defined but could be empty
ifthenelse{equal{@addresscountry}{}}{}{makenewline@addresscountry}}%
phonesdetails% needs to be pre-rendered as loops and tabulars seem to conflict
ifthenelse{isundefined{@email}}{}{makenewlineemailsymbolprotectamemaillink{@email}protectgr}% <============
ifthenelse{isundefined{@homepage}}{}{makenewlinehomepagesymbolhttplink{@homepage}}%
socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
ifthenelse{isundefined{@extrainfo}}{}{makenewline@extrainfo}%
end{tabular}
}fi%
% optional photo (pre-rendering)
@initializebox{makecvheadpicturebox}%
savebox{makecvheadpicturebox}{%
ifthenelse{isundefined{@photo}}%
{}%
{%
if@left%
hspace*{separatorcolumnwidth}fi%
color{color1}%
setlength{fboxrule}{@photoframewidth}%
ifdim@photoframewidth=0pt%
setlength{fboxsep}{0pt}fi%
framebox{includegraphics[width=@photowidth]{@photo}}}%
if@right%
hspace*{separatorcolumnwidth}fi}%
% name and title (pre-rendering)
@initializelength{makecvheaddetailswidth}settowidth{makecvheaddetailswidth}{usebox{makecvheaddetailsbox}}%
@initializelength{makecvheadpicturewidth}settowidth{makecvheadpicturewidth}{usebox{makecvheadpicturebox}}%
ifthenelse{lengthtest{makecvheadnamewidth=0pt}}% check for dummy value (equivalent to ifdimmakecvheadnamewidth=0pt)
{setlength{makecvheadnamewidth}{textwidth-makecvheaddetailswidth-makecvheadpicturewidth}}%
{}%
@initializebox{makecvheadnamebox}%
savebox{makecvheadnamebox}{%
begin{minipage}[b]{makecvheadnamewidth}%
if@leftraggedrightfi%
if@rightraggedleftfi%
namestyle{@firstname @lastname}%
ifthenelse{equal{@title}{}}{}{\[1.25em]titlestyle{@title}}%
end{minipage}}%
% rendering
if@left%
usebox{makecvheadnamebox}%
hfill%
llap{usebox{makecvheaddetailsbox}}% llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced
usebox{makecvheadpicturebox}fi%
if@right%
usebox{makecvheadpicturebox}%
rlap{usebox{makecvheaddetailsbox}}% llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced
hfill%
usebox{makecvheadnamebox}fi%
\[2.5em]%
% optional quote
ifthenelse{isundefined{@quote}}%
{}%
{{centeringbegin{minipage}{quotewidth}centeringquotestyle{@quote}end{minipage}\[2.5em]}}%
par}% to avoid weird spacing bug at the first section if no blank line is left after makecvhead
makeatother
%---------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%---------------------------------------------------------------------------
firstname{ΟΝΟΜΑ} % Your first name
familyname{ΕΠΩΝΥΜΟ} % Your last name
title{Βιογραφικό Σημείωμα}
address{Αθήνα, Ελλάδα}
mobile{(+30) 999999999}
email{random@gmail.com}
%email{am random@gmail.com gr}
photo[100pt][0pt]{example-image}
%-------------------------------------------------------------------------
begin{document}
makecvtitle % Print the CV title
%---------------------------------------------------------------------------
% EDUCATION SECTION
%---------------------------------------------------------------------------
section{Εκπαίδευση}
whatever..
end{document}
you get the wished result:
Good job and great help. Works perfectly. Thank you very much.
– Γιωργος Καλτσας
Jan 21 at 11:16
add a comment |
In the definition of command makecvhead
(responsible to print the title with the email address) you have to change one line to:
ifthenelse{isundefined{@email}}{}{makenewlineemailsymbolprotectamemaillink{@email}protectgr}% <============
See that I added protectam
and protectgr
to get the email in english language.
So with the complete code
documentclass[11pt,a4paper]{moderncv}
moderncvstyle{classic} % head 1 body 1 foot
moderncvcolor{blue}
usepackage[american,greek]{babel}
usepackage{enumerate}
usepackage[scale=0.75]{geometry}
usepackage[utf8]{inputenc}
setlength{hintscolumnwidth}{22mm}
setlength{makecvheadnamewidth}{100mm}
newcommand{gr}{selectlanguage{greek}}
newcommand{am}{selectlanguage{american}}
makeatletter
renewcommand*{makecvhead}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
recomputecvlengths%
% optional detailed information (pre-rendering)
@initializebox{makecvheaddetailsbox}%
if@details%
defphonesdetails{}%
collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
protected@edefphonesdetails{phonesdetailsprotectmakenewlinecsnamecollectionloopkey phonesymbolendcsnamecollectionloopitem}}%
defsocialsdetails{}%
collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
protected@edefsocialsdetails{socialsdetailsprotectmakenewlinecsnamecollectionloopkey socialsymbolendcsnamecollectionloopitem}}%
savebox{makecvheaddetailsbox}{%
addressfontcolor{color2}%
if@leftbegin{tabular}[b]{@{}r@{}}fi%
if@rightbegin{tabular}[b]{@{}l@{}}fi%
ifthenelse{isundefined{@addressstreet}}{}{makenewlineaddresssymbol@addressstreet%
ifthenelse{equal{@addresscity}{}}{}{makenewline@addresscity}% if addresstreet is defined, addresscity and addresscountry will always be defined but could be empty
ifthenelse{equal{@addresscountry}{}}{}{makenewline@addresscountry}}%
phonesdetails% needs to be pre-rendered as loops and tabulars seem to conflict
ifthenelse{isundefined{@email}}{}{makenewlineemailsymbolprotectamemaillink{@email}protectgr}% <============
ifthenelse{isundefined{@homepage}}{}{makenewlinehomepagesymbolhttplink{@homepage}}%
socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
ifthenelse{isundefined{@extrainfo}}{}{makenewline@extrainfo}%
end{tabular}
}fi%
% optional photo (pre-rendering)
@initializebox{makecvheadpicturebox}%
savebox{makecvheadpicturebox}{%
ifthenelse{isundefined{@photo}}%
{}%
{%
if@left%
hspace*{separatorcolumnwidth}fi%
color{color1}%
setlength{fboxrule}{@photoframewidth}%
ifdim@photoframewidth=0pt%
setlength{fboxsep}{0pt}fi%
framebox{includegraphics[width=@photowidth]{@photo}}}%
if@right%
hspace*{separatorcolumnwidth}fi}%
% name and title (pre-rendering)
@initializelength{makecvheaddetailswidth}settowidth{makecvheaddetailswidth}{usebox{makecvheaddetailsbox}}%
@initializelength{makecvheadpicturewidth}settowidth{makecvheadpicturewidth}{usebox{makecvheadpicturebox}}%
ifthenelse{lengthtest{makecvheadnamewidth=0pt}}% check for dummy value (equivalent to ifdimmakecvheadnamewidth=0pt)
{setlength{makecvheadnamewidth}{textwidth-makecvheaddetailswidth-makecvheadpicturewidth}}%
{}%
@initializebox{makecvheadnamebox}%
savebox{makecvheadnamebox}{%
begin{minipage}[b]{makecvheadnamewidth}%
if@leftraggedrightfi%
if@rightraggedleftfi%
namestyle{@firstname @lastname}%
ifthenelse{equal{@title}{}}{}{\[1.25em]titlestyle{@title}}%
end{minipage}}%
% rendering
if@left%
usebox{makecvheadnamebox}%
hfill%
llap{usebox{makecvheaddetailsbox}}% llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced
usebox{makecvheadpicturebox}fi%
if@right%
usebox{makecvheadpicturebox}%
rlap{usebox{makecvheaddetailsbox}}% llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced
hfill%
usebox{makecvheadnamebox}fi%
\[2.5em]%
% optional quote
ifthenelse{isundefined{@quote}}%
{}%
{{centeringbegin{minipage}{quotewidth}centeringquotestyle{@quote}end{minipage}\[2.5em]}}%
par}% to avoid weird spacing bug at the first section if no blank line is left after makecvhead
makeatother
%---------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%---------------------------------------------------------------------------
firstname{ΟΝΟΜΑ} % Your first name
familyname{ΕΠΩΝΥΜΟ} % Your last name
title{Βιογραφικό Σημείωμα}
address{Αθήνα, Ελλάδα}
mobile{(+30) 999999999}
email{random@gmail.com}
%email{am random@gmail.com gr}
photo[100pt][0pt]{example-image}
%-------------------------------------------------------------------------
begin{document}
makecvtitle % Print the CV title
%---------------------------------------------------------------------------
% EDUCATION SECTION
%---------------------------------------------------------------------------
section{Εκπαίδευση}
whatever..
end{document}
you get the wished result:
Good job and great help. Works perfectly. Thank you very much.
– Γιωργος Καλτσας
Jan 21 at 11:16
add a comment |
In the definition of command makecvhead
(responsible to print the title with the email address) you have to change one line to:
ifthenelse{isundefined{@email}}{}{makenewlineemailsymbolprotectamemaillink{@email}protectgr}% <============
See that I added protectam
and protectgr
to get the email in english language.
So with the complete code
documentclass[11pt,a4paper]{moderncv}
moderncvstyle{classic} % head 1 body 1 foot
moderncvcolor{blue}
usepackage[american,greek]{babel}
usepackage{enumerate}
usepackage[scale=0.75]{geometry}
usepackage[utf8]{inputenc}
setlength{hintscolumnwidth}{22mm}
setlength{makecvheadnamewidth}{100mm}
newcommand{gr}{selectlanguage{greek}}
newcommand{am}{selectlanguage{american}}
makeatletter
renewcommand*{makecvhead}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
recomputecvlengths%
% optional detailed information (pre-rendering)
@initializebox{makecvheaddetailsbox}%
if@details%
defphonesdetails{}%
collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
protected@edefphonesdetails{phonesdetailsprotectmakenewlinecsnamecollectionloopkey phonesymbolendcsnamecollectionloopitem}}%
defsocialsdetails{}%
collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
protected@edefsocialsdetails{socialsdetailsprotectmakenewlinecsnamecollectionloopkey socialsymbolendcsnamecollectionloopitem}}%
savebox{makecvheaddetailsbox}{%
addressfontcolor{color2}%
if@leftbegin{tabular}[b]{@{}r@{}}fi%
if@rightbegin{tabular}[b]{@{}l@{}}fi%
ifthenelse{isundefined{@addressstreet}}{}{makenewlineaddresssymbol@addressstreet%
ifthenelse{equal{@addresscity}{}}{}{makenewline@addresscity}% if addresstreet is defined, addresscity and addresscountry will always be defined but could be empty
ifthenelse{equal{@addresscountry}{}}{}{makenewline@addresscountry}}%
phonesdetails% needs to be pre-rendered as loops and tabulars seem to conflict
ifthenelse{isundefined{@email}}{}{makenewlineemailsymbolprotectamemaillink{@email}protectgr}% <============
ifthenelse{isundefined{@homepage}}{}{makenewlinehomepagesymbolhttplink{@homepage}}%
socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
ifthenelse{isundefined{@extrainfo}}{}{makenewline@extrainfo}%
end{tabular}
}fi%
% optional photo (pre-rendering)
@initializebox{makecvheadpicturebox}%
savebox{makecvheadpicturebox}{%
ifthenelse{isundefined{@photo}}%
{}%
{%
if@left%
hspace*{separatorcolumnwidth}fi%
color{color1}%
setlength{fboxrule}{@photoframewidth}%
ifdim@photoframewidth=0pt%
setlength{fboxsep}{0pt}fi%
framebox{includegraphics[width=@photowidth]{@photo}}}%
if@right%
hspace*{separatorcolumnwidth}fi}%
% name and title (pre-rendering)
@initializelength{makecvheaddetailswidth}settowidth{makecvheaddetailswidth}{usebox{makecvheaddetailsbox}}%
@initializelength{makecvheadpicturewidth}settowidth{makecvheadpicturewidth}{usebox{makecvheadpicturebox}}%
ifthenelse{lengthtest{makecvheadnamewidth=0pt}}% check for dummy value (equivalent to ifdimmakecvheadnamewidth=0pt)
{setlength{makecvheadnamewidth}{textwidth-makecvheaddetailswidth-makecvheadpicturewidth}}%
{}%
@initializebox{makecvheadnamebox}%
savebox{makecvheadnamebox}{%
begin{minipage}[b]{makecvheadnamewidth}%
if@leftraggedrightfi%
if@rightraggedleftfi%
namestyle{@firstname @lastname}%
ifthenelse{equal{@title}{}}{}{\[1.25em]titlestyle{@title}}%
end{minipage}}%
% rendering
if@left%
usebox{makecvheadnamebox}%
hfill%
llap{usebox{makecvheaddetailsbox}}% llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced
usebox{makecvheadpicturebox}fi%
if@right%
usebox{makecvheadpicturebox}%
rlap{usebox{makecvheaddetailsbox}}% llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced
hfill%
usebox{makecvheadnamebox}fi%
\[2.5em]%
% optional quote
ifthenelse{isundefined{@quote}}%
{}%
{{centeringbegin{minipage}{quotewidth}centeringquotestyle{@quote}end{minipage}\[2.5em]}}%
par}% to avoid weird spacing bug at the first section if no blank line is left after makecvhead
makeatother
%---------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%---------------------------------------------------------------------------
firstname{ΟΝΟΜΑ} % Your first name
familyname{ΕΠΩΝΥΜΟ} % Your last name
title{Βιογραφικό Σημείωμα}
address{Αθήνα, Ελλάδα}
mobile{(+30) 999999999}
email{random@gmail.com}
%email{am random@gmail.com gr}
photo[100pt][0pt]{example-image}
%-------------------------------------------------------------------------
begin{document}
makecvtitle % Print the CV title
%---------------------------------------------------------------------------
% EDUCATION SECTION
%---------------------------------------------------------------------------
section{Εκπαίδευση}
whatever..
end{document}
you get the wished result:
In the definition of command makecvhead
(responsible to print the title with the email address) you have to change one line to:
ifthenelse{isundefined{@email}}{}{makenewlineemailsymbolprotectamemaillink{@email}protectgr}% <============
See that I added protectam
and protectgr
to get the email in english language.
So with the complete code
documentclass[11pt,a4paper]{moderncv}
moderncvstyle{classic} % head 1 body 1 foot
moderncvcolor{blue}
usepackage[american,greek]{babel}
usepackage{enumerate}
usepackage[scale=0.75]{geometry}
usepackage[utf8]{inputenc}
setlength{hintscolumnwidth}{22mm}
setlength{makecvheadnamewidth}{100mm}
newcommand{gr}{selectlanguage{greek}}
newcommand{am}{selectlanguage{american}}
makeatletter
renewcommand*{makecvhead}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
recomputecvlengths%
% optional detailed information (pre-rendering)
@initializebox{makecvheaddetailsbox}%
if@details%
defphonesdetails{}%
collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
protected@edefphonesdetails{phonesdetailsprotectmakenewlinecsnamecollectionloopkey phonesymbolendcsnamecollectionloopitem}}%
defsocialsdetails{}%
collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
protected@edefsocialsdetails{socialsdetailsprotectmakenewlinecsnamecollectionloopkey socialsymbolendcsnamecollectionloopitem}}%
savebox{makecvheaddetailsbox}{%
addressfontcolor{color2}%
if@leftbegin{tabular}[b]{@{}r@{}}fi%
if@rightbegin{tabular}[b]{@{}l@{}}fi%
ifthenelse{isundefined{@addressstreet}}{}{makenewlineaddresssymbol@addressstreet%
ifthenelse{equal{@addresscity}{}}{}{makenewline@addresscity}% if addresstreet is defined, addresscity and addresscountry will always be defined but could be empty
ifthenelse{equal{@addresscountry}{}}{}{makenewline@addresscountry}}%
phonesdetails% needs to be pre-rendered as loops and tabulars seem to conflict
ifthenelse{isundefined{@email}}{}{makenewlineemailsymbolprotectamemaillink{@email}protectgr}% <============
ifthenelse{isundefined{@homepage}}{}{makenewlinehomepagesymbolhttplink{@homepage}}%
socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
ifthenelse{isundefined{@extrainfo}}{}{makenewline@extrainfo}%
end{tabular}
}fi%
% optional photo (pre-rendering)
@initializebox{makecvheadpicturebox}%
savebox{makecvheadpicturebox}{%
ifthenelse{isundefined{@photo}}%
{}%
{%
if@left%
hspace*{separatorcolumnwidth}fi%
color{color1}%
setlength{fboxrule}{@photoframewidth}%
ifdim@photoframewidth=0pt%
setlength{fboxsep}{0pt}fi%
framebox{includegraphics[width=@photowidth]{@photo}}}%
if@right%
hspace*{separatorcolumnwidth}fi}%
% name and title (pre-rendering)
@initializelength{makecvheaddetailswidth}settowidth{makecvheaddetailswidth}{usebox{makecvheaddetailsbox}}%
@initializelength{makecvheadpicturewidth}settowidth{makecvheadpicturewidth}{usebox{makecvheadpicturebox}}%
ifthenelse{lengthtest{makecvheadnamewidth=0pt}}% check for dummy value (equivalent to ifdimmakecvheadnamewidth=0pt)
{setlength{makecvheadnamewidth}{textwidth-makecvheaddetailswidth-makecvheadpicturewidth}}%
{}%
@initializebox{makecvheadnamebox}%
savebox{makecvheadnamebox}{%
begin{minipage}[b]{makecvheadnamewidth}%
if@leftraggedrightfi%
if@rightraggedleftfi%
namestyle{@firstname @lastname}%
ifthenelse{equal{@title}{}}{}{\[1.25em]titlestyle{@title}}%
end{minipage}}%
% rendering
if@left%
usebox{makecvheadnamebox}%
hfill%
llap{usebox{makecvheaddetailsbox}}% llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced
usebox{makecvheadpicturebox}fi%
if@right%
usebox{makecvheadpicturebox}%
rlap{usebox{makecvheaddetailsbox}}% llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced
hfill%
usebox{makecvheadnamebox}fi%
\[2.5em]%
% optional quote
ifthenelse{isundefined{@quote}}%
{}%
{{centeringbegin{minipage}{quotewidth}centeringquotestyle{@quote}end{minipage}\[2.5em]}}%
par}% to avoid weird spacing bug at the first section if no blank line is left after makecvhead
makeatother
%---------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%---------------------------------------------------------------------------
firstname{ΟΝΟΜΑ} % Your first name
familyname{ΕΠΩΝΥΜΟ} % Your last name
title{Βιογραφικό Σημείωμα}
address{Αθήνα, Ελλάδα}
mobile{(+30) 999999999}
email{random@gmail.com}
%email{am random@gmail.com gr}
photo[100pt][0pt]{example-image}
%-------------------------------------------------------------------------
begin{document}
makecvtitle % Print the CV title
%---------------------------------------------------------------------------
% EDUCATION SECTION
%---------------------------------------------------------------------------
section{Εκπαίδευση}
whatever..
end{document}
you get the wished result:
answered Jan 21 at 11:01
KurtKurt
38.7k849162
38.7k849162
Good job and great help. Works perfectly. Thank you very much.
– Γιωργος Καλτσας
Jan 21 at 11:16
add a comment |
Good job and great help. Works perfectly. Thank you very much.
– Γιωργος Καλτσας
Jan 21 at 11:16
Good job and great help. Works perfectly. Thank you very much.
– Γιωργος Καλτσας
Jan 21 at 11:16
Good job and great help. Works perfectly. Thank you very much.
– Γιωργος Καλτσας
Jan 21 at 11:16
add a comment |
The emaillink
macro used internally by moderncv
accepts an optional argument, but email
doesn't.
Here's a way to make email
accept the optional argument, so separating the aspects; this way, we can add typesetting instructions to the “printed” address, while stating an ASCII email address.
documentclass[11pt,a4paper]{moderncv}
moderncvstyle{classic}
moderncvcolor{blue}
usepackage[american,greek]{babel}
usepackage{enumerate}
usepackage[scale=0.75]{geometry}
usepackage[utf8]{inputenc}
usepackage{letltxmacro,xpatch}
setlength{hintscolumnwidth}{22mm}
setlength{makecvheadnamewidth}{100mm}
newcommand{gr}{selectlanguage{greek}}
newcommand{am}{selectlanguage{american}}
makeatletter
LetLtxMacromcvemaillinkemaillink
renewcommandemail[2]{%
ifrelaxdetokenize{#1}relax
edef@email{[unexpanded{#2}]{detokenize{#2}}}%
else
edef@email{[unexpanded{#2}]{detokenize{#1}}}%
fi
}
renewcommand{emaillink}[1]{expandaftermcvemaillink#1}
makeatother
%---------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%---------------------------------------------------------------------------
firstname{ΟΝΟΜΑ} % Your first name
familyname{ΕΠΩΝΥΜΟ} % Your last name
title{Βιογραφικό Σημείωμα}
address{Αθήνα, Ελλάδα}
mobile{(+30) 999999999}
email[email_in_english@help.com]{textlatin{email_in_english@help.com}}
photo[100pt][0pt]{example-image}
%-------------------------------------------------------------------------
begin{document}
makecvtitle % Print the CV title
%---------------------------------------------------------------------------
% EDUCATION SECTION
%---------------------------------------------------------------------------
section{Εκπαίδευση}
whatever..
end{document}
add a comment |
The emaillink
macro used internally by moderncv
accepts an optional argument, but email
doesn't.
Here's a way to make email
accept the optional argument, so separating the aspects; this way, we can add typesetting instructions to the “printed” address, while stating an ASCII email address.
documentclass[11pt,a4paper]{moderncv}
moderncvstyle{classic}
moderncvcolor{blue}
usepackage[american,greek]{babel}
usepackage{enumerate}
usepackage[scale=0.75]{geometry}
usepackage[utf8]{inputenc}
usepackage{letltxmacro,xpatch}
setlength{hintscolumnwidth}{22mm}
setlength{makecvheadnamewidth}{100mm}
newcommand{gr}{selectlanguage{greek}}
newcommand{am}{selectlanguage{american}}
makeatletter
LetLtxMacromcvemaillinkemaillink
renewcommandemail[2]{%
ifrelaxdetokenize{#1}relax
edef@email{[unexpanded{#2}]{detokenize{#2}}}%
else
edef@email{[unexpanded{#2}]{detokenize{#1}}}%
fi
}
renewcommand{emaillink}[1]{expandaftermcvemaillink#1}
makeatother
%---------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%---------------------------------------------------------------------------
firstname{ΟΝΟΜΑ} % Your first name
familyname{ΕΠΩΝΥΜΟ} % Your last name
title{Βιογραφικό Σημείωμα}
address{Αθήνα, Ελλάδα}
mobile{(+30) 999999999}
email[email_in_english@help.com]{textlatin{email_in_english@help.com}}
photo[100pt][0pt]{example-image}
%-------------------------------------------------------------------------
begin{document}
makecvtitle % Print the CV title
%---------------------------------------------------------------------------
% EDUCATION SECTION
%---------------------------------------------------------------------------
section{Εκπαίδευση}
whatever..
end{document}
add a comment |
The emaillink
macro used internally by moderncv
accepts an optional argument, but email
doesn't.
Here's a way to make email
accept the optional argument, so separating the aspects; this way, we can add typesetting instructions to the “printed” address, while stating an ASCII email address.
documentclass[11pt,a4paper]{moderncv}
moderncvstyle{classic}
moderncvcolor{blue}
usepackage[american,greek]{babel}
usepackage{enumerate}
usepackage[scale=0.75]{geometry}
usepackage[utf8]{inputenc}
usepackage{letltxmacro,xpatch}
setlength{hintscolumnwidth}{22mm}
setlength{makecvheadnamewidth}{100mm}
newcommand{gr}{selectlanguage{greek}}
newcommand{am}{selectlanguage{american}}
makeatletter
LetLtxMacromcvemaillinkemaillink
renewcommandemail[2]{%
ifrelaxdetokenize{#1}relax
edef@email{[unexpanded{#2}]{detokenize{#2}}}%
else
edef@email{[unexpanded{#2}]{detokenize{#1}}}%
fi
}
renewcommand{emaillink}[1]{expandaftermcvemaillink#1}
makeatother
%---------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%---------------------------------------------------------------------------
firstname{ΟΝΟΜΑ} % Your first name
familyname{ΕΠΩΝΥΜΟ} % Your last name
title{Βιογραφικό Σημείωμα}
address{Αθήνα, Ελλάδα}
mobile{(+30) 999999999}
email[email_in_english@help.com]{textlatin{email_in_english@help.com}}
photo[100pt][0pt]{example-image}
%-------------------------------------------------------------------------
begin{document}
makecvtitle % Print the CV title
%---------------------------------------------------------------------------
% EDUCATION SECTION
%---------------------------------------------------------------------------
section{Εκπαίδευση}
whatever..
end{document}
The emaillink
macro used internally by moderncv
accepts an optional argument, but email
doesn't.
Here's a way to make email
accept the optional argument, so separating the aspects; this way, we can add typesetting instructions to the “printed” address, while stating an ASCII email address.
documentclass[11pt,a4paper]{moderncv}
moderncvstyle{classic}
moderncvcolor{blue}
usepackage[american,greek]{babel}
usepackage{enumerate}
usepackage[scale=0.75]{geometry}
usepackage[utf8]{inputenc}
usepackage{letltxmacro,xpatch}
setlength{hintscolumnwidth}{22mm}
setlength{makecvheadnamewidth}{100mm}
newcommand{gr}{selectlanguage{greek}}
newcommand{am}{selectlanguage{american}}
makeatletter
LetLtxMacromcvemaillinkemaillink
renewcommandemail[2]{%
ifrelaxdetokenize{#1}relax
edef@email{[unexpanded{#2}]{detokenize{#2}}}%
else
edef@email{[unexpanded{#2}]{detokenize{#1}}}%
fi
}
renewcommand{emaillink}[1]{expandaftermcvemaillink#1}
makeatother
%---------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%---------------------------------------------------------------------------
firstname{ΟΝΟΜΑ} % Your first name
familyname{ΕΠΩΝΥΜΟ} % Your last name
title{Βιογραφικό Σημείωμα}
address{Αθήνα, Ελλάδα}
mobile{(+30) 999999999}
email[email_in_english@help.com]{textlatin{email_in_english@help.com}}
photo[100pt][0pt]{example-image}
%-------------------------------------------------------------------------
begin{document}
makecvtitle % Print the CV title
%---------------------------------------------------------------------------
% EDUCATION SECTION
%---------------------------------------------------------------------------
section{Εκπαίδευση}
whatever..
end{document}
edited Jan 21 at 14:57
answered Jan 21 at 13:51
egregegreg
724k8819183223
724k8819183223
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f471109%2fhow-to-change-languages-before-begindocument-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Possible duplicate of moderncv babel english,greek issue
– doncherry
Jan 21 at 10:59