Dynamic row spacing if total character is variableFit text within a frame with fixed dimension (shrink only...

Why do we use polarized capacitors?

Is domain driven design an anti-SQL pattern?

What happens when a metallic dragon and a chromatic dragon mate?

How could a lack of term limits lead to a "dictatorship?"

LWC and complex parameters

What are the advantages and disadvantages of running one shots compared to campaigns?

Re-submission of rejected manuscript without informing co-authors

Where to refill my bottle in India?

extract characters between two commas?

Is there a name of the flying bionic bird?

What to wear for invited talk in Canada

Are cabin dividers used to "hide" the flex of the airplane?

How to manage monthly salary

What do the Banks children have against barley water?

How to deal with fear of taking dependencies

I’m planning on buying a laser printer but concerned about the life cycle of toner in the machine

aging parents with no investments

How is it possible for user's password to be changed after storage was encrypted? (on OS X, Android)

Shall I use personal or official e-mail account when registering to external websites for work purpose?

Is it legal to have the "// (c) 2019 John Smith" header in all files when there are hundreds of contributors?

Lied on resume at previous job

Ideas for 3rd eye abilities

Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?

Crop image to path created in TikZ?



Dynamic row spacing if total character is variable


Fit text within a frame with fixed dimension (shrink only if needed)Problem with dynamic table creationUsing string variable with LaTeXDynamic programming of cheapest cost in LaTeXspacing between text and frame of table?Add text only if a variable has been definedInsert something between row 1 and row 2 by tcbitemize optionsDynamic calculation of tcolorbox option using pgfmathenforce total height of tcolorbox titleHow to index each tcolorbox box by a number/total fraction?Dynamic change text with different Definition













2















I use datatool to get data and row spacing can change.



Count word/character of Total character of (Text A + Text B) if:



Total charater of (Text A + Text B) < 20 characters => set row space of text in tcolorbox = 1.5 cm



Total character of (Text A + Text B) = 21 - 50 characters => set row space of text in tcolorbox = 0.8 cm



Total character of (Text A + Text B) > 50 charaters => set row space of text in tcolorbox = 0.3 cm



Minimal working code:



documentclass{article}
usepackage[many]{tcolorbox}
usepackage{wrapfig}
usepackage{lipsum}
tcbset{colframe=blue!75!black,colback=white}
usepackage{filecontents}
begin{filecontents*}{file.tex}

No,TextA,TextB
1,a a a a a a a a a a a a a a a a a a a a,b b b b b b
2,a a a a a a a a a a,b b b b b b
3,a a a a a a a a a a,b b b b b b b b b b b b
4,a a a a a a a a a a,b b b b b b b b b b b b b b b b b b
5,a a a a a a a a a a a a a a a,b b b b b b
6,a a a a a a a a a a a a a a a a a a a a,b b b b b b
7,a a a a a a a a a a a a a a a,b b b b b b b b b b b b

end{filecontents*}
usepackage{datatool}
DTLloaddb[autokeys=false]{file}{file.tex}

begin{document}

DTLforeach*
{file}% Database
{No=No,TextA=TextA,TextB=TextB}{%

%begin{mybox}[height=4.5cm]
begin{tcolorbox}[height=4cm,width=6cm]


begin{wrapfigure}{R}{1.5cm}
centering
includegraphics[width=2cm,height=2cm]{example-image-a}
end{wrapfigure}
No quad TextA quad TextBpar
end{tcolorbox}
newpage
}%
end{document}


Many thank










share|improve this question




















  • 1





    tcolorbox offers fitting library to do the inverse task, you can reduce fontsize to fit certain text inside a defined box. May be you could consider it as an alternative solution.

    – Ignasi
    19 hours ago











  • @Ignasi. thank for your solution. i see this tex.stackexchange.com/questions/271829/… . but it's Rectangle shape. My situation is L shape (with includegraphics). thanks

    – latexforti
    18 hours ago






  • 1





    Yes, I know it's only valid for rectangular shapes but as your example was so short it was not clear that the L shape was so necessary.

    – Ignasi
    16 hours ago
















2















I use datatool to get data and row spacing can change.



Count word/character of Total character of (Text A + Text B) if:



Total charater of (Text A + Text B) < 20 characters => set row space of text in tcolorbox = 1.5 cm



Total character of (Text A + Text B) = 21 - 50 characters => set row space of text in tcolorbox = 0.8 cm



Total character of (Text A + Text B) > 50 charaters => set row space of text in tcolorbox = 0.3 cm



Minimal working code:



documentclass{article}
usepackage[many]{tcolorbox}
usepackage{wrapfig}
usepackage{lipsum}
tcbset{colframe=blue!75!black,colback=white}
usepackage{filecontents}
begin{filecontents*}{file.tex}

No,TextA,TextB
1,a a a a a a a a a a a a a a a a a a a a,b b b b b b
2,a a a a a a a a a a,b b b b b b
3,a a a a a a a a a a,b b b b b b b b b b b b
4,a a a a a a a a a a,b b b b b b b b b b b b b b b b b b
5,a a a a a a a a a a a a a a a,b b b b b b
6,a a a a a a a a a a a a a a a a a a a a,b b b b b b
7,a a a a a a a a a a a a a a a,b b b b b b b b b b b b

end{filecontents*}
usepackage{datatool}
DTLloaddb[autokeys=false]{file}{file.tex}

begin{document}

DTLforeach*
{file}% Database
{No=No,TextA=TextA,TextB=TextB}{%

%begin{mybox}[height=4.5cm]
begin{tcolorbox}[height=4cm,width=6cm]


begin{wrapfigure}{R}{1.5cm}
centering
includegraphics[width=2cm,height=2cm]{example-image-a}
end{wrapfigure}
No quad TextA quad TextBpar
end{tcolorbox}
newpage
}%
end{document}


Many thank










share|improve this question




















  • 1





    tcolorbox offers fitting library to do the inverse task, you can reduce fontsize to fit certain text inside a defined box. May be you could consider it as an alternative solution.

    – Ignasi
    19 hours ago











  • @Ignasi. thank for your solution. i see this tex.stackexchange.com/questions/271829/… . but it's Rectangle shape. My situation is L shape (with includegraphics). thanks

    – latexforti
    18 hours ago






  • 1





    Yes, I know it's only valid for rectangular shapes but as your example was so short it was not clear that the L shape was so necessary.

    – Ignasi
    16 hours ago














2












2








2








I use datatool to get data and row spacing can change.



Count word/character of Total character of (Text A + Text B) if:



Total charater of (Text A + Text B) < 20 characters => set row space of text in tcolorbox = 1.5 cm



Total character of (Text A + Text B) = 21 - 50 characters => set row space of text in tcolorbox = 0.8 cm



Total character of (Text A + Text B) > 50 charaters => set row space of text in tcolorbox = 0.3 cm



Minimal working code:



documentclass{article}
usepackage[many]{tcolorbox}
usepackage{wrapfig}
usepackage{lipsum}
tcbset{colframe=blue!75!black,colback=white}
usepackage{filecontents}
begin{filecontents*}{file.tex}

No,TextA,TextB
1,a a a a a a a a a a a a a a a a a a a a,b b b b b b
2,a a a a a a a a a a,b b b b b b
3,a a a a a a a a a a,b b b b b b b b b b b b
4,a a a a a a a a a a,b b b b b b b b b b b b b b b b b b
5,a a a a a a a a a a a a a a a,b b b b b b
6,a a a a a a a a a a a a a a a a a a a a,b b b b b b
7,a a a a a a a a a a a a a a a,b b b b b b b b b b b b

end{filecontents*}
usepackage{datatool}
DTLloaddb[autokeys=false]{file}{file.tex}

begin{document}

DTLforeach*
{file}% Database
{No=No,TextA=TextA,TextB=TextB}{%

%begin{mybox}[height=4.5cm]
begin{tcolorbox}[height=4cm,width=6cm]


begin{wrapfigure}{R}{1.5cm}
centering
includegraphics[width=2cm,height=2cm]{example-image-a}
end{wrapfigure}
No quad TextA quad TextBpar
end{tcolorbox}
newpage
}%
end{document}


Many thank










share|improve this question
















I use datatool to get data and row spacing can change.



Count word/character of Total character of (Text A + Text B) if:



Total charater of (Text A + Text B) < 20 characters => set row space of text in tcolorbox = 1.5 cm



Total character of (Text A + Text B) = 21 - 50 characters => set row space of text in tcolorbox = 0.8 cm



Total character of (Text A + Text B) > 50 charaters => set row space of text in tcolorbox = 0.3 cm



Minimal working code:



documentclass{article}
usepackage[many]{tcolorbox}
usepackage{wrapfig}
usepackage{lipsum}
tcbset{colframe=blue!75!black,colback=white}
usepackage{filecontents}
begin{filecontents*}{file.tex}

No,TextA,TextB
1,a a a a a a a a a a a a a a a a a a a a,b b b b b b
2,a a a a a a a a a a,b b b b b b
3,a a a a a a a a a a,b b b b b b b b b b b b
4,a a a a a a a a a a,b b b b b b b b b b b b b b b b b b
5,a a a a a a a a a a a a a a a,b b b b b b
6,a a a a a a a a a a a a a a a a a a a a,b b b b b b
7,a a a a a a a a a a a a a a a,b b b b b b b b b b b b

end{filecontents*}
usepackage{datatool}
DTLloaddb[autokeys=false]{file}{file.tex}

begin{document}

DTLforeach*
{file}% Database
{No=No,TextA=TextA,TextB=TextB}{%

%begin{mybox}[height=4.5cm]
begin{tcolorbox}[height=4cm,width=6cm]


begin{wrapfigure}{R}{1.5cm}
centering
includegraphics[width=2cm,height=2cm]{example-image-a}
end{wrapfigure}
No quad TextA quad TextBpar
end{tcolorbox}
newpage
}%
end{document}


Many thank







tcolorbox programming






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 19 hours ago









Bernard

175k778208




175k778208










asked 22 hours ago









latexfortilatexforti

4627




4627








  • 1





    tcolorbox offers fitting library to do the inverse task, you can reduce fontsize to fit certain text inside a defined box. May be you could consider it as an alternative solution.

    – Ignasi
    19 hours ago











  • @Ignasi. thank for your solution. i see this tex.stackexchange.com/questions/271829/… . but it's Rectangle shape. My situation is L shape (with includegraphics). thanks

    – latexforti
    18 hours ago






  • 1





    Yes, I know it's only valid for rectangular shapes but as your example was so short it was not clear that the L shape was so necessary.

    – Ignasi
    16 hours ago














  • 1





    tcolorbox offers fitting library to do the inverse task, you can reduce fontsize to fit certain text inside a defined box. May be you could consider it as an alternative solution.

    – Ignasi
    19 hours ago











  • @Ignasi. thank for your solution. i see this tex.stackexchange.com/questions/271829/… . but it's Rectangle shape. My situation is L shape (with includegraphics). thanks

    – latexforti
    18 hours ago






  • 1





    Yes, I know it's only valid for rectangular shapes but as your example was so short it was not clear that the L shape was so necessary.

    – Ignasi
    16 hours ago








1




1





tcolorbox offers fitting library to do the inverse task, you can reduce fontsize to fit certain text inside a defined box. May be you could consider it as an alternative solution.

– Ignasi
19 hours ago





tcolorbox offers fitting library to do the inverse task, you can reduce fontsize to fit certain text inside a defined box. May be you could consider it as an alternative solution.

– Ignasi
19 hours ago













@Ignasi. thank for your solution. i see this tex.stackexchange.com/questions/271829/… . but it's Rectangle shape. My situation is L shape (with includegraphics). thanks

– latexforti
18 hours ago





@Ignasi. thank for your solution. i see this tex.stackexchange.com/questions/271829/… . but it's Rectangle shape. My situation is L shape (with includegraphics). thanks

– latexforti
18 hours ago




1




1





Yes, I know it's only valid for rectangular shapes but as your example was so short it was not clear that the L shape was so necessary.

– Ignasi
16 hours ago





Yes, I know it's only valid for rectangular shapes but as your example was so short it was not clear that the L shape was so necessary.

– Ignasi
16 hours ago










1 Answer
1






active

oldest

votes


















2














You have to set the baseline skip before wrapfigure.



RequirePackage{filecontents}

begin{filecontents*}{jobname-file.tex}

No,TextA,TextB
1,a a a a a a a a a a a a a a a a a a a a,b b b b b b
2,a a a a a a a a a a,b b b b b b
3,a a a a a a a a a a,b b b b b b b b b b b b
4,a a a a a a a a a a,b b b b b b b b b b b b b b b b b b
5,a a a a a a a a a a a a a a a,b b b b b b
6,a a a a a a a a a a a a a a a a a a a a,b b b b b b
7,a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a,b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b

end{filecontents*}

documentclass[twocolumn]{article}
usepackage[many]{tcolorbox}
usepackage{filecontents}
usepackage{datatool}
usepackage{wrapfig}
usepackage{xparse}

usepackage{lipsum}

tcbset{colframe=blue!75!black,colback=white}

DTLloaddb[autokeys=false]{file}{jobname-file.tex}

ExplSyntaxOn
NewDocumentCommand{setbaselineskip}{mmm}
{
tl_set:Nx l_tmpa_tl { exp_not:V #1 ~ exp_not:V #2 ~ exp_not:V #3 }
int_compare:nTF { tl_count:N l_tmpa_tl <= 20 }
{
setlength{baselineskip}{ dim_eval:n { baselineskip+1.5cm} }
}
{
int_compare:nTF { tl_count:N l_tmpa_tl <= 50 }
{
setlength{baselineskip}{ dim_eval:n { baselineskip+0.8cm} }
}
{
setlength{baselineskip}{ dim_eval:n { baselineskip+0.3cm} }
}
}
}
ExplSyntaxOff

begin{document}

DTLforeach*
{file}% Database
{No=No,TextA=TextA,TextB=TextB}
{%
begin{tcolorbox}[width=6cm]
setbaselineskip{No}{TextA}{TextB}
begin{wrapfigure}{R}{2cm}
centering
includegraphics[width=2cm,height=2cm]{example-image-a}
end{wrapfigure}
No quad TextA quad TextB
end{tcolorbox}
% newpage
}

end{document}


enter image description here






share|improve this answer


























  • Sorry my fault. Row spacing = Line spacing = space between 2 rows . imgur.com/FWVzQQA. Thank you, can you edit your code for line spacing, not for word spacing. Thank

    – latexforti
    15 hours ago








  • 1





    @latexforti Fixed

    – egreg
    15 hours ago











  • thank you. it's awesome. Now i don't want display No in text. How can i edit code without No, only Total of textA & textB. setbaselineskip{TextA}{TextB} thanks

    – latexforti
    5 hours 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%2f483743%2fdynamic-row-spacing-if-total-character-is-variable%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 have to set the baseline skip before wrapfigure.



RequirePackage{filecontents}

begin{filecontents*}{jobname-file.tex}

No,TextA,TextB
1,a a a a a a a a a a a a a a a a a a a a,b b b b b b
2,a a a a a a a a a a,b b b b b b
3,a a a a a a a a a a,b b b b b b b b b b b b
4,a a a a a a a a a a,b b b b b b b b b b b b b b b b b b
5,a a a a a a a a a a a a a a a,b b b b b b
6,a a a a a a a a a a a a a a a a a a a a,b b b b b b
7,a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a,b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b

end{filecontents*}

documentclass[twocolumn]{article}
usepackage[many]{tcolorbox}
usepackage{filecontents}
usepackage{datatool}
usepackage{wrapfig}
usepackage{xparse}

usepackage{lipsum}

tcbset{colframe=blue!75!black,colback=white}

DTLloaddb[autokeys=false]{file}{jobname-file.tex}

ExplSyntaxOn
NewDocumentCommand{setbaselineskip}{mmm}
{
tl_set:Nx l_tmpa_tl { exp_not:V #1 ~ exp_not:V #2 ~ exp_not:V #3 }
int_compare:nTF { tl_count:N l_tmpa_tl <= 20 }
{
setlength{baselineskip}{ dim_eval:n { baselineskip+1.5cm} }
}
{
int_compare:nTF { tl_count:N l_tmpa_tl <= 50 }
{
setlength{baselineskip}{ dim_eval:n { baselineskip+0.8cm} }
}
{
setlength{baselineskip}{ dim_eval:n { baselineskip+0.3cm} }
}
}
}
ExplSyntaxOff

begin{document}

DTLforeach*
{file}% Database
{No=No,TextA=TextA,TextB=TextB}
{%
begin{tcolorbox}[width=6cm]
setbaselineskip{No}{TextA}{TextB}
begin{wrapfigure}{R}{2cm}
centering
includegraphics[width=2cm,height=2cm]{example-image-a}
end{wrapfigure}
No quad TextA quad TextB
end{tcolorbox}
% newpage
}

end{document}


enter image description here






share|improve this answer


























  • Sorry my fault. Row spacing = Line spacing = space between 2 rows . imgur.com/FWVzQQA. Thank you, can you edit your code for line spacing, not for word spacing. Thank

    – latexforti
    15 hours ago








  • 1





    @latexforti Fixed

    – egreg
    15 hours ago











  • thank you. it's awesome. Now i don't want display No in text. How can i edit code without No, only Total of textA & textB. setbaselineskip{TextA}{TextB} thanks

    – latexforti
    5 hours ago


















2














You have to set the baseline skip before wrapfigure.



RequirePackage{filecontents}

begin{filecontents*}{jobname-file.tex}

No,TextA,TextB
1,a a a a a a a a a a a a a a a a a a a a,b b b b b b
2,a a a a a a a a a a,b b b b b b
3,a a a a a a a a a a,b b b b b b b b b b b b
4,a a a a a a a a a a,b b b b b b b b b b b b b b b b b b
5,a a a a a a a a a a a a a a a,b b b b b b
6,a a a a a a a a a a a a a a a a a a a a,b b b b b b
7,a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a,b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b

end{filecontents*}

documentclass[twocolumn]{article}
usepackage[many]{tcolorbox}
usepackage{filecontents}
usepackage{datatool}
usepackage{wrapfig}
usepackage{xparse}

usepackage{lipsum}

tcbset{colframe=blue!75!black,colback=white}

DTLloaddb[autokeys=false]{file}{jobname-file.tex}

ExplSyntaxOn
NewDocumentCommand{setbaselineskip}{mmm}
{
tl_set:Nx l_tmpa_tl { exp_not:V #1 ~ exp_not:V #2 ~ exp_not:V #3 }
int_compare:nTF { tl_count:N l_tmpa_tl <= 20 }
{
setlength{baselineskip}{ dim_eval:n { baselineskip+1.5cm} }
}
{
int_compare:nTF { tl_count:N l_tmpa_tl <= 50 }
{
setlength{baselineskip}{ dim_eval:n { baselineskip+0.8cm} }
}
{
setlength{baselineskip}{ dim_eval:n { baselineskip+0.3cm} }
}
}
}
ExplSyntaxOff

begin{document}

DTLforeach*
{file}% Database
{No=No,TextA=TextA,TextB=TextB}
{%
begin{tcolorbox}[width=6cm]
setbaselineskip{No}{TextA}{TextB}
begin{wrapfigure}{R}{2cm}
centering
includegraphics[width=2cm,height=2cm]{example-image-a}
end{wrapfigure}
No quad TextA quad TextB
end{tcolorbox}
% newpage
}

end{document}


enter image description here






share|improve this answer


























  • Sorry my fault. Row spacing = Line spacing = space between 2 rows . imgur.com/FWVzQQA. Thank you, can you edit your code for line spacing, not for word spacing. Thank

    – latexforti
    15 hours ago








  • 1





    @latexforti Fixed

    – egreg
    15 hours ago











  • thank you. it's awesome. Now i don't want display No in text. How can i edit code without No, only Total of textA & textB. setbaselineskip{TextA}{TextB} thanks

    – latexforti
    5 hours ago
















2












2








2







You have to set the baseline skip before wrapfigure.



RequirePackage{filecontents}

begin{filecontents*}{jobname-file.tex}

No,TextA,TextB
1,a a a a a a a a a a a a a a a a a a a a,b b b b b b
2,a a a a a a a a a a,b b b b b b
3,a a a a a a a a a a,b b b b b b b b b b b b
4,a a a a a a a a a a,b b b b b b b b b b b b b b b b b b
5,a a a a a a a a a a a a a a a,b b b b b b
6,a a a a a a a a a a a a a a a a a a a a,b b b b b b
7,a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a,b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b

end{filecontents*}

documentclass[twocolumn]{article}
usepackage[many]{tcolorbox}
usepackage{filecontents}
usepackage{datatool}
usepackage{wrapfig}
usepackage{xparse}

usepackage{lipsum}

tcbset{colframe=blue!75!black,colback=white}

DTLloaddb[autokeys=false]{file}{jobname-file.tex}

ExplSyntaxOn
NewDocumentCommand{setbaselineskip}{mmm}
{
tl_set:Nx l_tmpa_tl { exp_not:V #1 ~ exp_not:V #2 ~ exp_not:V #3 }
int_compare:nTF { tl_count:N l_tmpa_tl <= 20 }
{
setlength{baselineskip}{ dim_eval:n { baselineskip+1.5cm} }
}
{
int_compare:nTF { tl_count:N l_tmpa_tl <= 50 }
{
setlength{baselineskip}{ dim_eval:n { baselineskip+0.8cm} }
}
{
setlength{baselineskip}{ dim_eval:n { baselineskip+0.3cm} }
}
}
}
ExplSyntaxOff

begin{document}

DTLforeach*
{file}% Database
{No=No,TextA=TextA,TextB=TextB}
{%
begin{tcolorbox}[width=6cm]
setbaselineskip{No}{TextA}{TextB}
begin{wrapfigure}{R}{2cm}
centering
includegraphics[width=2cm,height=2cm]{example-image-a}
end{wrapfigure}
No quad TextA quad TextB
end{tcolorbox}
% newpage
}

end{document}


enter image description here






share|improve this answer















You have to set the baseline skip before wrapfigure.



RequirePackage{filecontents}

begin{filecontents*}{jobname-file.tex}

No,TextA,TextB
1,a a a a a a a a a a a a a a a a a a a a,b b b b b b
2,a a a a a a a a a a,b b b b b b
3,a a a a a a a a a a,b b b b b b b b b b b b
4,a a a a a a a a a a,b b b b b b b b b b b b b b b b b b
5,a a a a a a a a a a a a a a a,b b b b b b
6,a a a a a a a a a a a a a a a a a a a a,b b b b b b
7,a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a,b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b

end{filecontents*}

documentclass[twocolumn]{article}
usepackage[many]{tcolorbox}
usepackage{filecontents}
usepackage{datatool}
usepackage{wrapfig}
usepackage{xparse}

usepackage{lipsum}

tcbset{colframe=blue!75!black,colback=white}

DTLloaddb[autokeys=false]{file}{jobname-file.tex}

ExplSyntaxOn
NewDocumentCommand{setbaselineskip}{mmm}
{
tl_set:Nx l_tmpa_tl { exp_not:V #1 ~ exp_not:V #2 ~ exp_not:V #3 }
int_compare:nTF { tl_count:N l_tmpa_tl <= 20 }
{
setlength{baselineskip}{ dim_eval:n { baselineskip+1.5cm} }
}
{
int_compare:nTF { tl_count:N l_tmpa_tl <= 50 }
{
setlength{baselineskip}{ dim_eval:n { baselineskip+0.8cm} }
}
{
setlength{baselineskip}{ dim_eval:n { baselineskip+0.3cm} }
}
}
}
ExplSyntaxOff

begin{document}

DTLforeach*
{file}% Database
{No=No,TextA=TextA,TextB=TextB}
{%
begin{tcolorbox}[width=6cm]
setbaselineskip{No}{TextA}{TextB}
begin{wrapfigure}{R}{2cm}
centering
includegraphics[width=2cm,height=2cm]{example-image-a}
end{wrapfigure}
No quad TextA quad TextB
end{tcolorbox}
% newpage
}

end{document}


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 15 hours ago

























answered 16 hours ago









egregegreg

732k8919303254




732k8919303254













  • Sorry my fault. Row spacing = Line spacing = space between 2 rows . imgur.com/FWVzQQA. Thank you, can you edit your code for line spacing, not for word spacing. Thank

    – latexforti
    15 hours ago








  • 1





    @latexforti Fixed

    – egreg
    15 hours ago











  • thank you. it's awesome. Now i don't want display No in text. How can i edit code without No, only Total of textA & textB. setbaselineskip{TextA}{TextB} thanks

    – latexforti
    5 hours ago





















  • Sorry my fault. Row spacing = Line spacing = space between 2 rows . imgur.com/FWVzQQA. Thank you, can you edit your code for line spacing, not for word spacing. Thank

    – latexforti
    15 hours ago








  • 1





    @latexforti Fixed

    – egreg
    15 hours ago











  • thank you. it's awesome. Now i don't want display No in text. How can i edit code without No, only Total of textA & textB. setbaselineskip{TextA}{TextB} thanks

    – latexforti
    5 hours ago



















Sorry my fault. Row spacing = Line spacing = space between 2 rows . imgur.com/FWVzQQA. Thank you, can you edit your code for line spacing, not for word spacing. Thank

– latexforti
15 hours ago







Sorry my fault. Row spacing = Line spacing = space between 2 rows . imgur.com/FWVzQQA. Thank you, can you edit your code for line spacing, not for word spacing. Thank

– latexforti
15 hours ago






1




1





@latexforti Fixed

– egreg
15 hours ago





@latexforti Fixed

– egreg
15 hours ago













thank you. it's awesome. Now i don't want display No in text. How can i edit code without No, only Total of textA & textB. setbaselineskip{TextA}{TextB} thanks

– latexforti
5 hours ago







thank you. it's awesome. Now i don't want display No in text. How can i edit code without No, only Total of textA & textB. setbaselineskip{TextA}{TextB} thanks

– latexforti
5 hours 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f483743%2fdynamic-row-spacing-if-total-character-is-variable%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

El tren de la libertad Índice Antecedentes "Porque yo decido" Desarrollo de la...

Castillo d'Acher Características Menú de navegación

Connecting two nodes from the same mother node horizontallyTikZ: What EXACTLY does the the |- notation for...