Redefine title for possibility of a forced line breaking in a predefined place
Clash Royale CLAN TAG#URR8PPP
When we use the macro titleSome Title
, the macro just assign the Some Text
to another internal one @title
as defined in latex.ltx
:
deftitle#1gdef@title#1
We can use the @title
in various places of document, for example, in hypersetuppdftitle=@title
for pdf-meta, or in some another places of an document. For example, if title looks like
titleThe World Big Idea: with small corrections
.
The some places need to be shown as The World Big Idea:
line break here with small corrections
. But in some another places it should stand still in a single line.
How to redefine title
or possible, any other good ideas?
documentclassarticle
titleSome Title
begindocument
makeatletter
@title % One can use @title in different places
makeatother
makeatletter
%@title Here one need to use the same text, but with line breack between "Same" and "Tile"
Some\Title
makeatother
enddocument
titles
add a comment |
When we use the macro titleSome Title
, the macro just assign the Some Text
to another internal one @title
as defined in latex.ltx
:
deftitle#1gdef@title#1
We can use the @title
in various places of document, for example, in hypersetuppdftitle=@title
for pdf-meta, or in some another places of an document. For example, if title looks like
titleThe World Big Idea: with small corrections
.
The some places need to be shown as The World Big Idea:
line break here with small corrections
. But in some another places it should stand still in a single line.
How to redefine title
or possible, any other good ideas?
documentclassarticle
titleSome Title
begindocument
makeatletter
@title % One can use @title in different places
makeatother
makeatletter
%@title Here one need to use the same text, but with line breack between "Same" and "Tile"
Some\Title
makeatother
enddocument
titles
1
I guess this depends on what uses for@title
you have in mind.
– moewe
Dec 16 at 15:48
@moewe I use the@title
inhypersetuppdftitle=@title
. Here it shoul be in single line, but in titlepage I need to breack the line in some place.
– sergiokapone
Dec 16 at 15:51
@sergiokapone Off-topichypersetuppdftitle=@title
is unnecessary, the title is used per default for the pdf meta data
– samcarter
Dec 16 at 15:53
@samcarter Ok, buthypersetuppdftitle=@title
was just for example.
– sergiokapone
Dec 16 at 15:58
2
Mhhh,@title
is one macro and it can obviously only have one definition at a time. You could write something liketitleSome mypossiblenewline Title
and redefine the meaning ofmypossiblenewline
from context to context. But I think it would be tricky to have one place of definition for@title
and several possible outcomes.
– moewe
Dec 16 at 16:04
add a comment |
When we use the macro titleSome Title
, the macro just assign the Some Text
to another internal one @title
as defined in latex.ltx
:
deftitle#1gdef@title#1
We can use the @title
in various places of document, for example, in hypersetuppdftitle=@title
for pdf-meta, or in some another places of an document. For example, if title looks like
titleThe World Big Idea: with small corrections
.
The some places need to be shown as The World Big Idea:
line break here with small corrections
. But in some another places it should stand still in a single line.
How to redefine title
or possible, any other good ideas?
documentclassarticle
titleSome Title
begindocument
makeatletter
@title % One can use @title in different places
makeatother
makeatletter
%@title Here one need to use the same text, but with line breack between "Same" and "Tile"
Some\Title
makeatother
enddocument
titles
When we use the macro titleSome Title
, the macro just assign the Some Text
to another internal one @title
as defined in latex.ltx
:
deftitle#1gdef@title#1
We can use the @title
in various places of document, for example, in hypersetuppdftitle=@title
for pdf-meta, or in some another places of an document. For example, if title looks like
titleThe World Big Idea: with small corrections
.
The some places need to be shown as The World Big Idea:
line break here with small corrections
. But in some another places it should stand still in a single line.
How to redefine title
or possible, any other good ideas?
documentclassarticle
titleSome Title
begindocument
makeatletter
@title % One can use @title in different places
makeatother
makeatletter
%@title Here one need to use the same text, but with line breack between "Same" and "Tile"
Some\Title
makeatother
enddocument
titles
titles
edited Dec 16 at 16:24
asked Dec 16 at 15:41
sergiokapone
2,429926
2,429926
1
I guess this depends on what uses for@title
you have in mind.
– moewe
Dec 16 at 15:48
@moewe I use the@title
inhypersetuppdftitle=@title
. Here it shoul be in single line, but in titlepage I need to breack the line in some place.
– sergiokapone
Dec 16 at 15:51
@sergiokapone Off-topichypersetuppdftitle=@title
is unnecessary, the title is used per default for the pdf meta data
– samcarter
Dec 16 at 15:53
@samcarter Ok, buthypersetuppdftitle=@title
was just for example.
– sergiokapone
Dec 16 at 15:58
2
Mhhh,@title
is one macro and it can obviously only have one definition at a time. You could write something liketitleSome mypossiblenewline Title
and redefine the meaning ofmypossiblenewline
from context to context. But I think it would be tricky to have one place of definition for@title
and several possible outcomes.
– moewe
Dec 16 at 16:04
add a comment |
1
I guess this depends on what uses for@title
you have in mind.
– moewe
Dec 16 at 15:48
@moewe I use the@title
inhypersetuppdftitle=@title
. Here it shoul be in single line, but in titlepage I need to breack the line in some place.
– sergiokapone
Dec 16 at 15:51
@sergiokapone Off-topichypersetuppdftitle=@title
is unnecessary, the title is used per default for the pdf meta data
– samcarter
Dec 16 at 15:53
@samcarter Ok, buthypersetuppdftitle=@title
was just for example.
– sergiokapone
Dec 16 at 15:58
2
Mhhh,@title
is one macro and it can obviously only have one definition at a time. You could write something liketitleSome mypossiblenewline Title
and redefine the meaning ofmypossiblenewline
from context to context. But I think it would be tricky to have one place of definition for@title
and several possible outcomes.
– moewe
Dec 16 at 16:04
1
1
I guess this depends on what uses for
@title
you have in mind.– moewe
Dec 16 at 15:48
I guess this depends on what uses for
@title
you have in mind.– moewe
Dec 16 at 15:48
@moewe I use the
@title
in hypersetuppdftitle=@title
. Here it shoul be in single line, but in titlepage I need to breack the line in some place.– sergiokapone
Dec 16 at 15:51
@moewe I use the
@title
in hypersetuppdftitle=@title
. Here it shoul be in single line, but in titlepage I need to breack the line in some place.– sergiokapone
Dec 16 at 15:51
@sergiokapone Off-topic
hypersetuppdftitle=@title
is unnecessary, the title is used per default for the pdf meta data– samcarter
Dec 16 at 15:53
@sergiokapone Off-topic
hypersetuppdftitle=@title
is unnecessary, the title is used per default for the pdf meta data– samcarter
Dec 16 at 15:53
@samcarter Ok, but
hypersetuppdftitle=@title
was just for example.– sergiokapone
Dec 16 at 15:58
@samcarter Ok, but
hypersetuppdftitle=@title
was just for example.– sergiokapone
Dec 16 at 15:58
2
2
Mhhh,
@title
is one macro and it can obviously only have one definition at a time. You could write something like titleSome mypossiblenewline Title
and redefine the meaning of mypossiblenewline
from context to context. But I think it would be tricky to have one place of definition for @title
and several possible outcomes.– moewe
Dec 16 at 16:04
Mhhh,
@title
is one macro and it can obviously only have one definition at a time. You could write something like titleSome mypossiblenewline Title
and redefine the meaning of mypossiblenewline
from context to context. But I think it would be tricky to have one place of definition for @title
and several possible outcomes.– moewe
Dec 16 at 16:04
add a comment |
3 Answers
3
active
oldest
votes
Here is a naive idea.
Use a placeholder in the definition of @title
via title
and redefine that placeholder variable as required by the context.
documentclassarticle
newcommand*mypossiblenewlinenewline
titleSome mypossiblenewline Title
begindocument
makeatletter
@title
makeatother
makeatletter
begingroup
renewcommand*mypossiblenewline
@title
endgroup
makeatother
enddocument
You could wrap that up in one command, for example
makeatletter
DeclareRobustCommand*sergiotitlenobreak%
begingroup
renewcommand*mypossiblenewline%
@title
endgroup
DeclareRobustCommand*sergiotitlewithbreak%
begingroup
renewcommand*mypossiblenewlinenewline%
@title
endgroup
makeatother
but that would not be expandable (which could be a problem depending on the context).
Yes, thank you. This is some solution of my problem.
– sergiokapone
Dec 16 at 16:10
add a comment |
Save two more variables, for lack of creativity I named them realtitle
and inlinetitle
. In the second one, \
tokens are substituted with spaces, first removing spaces at either side of \
. Thus it is immaterial if you input any of
titleSome Title \ with line breaks
titleSome Title\ with line breaks
titleSome Title\with line breaks
Here's the code.
documentclassarticle
usepackagexparse
usepackagehyperref
ExplSyntaxOn
RenewDocumentCommandtitlem
tl_gset:cn @title #1 % needed by maketitle
tl_gset:Nn realtitle #1
seq_set_split:Nnn l_tmpa_seq \ #1
tl_gset:Nx inlinetitle seq_use:Nn l_tmpa_seq ~
ExplSyntaxOff
authorauthor
titleSome Title \ with line breaks
hypersetup
pdftitle=inlinetitle
begindocument
maketitle
The title of this document is ``inlinetitle''.
begincenter
realtitle
endcenter
enddocument
You can also cope with \[<dimen>]
:
documentclassarticle
usepackagexparse
usepackagehyperref
ExplSyntaxOn
RenewDocumentCommandtitlem
tl_gset:cn @title #1 % needed by maketitle
tl_gset:Nn realtitle #1
tl_set:Nn inlinetitle #1
regex_replace_all:nnN s* c\([[^]]*])+ s* inlinetitle
ExplSyntaxOff
authorauthor
titleSome Title \[1ex] with line breaks \[1ex] and added spacing
hypersetup
pdftitle=inlinetitle
begindocument
maketitle
The title of this document is ``inlinetitle''.
begincenter
realtitle
endcenter
enddocument
add a comment |
Different approach: instead of redefining @title
, you can use texorpdfstring
to specify two versions, one without linebreaks which will be used in the pdf meta data and one with linebreak to be displayed in the pdf
documentclassarticle
usepackagehyperref
titletexorpdfstringSomenewline TitleSome title
begindocument
makeatletter
@title % One can use @title in different places
makeatother
enddocument
How can I force line bracking only one place of document, but not in others?
– sergiokapone
Dec 16 at 15:49
@sergiokapone can you give an example where you want it without linebreak? You could specify an optional shorttitle
– samcarter
Dec 16 at 15:51
It is hard to give an example, because in some places of document the@title
should be in one line, but in some another it should to break in predefined place. Fo example, if title looks liketitleThe World Big Idea: with small corrections
. The some places need to be breakThe World Big Idea: \ with small corrections
– sergiokapone
Dec 16 at 15:54
1
@sergiokapone If it is hard to give an example, it is also hard to answer your question. In your question you only mentioned that you need one line for the pdf meta data and this is what I covered in my answer
– samcarter
Dec 16 at 15:56
@sergiokapone Off-topic: Don't use \ for line breaks
– samcarter
Dec 16 at 15:57
|
show 1 more 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%2f466095%2fredefine-title-for-possibility-of-a-forced-line-breaking-in-a-predefined-place%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here is a naive idea.
Use a placeholder in the definition of @title
via title
and redefine that placeholder variable as required by the context.
documentclassarticle
newcommand*mypossiblenewlinenewline
titleSome mypossiblenewline Title
begindocument
makeatletter
@title
makeatother
makeatletter
begingroup
renewcommand*mypossiblenewline
@title
endgroup
makeatother
enddocument
You could wrap that up in one command, for example
makeatletter
DeclareRobustCommand*sergiotitlenobreak%
begingroup
renewcommand*mypossiblenewline%
@title
endgroup
DeclareRobustCommand*sergiotitlewithbreak%
begingroup
renewcommand*mypossiblenewlinenewline%
@title
endgroup
makeatother
but that would not be expandable (which could be a problem depending on the context).
Yes, thank you. This is some solution of my problem.
– sergiokapone
Dec 16 at 16:10
add a comment |
Here is a naive idea.
Use a placeholder in the definition of @title
via title
and redefine that placeholder variable as required by the context.
documentclassarticle
newcommand*mypossiblenewlinenewline
titleSome mypossiblenewline Title
begindocument
makeatletter
@title
makeatother
makeatletter
begingroup
renewcommand*mypossiblenewline
@title
endgroup
makeatother
enddocument
You could wrap that up in one command, for example
makeatletter
DeclareRobustCommand*sergiotitlenobreak%
begingroup
renewcommand*mypossiblenewline%
@title
endgroup
DeclareRobustCommand*sergiotitlewithbreak%
begingroup
renewcommand*mypossiblenewlinenewline%
@title
endgroup
makeatother
but that would not be expandable (which could be a problem depending on the context).
Yes, thank you. This is some solution of my problem.
– sergiokapone
Dec 16 at 16:10
add a comment |
Here is a naive idea.
Use a placeholder in the definition of @title
via title
and redefine that placeholder variable as required by the context.
documentclassarticle
newcommand*mypossiblenewlinenewline
titleSome mypossiblenewline Title
begindocument
makeatletter
@title
makeatother
makeatletter
begingroup
renewcommand*mypossiblenewline
@title
endgroup
makeatother
enddocument
You could wrap that up in one command, for example
makeatletter
DeclareRobustCommand*sergiotitlenobreak%
begingroup
renewcommand*mypossiblenewline%
@title
endgroup
DeclareRobustCommand*sergiotitlewithbreak%
begingroup
renewcommand*mypossiblenewlinenewline%
@title
endgroup
makeatother
but that would not be expandable (which could be a problem depending on the context).
Here is a naive idea.
Use a placeholder in the definition of @title
via title
and redefine that placeholder variable as required by the context.
documentclassarticle
newcommand*mypossiblenewlinenewline
titleSome mypossiblenewline Title
begindocument
makeatletter
@title
makeatother
makeatletter
begingroup
renewcommand*mypossiblenewline
@title
endgroup
makeatother
enddocument
You could wrap that up in one command, for example
makeatletter
DeclareRobustCommand*sergiotitlenobreak%
begingroup
renewcommand*mypossiblenewline%
@title
endgroup
DeclareRobustCommand*sergiotitlewithbreak%
begingroup
renewcommand*mypossiblenewlinenewline%
@title
endgroup
makeatother
but that would not be expandable (which could be a problem depending on the context).
edited Dec 16 at 16:16
answered Dec 16 at 16:09
moewe
86.1k9109332
86.1k9109332
Yes, thank you. This is some solution of my problem.
– sergiokapone
Dec 16 at 16:10
add a comment |
Yes, thank you. This is some solution of my problem.
– sergiokapone
Dec 16 at 16:10
Yes, thank you. This is some solution of my problem.
– sergiokapone
Dec 16 at 16:10
Yes, thank you. This is some solution of my problem.
– sergiokapone
Dec 16 at 16:10
add a comment |
Save two more variables, for lack of creativity I named them realtitle
and inlinetitle
. In the second one, \
tokens are substituted with spaces, first removing spaces at either side of \
. Thus it is immaterial if you input any of
titleSome Title \ with line breaks
titleSome Title\ with line breaks
titleSome Title\with line breaks
Here's the code.
documentclassarticle
usepackagexparse
usepackagehyperref
ExplSyntaxOn
RenewDocumentCommandtitlem
tl_gset:cn @title #1 % needed by maketitle
tl_gset:Nn realtitle #1
seq_set_split:Nnn l_tmpa_seq \ #1
tl_gset:Nx inlinetitle seq_use:Nn l_tmpa_seq ~
ExplSyntaxOff
authorauthor
titleSome Title \ with line breaks
hypersetup
pdftitle=inlinetitle
begindocument
maketitle
The title of this document is ``inlinetitle''.
begincenter
realtitle
endcenter
enddocument
You can also cope with \[<dimen>]
:
documentclassarticle
usepackagexparse
usepackagehyperref
ExplSyntaxOn
RenewDocumentCommandtitlem
tl_gset:cn @title #1 % needed by maketitle
tl_gset:Nn realtitle #1
tl_set:Nn inlinetitle #1
regex_replace_all:nnN s* c\([[^]]*])+ s* inlinetitle
ExplSyntaxOff
authorauthor
titleSome Title \[1ex] with line breaks \[1ex] and added spacing
hypersetup
pdftitle=inlinetitle
begindocument
maketitle
The title of this document is ``inlinetitle''.
begincenter
realtitle
endcenter
enddocument
add a comment |
Save two more variables, for lack of creativity I named them realtitle
and inlinetitle
. In the second one, \
tokens are substituted with spaces, first removing spaces at either side of \
. Thus it is immaterial if you input any of
titleSome Title \ with line breaks
titleSome Title\ with line breaks
titleSome Title\with line breaks
Here's the code.
documentclassarticle
usepackagexparse
usepackagehyperref
ExplSyntaxOn
RenewDocumentCommandtitlem
tl_gset:cn @title #1 % needed by maketitle
tl_gset:Nn realtitle #1
seq_set_split:Nnn l_tmpa_seq \ #1
tl_gset:Nx inlinetitle seq_use:Nn l_tmpa_seq ~
ExplSyntaxOff
authorauthor
titleSome Title \ with line breaks
hypersetup
pdftitle=inlinetitle
begindocument
maketitle
The title of this document is ``inlinetitle''.
begincenter
realtitle
endcenter
enddocument
You can also cope with \[<dimen>]
:
documentclassarticle
usepackagexparse
usepackagehyperref
ExplSyntaxOn
RenewDocumentCommandtitlem
tl_gset:cn @title #1 % needed by maketitle
tl_gset:Nn realtitle #1
tl_set:Nn inlinetitle #1
regex_replace_all:nnN s* c\([[^]]*])+ s* inlinetitle
ExplSyntaxOff
authorauthor
titleSome Title \[1ex] with line breaks \[1ex] and added spacing
hypersetup
pdftitle=inlinetitle
begindocument
maketitle
The title of this document is ``inlinetitle''.
begincenter
realtitle
endcenter
enddocument
add a comment |
Save two more variables, for lack of creativity I named them realtitle
and inlinetitle
. In the second one, \
tokens are substituted with spaces, first removing spaces at either side of \
. Thus it is immaterial if you input any of
titleSome Title \ with line breaks
titleSome Title\ with line breaks
titleSome Title\with line breaks
Here's the code.
documentclassarticle
usepackagexparse
usepackagehyperref
ExplSyntaxOn
RenewDocumentCommandtitlem
tl_gset:cn @title #1 % needed by maketitle
tl_gset:Nn realtitle #1
seq_set_split:Nnn l_tmpa_seq \ #1
tl_gset:Nx inlinetitle seq_use:Nn l_tmpa_seq ~
ExplSyntaxOff
authorauthor
titleSome Title \ with line breaks
hypersetup
pdftitle=inlinetitle
begindocument
maketitle
The title of this document is ``inlinetitle''.
begincenter
realtitle
endcenter
enddocument
You can also cope with \[<dimen>]
:
documentclassarticle
usepackagexparse
usepackagehyperref
ExplSyntaxOn
RenewDocumentCommandtitlem
tl_gset:cn @title #1 % needed by maketitle
tl_gset:Nn realtitle #1
tl_set:Nn inlinetitle #1
regex_replace_all:nnN s* c\([[^]]*])+ s* inlinetitle
ExplSyntaxOff
authorauthor
titleSome Title \[1ex] with line breaks \[1ex] and added spacing
hypersetup
pdftitle=inlinetitle
begindocument
maketitle
The title of this document is ``inlinetitle''.
begincenter
realtitle
endcenter
enddocument
Save two more variables, for lack of creativity I named them realtitle
and inlinetitle
. In the second one, \
tokens are substituted with spaces, first removing spaces at either side of \
. Thus it is immaterial if you input any of
titleSome Title \ with line breaks
titleSome Title\ with line breaks
titleSome Title\with line breaks
Here's the code.
documentclassarticle
usepackagexparse
usepackagehyperref
ExplSyntaxOn
RenewDocumentCommandtitlem
tl_gset:cn @title #1 % needed by maketitle
tl_gset:Nn realtitle #1
seq_set_split:Nnn l_tmpa_seq \ #1
tl_gset:Nx inlinetitle seq_use:Nn l_tmpa_seq ~
ExplSyntaxOff
authorauthor
titleSome Title \ with line breaks
hypersetup
pdftitle=inlinetitle
begindocument
maketitle
The title of this document is ``inlinetitle''.
begincenter
realtitle
endcenter
enddocument
You can also cope with \[<dimen>]
:
documentclassarticle
usepackagexparse
usepackagehyperref
ExplSyntaxOn
RenewDocumentCommandtitlem
tl_gset:cn @title #1 % needed by maketitle
tl_gset:Nn realtitle #1
tl_set:Nn inlinetitle #1
regex_replace_all:nnN s* c\([[^]]*])+ s* inlinetitle
ExplSyntaxOff
authorauthor
titleSome Title \[1ex] with line breaks \[1ex] and added spacing
hypersetup
pdftitle=inlinetitle
begindocument
maketitle
The title of this document is ``inlinetitle''.
begincenter
realtitle
endcenter
enddocument
edited Dec 16 at 16:54
answered Dec 16 at 16:38
egreg
708k8618813162
708k8618813162
add a comment |
add a comment |
Different approach: instead of redefining @title
, you can use texorpdfstring
to specify two versions, one without linebreaks which will be used in the pdf meta data and one with linebreak to be displayed in the pdf
documentclassarticle
usepackagehyperref
titletexorpdfstringSomenewline TitleSome title
begindocument
makeatletter
@title % One can use @title in different places
makeatother
enddocument
How can I force line bracking only one place of document, but not in others?
– sergiokapone
Dec 16 at 15:49
@sergiokapone can you give an example where you want it without linebreak? You could specify an optional shorttitle
– samcarter
Dec 16 at 15:51
It is hard to give an example, because in some places of document the@title
should be in one line, but in some another it should to break in predefined place. Fo example, if title looks liketitleThe World Big Idea: with small corrections
. The some places need to be breakThe World Big Idea: \ with small corrections
– sergiokapone
Dec 16 at 15:54
1
@sergiokapone If it is hard to give an example, it is also hard to answer your question. In your question you only mentioned that you need one line for the pdf meta data and this is what I covered in my answer
– samcarter
Dec 16 at 15:56
@sergiokapone Off-topic: Don't use \ for line breaks
– samcarter
Dec 16 at 15:57
|
show 1 more comment
Different approach: instead of redefining @title
, you can use texorpdfstring
to specify two versions, one without linebreaks which will be used in the pdf meta data and one with linebreak to be displayed in the pdf
documentclassarticle
usepackagehyperref
titletexorpdfstringSomenewline TitleSome title
begindocument
makeatletter
@title % One can use @title in different places
makeatother
enddocument
How can I force line bracking only one place of document, but not in others?
– sergiokapone
Dec 16 at 15:49
@sergiokapone can you give an example where you want it without linebreak? You could specify an optional shorttitle
– samcarter
Dec 16 at 15:51
It is hard to give an example, because in some places of document the@title
should be in one line, but in some another it should to break in predefined place. Fo example, if title looks liketitleThe World Big Idea: with small corrections
. The some places need to be breakThe World Big Idea: \ with small corrections
– sergiokapone
Dec 16 at 15:54
1
@sergiokapone If it is hard to give an example, it is also hard to answer your question. In your question you only mentioned that you need one line for the pdf meta data and this is what I covered in my answer
– samcarter
Dec 16 at 15:56
@sergiokapone Off-topic: Don't use \ for line breaks
– samcarter
Dec 16 at 15:57
|
show 1 more comment
Different approach: instead of redefining @title
, you can use texorpdfstring
to specify two versions, one without linebreaks which will be used in the pdf meta data and one with linebreak to be displayed in the pdf
documentclassarticle
usepackagehyperref
titletexorpdfstringSomenewline TitleSome title
begindocument
makeatletter
@title % One can use @title in different places
makeatother
enddocument
Different approach: instead of redefining @title
, you can use texorpdfstring
to specify two versions, one without linebreaks which will be used in the pdf meta data and one with linebreak to be displayed in the pdf
documentclassarticle
usepackagehyperref
titletexorpdfstringSomenewline TitleSome title
begindocument
makeatletter
@title % One can use @title in different places
makeatother
enddocument
answered Dec 16 at 15:44
samcarter
85.6k794274
85.6k794274
How can I force line bracking only one place of document, but not in others?
– sergiokapone
Dec 16 at 15:49
@sergiokapone can you give an example where you want it without linebreak? You could specify an optional shorttitle
– samcarter
Dec 16 at 15:51
It is hard to give an example, because in some places of document the@title
should be in one line, but in some another it should to break in predefined place. Fo example, if title looks liketitleThe World Big Idea: with small corrections
. The some places need to be breakThe World Big Idea: \ with small corrections
– sergiokapone
Dec 16 at 15:54
1
@sergiokapone If it is hard to give an example, it is also hard to answer your question. In your question you only mentioned that you need one line for the pdf meta data and this is what I covered in my answer
– samcarter
Dec 16 at 15:56
@sergiokapone Off-topic: Don't use \ for line breaks
– samcarter
Dec 16 at 15:57
|
show 1 more comment
How can I force line bracking only one place of document, but not in others?
– sergiokapone
Dec 16 at 15:49
@sergiokapone can you give an example where you want it without linebreak? You could specify an optional shorttitle
– samcarter
Dec 16 at 15:51
It is hard to give an example, because in some places of document the@title
should be in one line, but in some another it should to break in predefined place. Fo example, if title looks liketitleThe World Big Idea: with small corrections
. The some places need to be breakThe World Big Idea: \ with small corrections
– sergiokapone
Dec 16 at 15:54
1
@sergiokapone If it is hard to give an example, it is also hard to answer your question. In your question you only mentioned that you need one line for the pdf meta data and this is what I covered in my answer
– samcarter
Dec 16 at 15:56
@sergiokapone Off-topic: Don't use \ for line breaks
– samcarter
Dec 16 at 15:57
How can I force line bracking only one place of document, but not in others?
– sergiokapone
Dec 16 at 15:49
How can I force line bracking only one place of document, but not in others?
– sergiokapone
Dec 16 at 15:49
@sergiokapone can you give an example where you want it without linebreak? You could specify an optional shorttitle
– samcarter
Dec 16 at 15:51
@sergiokapone can you give an example where you want it without linebreak? You could specify an optional shorttitle
– samcarter
Dec 16 at 15:51
It is hard to give an example, because in some places of document the
@title
should be in one line, but in some another it should to break in predefined place. Fo example, if title looks like titleThe World Big Idea: with small corrections
. The some places need to be break The World Big Idea: \ with small corrections
– sergiokapone
Dec 16 at 15:54
It is hard to give an example, because in some places of document the
@title
should be in one line, but in some another it should to break in predefined place. Fo example, if title looks like titleThe World Big Idea: with small corrections
. The some places need to be break The World Big Idea: \ with small corrections
– sergiokapone
Dec 16 at 15:54
1
1
@sergiokapone If it is hard to give an example, it is also hard to answer your question. In your question you only mentioned that you need one line for the pdf meta data and this is what I covered in my answer
– samcarter
Dec 16 at 15:56
@sergiokapone If it is hard to give an example, it is also hard to answer your question. In your question you only mentioned that you need one line for the pdf meta data and this is what I covered in my answer
– samcarter
Dec 16 at 15:56
@sergiokapone Off-topic: Don't use \ for line breaks
– samcarter
Dec 16 at 15:57
@sergiokapone Off-topic: Don't use \ for line breaks
– samcarter
Dec 16 at 15:57
|
show 1 more 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.
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.
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%2f466095%2fredefine-title-for-possibility-of-a-forced-line-breaking-in-a-predefined-place%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
1
I guess this depends on what uses for
@title
you have in mind.– moewe
Dec 16 at 15:48
@moewe I use the
@title
inhypersetuppdftitle=@title
. Here it shoul be in single line, but in titlepage I need to breack the line in some place.– sergiokapone
Dec 16 at 15:51
@sergiokapone Off-topic
hypersetuppdftitle=@title
is unnecessary, the title is used per default for the pdf meta data– samcarter
Dec 16 at 15:53
@samcarter Ok, but
hypersetuppdftitle=@title
was just for example.– sergiokapone
Dec 16 at 15:58
2
Mhhh,
@title
is one macro and it can obviously only have one definition at a time. You could write something liketitleSome mypossiblenewline Title
and redefine the meaning ofmypossiblenewline
from context to context. But I think it would be tricky to have one place of definition for@title
and several possible outcomes.– moewe
Dec 16 at 16:04