String parameter passed to a class vanish the spaces between words












2














I created a class in which I'd like to pass some parameters in documentclass[parameters]{}. The parameters I need to pass are pdftitle and pdfsubject to the hyperref package. I succeeded in doing so, but if exist spaces in the title they simply vanish. So far I have written the following in my class:



NeedsTeXFormat{LaTeX2e}
ProvidesClass{klass}[2019/01/02]
LoadClass[12pt,a4paper]{report}

RequirePackage{xkeyval}

defpdftitle{} % define the token to be called in the options
% sets the token to be a recognizable command in the class options:
define@key{klass.cls}{pdftitle}{defpdftitle{#1}}

defpdfsubject{}
define@key{klass.cls}{pdfsubject}{defpdfsubject{#1}}

ExecuteOptionsX{pdftitle,pdfsubject}
ProcessOptionsX

RequirePackage{hyperref}
hypersetup{
pdftitle = pdftitle,
pdfsubject = pdfsubject
}


And here an usage example of the class:



documentclass[
pdftitle = Do You See Spaces Here?,
pdfsubject = Where Are My Spaces?
]{klass}

begin{document}
dummy text
end{document}


You can see in the options that the pdftitle and pdfsubject got rid of the spaces:



No spaces in the title and subject



Although I could simply write those options in the document, they need to be in the class file. So here's my question: how do I preserve the spaces in the string I pass as a parameter? I'm compiling it with LuaLaTeX.










share|improve this question
























  • Even though when I enclose the string with brackets I got no spaces.
    – Levy
    2 hours ago






  • 2




    That's expected, I'm afraid. The code for absorbing global options zaps all spaces.
    – egreg
    2 hours ago






  • 1




    Related/possibly interesting github.com/latex3/latex2e/issues/85.
    – moewe
    2 hours ago












  • @moewe I changed the name of class in the code (it was different), try to compile again to see if it works now.
    – Levy
    2 hours ago










  • Sure. LaTeX zaps them as egreg explained and you can't even protect spaces from zapping by enclosing them in a brace group.
    – moewe
    2 hours ago
















2














I created a class in which I'd like to pass some parameters in documentclass[parameters]{}. The parameters I need to pass are pdftitle and pdfsubject to the hyperref package. I succeeded in doing so, but if exist spaces in the title they simply vanish. So far I have written the following in my class:



NeedsTeXFormat{LaTeX2e}
ProvidesClass{klass}[2019/01/02]
LoadClass[12pt,a4paper]{report}

RequirePackage{xkeyval}

defpdftitle{} % define the token to be called in the options
% sets the token to be a recognizable command in the class options:
define@key{klass.cls}{pdftitle}{defpdftitle{#1}}

defpdfsubject{}
define@key{klass.cls}{pdfsubject}{defpdfsubject{#1}}

ExecuteOptionsX{pdftitle,pdfsubject}
ProcessOptionsX

RequirePackage{hyperref}
hypersetup{
pdftitle = pdftitle,
pdfsubject = pdfsubject
}


And here an usage example of the class:



documentclass[
pdftitle = Do You See Spaces Here?,
pdfsubject = Where Are My Spaces?
]{klass}

begin{document}
dummy text
end{document}


You can see in the options that the pdftitle and pdfsubject got rid of the spaces:



No spaces in the title and subject



Although I could simply write those options in the document, they need to be in the class file. So here's my question: how do I preserve the spaces in the string I pass as a parameter? I'm compiling it with LuaLaTeX.










share|improve this question
























  • Even though when I enclose the string with brackets I got no spaces.
    – Levy
    2 hours ago






  • 2




    That's expected, I'm afraid. The code for absorbing global options zaps all spaces.
    – egreg
    2 hours ago






  • 1




    Related/possibly interesting github.com/latex3/latex2e/issues/85.
    – moewe
    2 hours ago












  • @moewe I changed the name of class in the code (it was different), try to compile again to see if it works now.
    – Levy
    2 hours ago










  • Sure. LaTeX zaps them as egreg explained and you can't even protect spaces from zapping by enclosing them in a brace group.
    – moewe
    2 hours ago














2












2








2







I created a class in which I'd like to pass some parameters in documentclass[parameters]{}. The parameters I need to pass are pdftitle and pdfsubject to the hyperref package. I succeeded in doing so, but if exist spaces in the title they simply vanish. So far I have written the following in my class:



NeedsTeXFormat{LaTeX2e}
ProvidesClass{klass}[2019/01/02]
LoadClass[12pt,a4paper]{report}

RequirePackage{xkeyval}

defpdftitle{} % define the token to be called in the options
% sets the token to be a recognizable command in the class options:
define@key{klass.cls}{pdftitle}{defpdftitle{#1}}

defpdfsubject{}
define@key{klass.cls}{pdfsubject}{defpdfsubject{#1}}

ExecuteOptionsX{pdftitle,pdfsubject}
ProcessOptionsX

RequirePackage{hyperref}
hypersetup{
pdftitle = pdftitle,
pdfsubject = pdfsubject
}


And here an usage example of the class:



documentclass[
pdftitle = Do You See Spaces Here?,
pdfsubject = Where Are My Spaces?
]{klass}

begin{document}
dummy text
end{document}


You can see in the options that the pdftitle and pdfsubject got rid of the spaces:



No spaces in the title and subject



Although I could simply write those options in the document, they need to be in the class file. So here's my question: how do I preserve the spaces in the string I pass as a parameter? I'm compiling it with LuaLaTeX.










share|improve this question















I created a class in which I'd like to pass some parameters in documentclass[parameters]{}. The parameters I need to pass are pdftitle and pdfsubject to the hyperref package. I succeeded in doing so, but if exist spaces in the title they simply vanish. So far I have written the following in my class:



NeedsTeXFormat{LaTeX2e}
ProvidesClass{klass}[2019/01/02]
LoadClass[12pt,a4paper]{report}

RequirePackage{xkeyval}

defpdftitle{} % define the token to be called in the options
% sets the token to be a recognizable command in the class options:
define@key{klass.cls}{pdftitle}{defpdftitle{#1}}

defpdfsubject{}
define@key{klass.cls}{pdfsubject}{defpdfsubject{#1}}

ExecuteOptionsX{pdftitle,pdfsubject}
ProcessOptionsX

RequirePackage{hyperref}
hypersetup{
pdftitle = pdftitle,
pdfsubject = pdfsubject
}


And here an usage example of the class:



documentclass[
pdftitle = Do You See Spaces Here?,
pdfsubject = Where Are My Spaces?
]{klass}

begin{document}
dummy text
end{document}


You can see in the options that the pdftitle and pdfsubject got rid of the spaces:



No spaces in the title and subject



Although I could simply write those options in the document, they need to be in the class file. So here's my question: how do I preserve the spaces in the string I pass as a parameter? I'm compiling it with LuaLaTeX.







luatex documentclass-writing parameters class-options






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 hours ago

























asked 2 hours ago









Levy

193112




193112












  • Even though when I enclose the string with brackets I got no spaces.
    – Levy
    2 hours ago






  • 2




    That's expected, I'm afraid. The code for absorbing global options zaps all spaces.
    – egreg
    2 hours ago






  • 1




    Related/possibly interesting github.com/latex3/latex2e/issues/85.
    – moewe
    2 hours ago












  • @moewe I changed the name of class in the code (it was different), try to compile again to see if it works now.
    – Levy
    2 hours ago










  • Sure. LaTeX zaps them as egreg explained and you can't even protect spaces from zapping by enclosing them in a brace group.
    – moewe
    2 hours ago


















  • Even though when I enclose the string with brackets I got no spaces.
    – Levy
    2 hours ago






  • 2




    That's expected, I'm afraid. The code for absorbing global options zaps all spaces.
    – egreg
    2 hours ago






  • 1




    Related/possibly interesting github.com/latex3/latex2e/issues/85.
    – moewe
    2 hours ago












  • @moewe I changed the name of class in the code (it was different), try to compile again to see if it works now.
    – Levy
    2 hours ago










  • Sure. LaTeX zaps them as egreg explained and you can't even protect spaces from zapping by enclosing them in a brace group.
    – moewe
    2 hours ago
















Even though when I enclose the string with brackets I got no spaces.
– Levy
2 hours ago




Even though when I enclose the string with brackets I got no spaces.
– Levy
2 hours ago




2




2




That's expected, I'm afraid. The code for absorbing global options zaps all spaces.
– egreg
2 hours ago




That's expected, I'm afraid. The code for absorbing global options zaps all spaces.
– egreg
2 hours ago




1




1




Related/possibly interesting github.com/latex3/latex2e/issues/85.
– moewe
2 hours ago






Related/possibly interesting github.com/latex3/latex2e/issues/85.
– moewe
2 hours ago














@moewe I changed the name of class in the code (it was different), try to compile again to see if it works now.
– Levy
2 hours ago




@moewe I changed the name of class in the code (it was different), try to compile again to see if it works now.
– Levy
2 hours ago












Sure. LaTeX zaps them as egreg explained and you can't even protect spaces from zapping by enclosing them in a brace group.
– moewe
2 hours ago




Sure. LaTeX zaps them as egreg explained and you can't even protect spaces from zapping by enclosing them in a brace group.
– moewe
2 hours ago










1 Answer
1






active

oldest

votes


















2














You can make this work:



Title:          Do You See Spaces Here?
Subject: Where Are My Spaces?


using input



documentclass[
pdftitle = {{Do You See Spaces Here?}} ,
pdfsubject = {{Where Are My Spaces?}}
]{klass}

begin{document}
dummy text
end{document}


The fact that you need braces to protect the spaces is an unfortunate feature of the core latex option handling, the fact that you need double braces and a space before the comma seems to be a feature of xkeyval's version of key=value parsing.



There are some plans to have an option not to drop spaces here but it is a tricky area, changing anything has the potential to break every latex document....






share|improve this answer





















  • Thank you! It worked!
    – Levy
    51 mins ago











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468660%2fstring-parameter-passed-to-a-class-vanish-the-spaces-between-words%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














You can make this work:



Title:          Do You See Spaces Here?
Subject: Where Are My Spaces?


using input



documentclass[
pdftitle = {{Do You See Spaces Here?}} ,
pdfsubject = {{Where Are My Spaces?}}
]{klass}

begin{document}
dummy text
end{document}


The fact that you need braces to protect the spaces is an unfortunate feature of the core latex option handling, the fact that you need double braces and a space before the comma seems to be a feature of xkeyval's version of key=value parsing.



There are some plans to have an option not to drop spaces here but it is a tricky area, changing anything has the potential to break every latex document....






share|improve this answer





















  • Thank you! It worked!
    – Levy
    51 mins ago
















2














You can make this work:



Title:          Do You See Spaces Here?
Subject: Where Are My Spaces?


using input



documentclass[
pdftitle = {{Do You See Spaces Here?}} ,
pdfsubject = {{Where Are My Spaces?}}
]{klass}

begin{document}
dummy text
end{document}


The fact that you need braces to protect the spaces is an unfortunate feature of the core latex option handling, the fact that you need double braces and a space before the comma seems to be a feature of xkeyval's version of key=value parsing.



There are some plans to have an option not to drop spaces here but it is a tricky area, changing anything has the potential to break every latex document....






share|improve this answer





















  • Thank you! It worked!
    – Levy
    51 mins ago














2












2








2






You can make this work:



Title:          Do You See Spaces Here?
Subject: Where Are My Spaces?


using input



documentclass[
pdftitle = {{Do You See Spaces Here?}} ,
pdfsubject = {{Where Are My Spaces?}}
]{klass}

begin{document}
dummy text
end{document}


The fact that you need braces to protect the spaces is an unfortunate feature of the core latex option handling, the fact that you need double braces and a space before the comma seems to be a feature of xkeyval's version of key=value parsing.



There are some plans to have an option not to drop spaces here but it is a tricky area, changing anything has the potential to break every latex document....






share|improve this answer












You can make this work:



Title:          Do You See Spaces Here?
Subject: Where Are My Spaces?


using input



documentclass[
pdftitle = {{Do You See Spaces Here?}} ,
pdfsubject = {{Where Are My Spaces?}}
]{klass}

begin{document}
dummy text
end{document}


The fact that you need braces to protect the spaces is an unfortunate feature of the core latex option handling, the fact that you need double braces and a space before the comma seems to be a feature of xkeyval's version of key=value parsing.



There are some plans to have an option not to drop spaces here but it is a tricky area, changing anything has the potential to break every latex document....







share|improve this answer












share|improve this answer



share|improve this answer










answered 1 hour ago









David Carlisle

483k4011151856




483k4011151856












  • Thank you! It worked!
    – Levy
    51 mins ago


















  • Thank you! It worked!
    – Levy
    51 mins ago
















Thank you! It worked!
– Levy
51 mins ago




Thank you! It worked!
– Levy
51 mins ago


















draft saved

draft discarded




















































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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468660%2fstring-parameter-passed-to-a-class-vanish-the-spaces-between-words%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Lallio

Futebolista

Jornalista