KTUG마당은 KTUG를 방문하는 모든 이용자가 대화를 나누고 소식을 전하는 곳입니다.

  • 로그인 없이 자유롭게 글을 읽고 쓸 수 있는 철학은 처음과 같이 계속됩니다.
  • Team Blog의 글을 이곳 게시판의 "정보글"로 모았습니다. Team blog는 기고자가 올린 글에 질문을 받는 부담을 줄이기 위하여 댓글을 허용하지 않았습니다. 그러나 이곳 게시판으로 모으면서 댓글을 달 수 있습니다. 게시물을 작성하실 때 댓글을 원하지 않으시면 댓글을 허용하시지 않으시기를 바랍니다. 또한 불필요한 소모성 댓글을 달지 않도록 주의하여 주시기를 바랍니다.
  • TeX과 관련된 질문이나 답변은 QnA 마당을 이용하십시오. TeX과 관련된 질문은 지웁니다
  • MathJax를 이용한 수식조판을 사용하실 수 있습니다. 여기를 참조하세요.
  • 스팸 글을 막기 위하여 짧은 시간 내에 다시 글이 등록되는 IP를 막거나, 광고 글을 막기 위하여 금지어로 .com, .net 등을 설정하고 있습니다. 다소간의 불편함이 있으시더라도 양해 바랍니다.
    • 금지어에서 stackexchange, stackoverflow, ctan, overleaf, , github, google.com, gmail.com, .org, .io, sil.org, wiki.com, tistory.com등은 해제하였습니다.
  • 사용하는 편집기는 CKeditor입니다. 편집기에서 [enter]를 누르면 <p> 태그가 들어가고, 문단으로 생각하고 한줄을 비웁니다. 글줄만 바꾸려면 shift-enter 를 누르시면 <BR>가 들어가므로 용도에 맞게 나누어 쓸 수 있습니다.

자유글 minipage의 parskip이 tikz에 미치는 영향

2009.12.23 13:27

이호재 조회 수:39608

질문게시판에 올려야 할 듯하지만, 문제의 원인을 알았기 때문에 달리 회피하는 방법을 취하여 일단 문제를 해결하였습니다.

재미삼아 봐주십시오.


일전에 재미삼아 만든 원문자 매크로에서 

\abnormalparskip{.25\baselineskip} 등으로 minipage안에 \parskip을 달리 설정하여 주면 \tikz\node에 영향을 준다는 것을 알게 되었습니다.


파일 첨부가 안 되나요?

컴파일 해 보시고 각 단락에서 박스의 높이의 차이에 주목해 주시기 바랍니다.


\documentclass[openany,9pt,showtrims]{memoir} 
%\usepackage{hoze-style}
\usepackage{ifluatex}
\usepackage{xkeyval}
\usepackage{xifthen}
\usepackage{xcolor}
\usepackage{tikz}

\makeatletter
\newcommand\wrapnumfont{\wrapnumbf}
\newcommand\wrapnumbf{\bfseries}
\newcommand\wrapnumbase{}
\newlength\wrapnumwidth
\newlength\wrapsep
\setlength\wrapsep{1.5pt}
\newcommand\wrapbgcolor{black}
\newcommand\wrapfgcolor{white}

\newcommand\cirnum[1]{%  
   \raisebox{-.25\baselineskip}{
   \tikz\node[%
   circle, draw=\wrapfgcolor, thin, inner sep=.1\wrapsep,
   top color=\wrapbgcolor, bottom color=\wrapbgcolor,
text width=\wrapnumwidth, 
font=\wrapnumfont, text badly centered, \wrapfgcolor
]{#1};%
   }%
}


\newcommand\ovalnum[1]{%  
   \raisebox{-.15\baselineskip}{
   \tikz\node[%  
   rectangle, draw=\wrapfgcolor, thin, inner sep=\wrapsep,
   rounded corners=3pt,
   top color=\wrapbgcolor, bottom color=\wrapbgcolor,
text width=\wrapnumwidth, 
font=\wrapnumfont, text badly centered, \wrapfgcolor
]{#1};%
   }%
}

\newcommand\recnum[1]{%  
   \raisebox{-.15\baselineskip}{
   \tikz\node[%
   rectangle, draw=\wrapfgcolor, thin, inner sep=\wrapsep,
   top color=\wrapbgcolor, bottom color=\wrapbgcolor,
text width=\wrapnumwidth, 
font=\wrapnumfont, text badly centered, \wrapfgcolor
]{#1};%
   }%
}

\define@key{wrapnum}{base}{%
\renewcommand\wrapnumbase{#1}%
\setwrapnumwidth%
}
\define@key{wrapnum}{font}{%
\renewcommand\wrapnumfont{\wrapnumbf#1}%
\setwrapnumwidth%
}

\newcommand\setwrapnumwidth{%
\settowidth\wrapnumwidth{\wrapnumfont\wrapnumbase}%
}

\define@key{wrapnum}{type}[circle]{%
\ifthenelse{\equal{#1}{circle}}{\let\wrapnum\cirnum}{}%
\ifthenelse{\equal{#1}{rectangle}}{\let\wrapnum\recnum}{}%
\ifthenelse{\equal{#1}{oval}}{\let\wrapnum\ovalnum}{}%
}

\define@key{wrapnum}{background}{
\renewcommand\wrapbgcolor{#1}
}

\define@key{wrapnum}{foreground}{
\renewcommand\wrapfgcolor{#1}
}

\define@key{wrapnum}{color}{%
\ifthenelse{\equal{#1}{white}}{%
\renewcommand\wrapbgcolor{white}%
\renewcommand\wrapfgcolor{black}%
\renewcommand\wrapnumbf{}%
}{}%
\ifthenelse{\equal{#1}{black}}{%
\renewcommand\wrapbgcolor{black}%
\renewcommand\wrapfgcolor{white}%
\renewcommand\wrapnumbf{\bfseries}%
}{}%
}

\define@key{wrapnum}{wrapseparate}{%
\setlength\wrapsep{#1}%
}

\newcommand\setwrapnum[1]{%
\setkeys{wrapnum}{#1}%
}

\setwrapnum{%
type=rectangle,
base=99,
}

\ifluatex
\newcommand\wrapchar[2][]{%
  \setwrapnum{#1}
  \@wrapchar#2|%
}
\def\@wrapchar#1|{%
 \directlua{%
    local utf8 = unicode.utf8
    str = "#1"
    for i=1, utf8.len(str) do
     char=utf8.sub(str, i, i)
     if char==' ' then
     macro = "\string\\hspace{0.25em}"
     else
     macro = "\string\\wrapnum{"..char.."}\string\\hspace{-0.25em}"
     end
     tex.print(macro)
    end
 }%
}
\fi
\makeatother

\begin{document}

\wrapchar[type=rectangle, color=black]{There's a lady who's sure all that glitters is gold when she's buying a stairway to heaven.}
There's a lady who sure all that glitters is gold when she's buying a stairway to heaven.

\bigskip

\abnormalparskip{.25\baselineskip}
\wrapchar[type=rectangle, color=black]{There's a lady who's sure all that glitters is gold when she's buying a stairway to heaven.}
There's a lady who sure all that glitters is gold when she's buying a stairway to heaven.

\abnormalparskip{2ex}
\wrapchar[type=rectangle, color=black]{There's a lady who's sure all that glitters is gold when she's buying a stairway to heaven.}
There's a lady who sure all that glitters is gold when she's buying a stairway to heaven.

\end{document}




XE Login