# ConTeXt :: Manual interno # Futuras pesquisas * Cores de texto * Posicionamento da imagem * Numeração de página com box colorito * Box de conteúdo * Layout de capítulo # Links wiki.contextgarden.net github.com/hedra-digital/pesquisa-ConTeXt ## Básicos ### Compilador ```shell context 012b.tex --result=TESTE.pdf --purgeall --usemodule=tcolorbox && evince TESTE.pdf ``` ### Build para sublime Grave um arquivo chamado `conTeXt.sublime-build` na pasta `~/.config/sublime-text/Packages/User` e utilize com `CRTL-SHIFT-B` para selecionar o _build_ na primeira vez. ```shell { "shell_cmd": "context $file_base_name.tex --purgeall && evince $file_base_name.pdf" } ou { "file_patterns": ["*.tex"], "working_dir": "$file_path", "shell_cmd": "context \"${file}\" --purgeall --autopdf" } ``` ### Documentação * Código dos pacotes: source.contextgarden.net ### Mostrando margens, linhas, guias, caixas e medidas `\showboxes` Serve para mostrar todas as linhas da diagramação e medidas: ![](https://i.imgur.com/Es7yS6A.png) `\showsetups` Para mostrar somente as medidas. `\showframes` Para mostrar somente as linhas. `\showlayout` Mostra as linhas e medidas juntos: ![](https://i.imgur.com/8OB1CBS.png) ### Ajustes `\adaptlayout[Pages] [Options]` * height: Permite indicar, em forma de dimensão, a altura que deve ter a página em questão. Podemos indicar uma altura absoluta (por exemplo, “19cm”) ou uma altura relativa (por exemplo, “+1cm”, “-0,7cm”). * lines: Podemos incluir o número de linhas para adicionar ou subtrair. Para adicionar linhas, o valor é precedido por um + e para subtrair linhas, pelo sinal − (não apenas um hífen). ### Como listar opções e variáveis válidas de um comando ```latex! \usemodule [setups] % \setuphead [..,..=..,..] \showrootvalues [tooltip] % \setuphead [chapter] [..,..=..,..] \showinstancevalues [head] [chapter] ``` ![](https://i.imgur.com/zZ7APzn.png) ## Identificações & quebras ### 007 Espaços e quebras `\blank` wiki.contextgarden.net/Command/blank ### Identificando a fonte principal wiki.contextgarden.net/Command/showbodyfont ```latex! \usemodule [setups] \showbodyfont ... \showbodyfont[times,12pt] ``` ![](https://i.imgur.com/MLbQshm.png) ## Cores wiki.contextgarden.net/Color ### Definindo e mostrando cores ```latex! % Definindo em RGB \definecolor[green][r=0.5,g=1,b=0.5] ``` ```latex! % Defininco cores \definecolorgroup [orange] [1.00:0.95:0.90, 1.00:0.80:0.30, 0.80:0.50:0.00] %Mostrar todas as cores definidas \showcolor % Escolhendo cores \color[orange]{bla} % cor pré-definida \color[orange:1]{bla} % nova cor (número um) \color[orange:2]{bla} \color[orange:3]{bla} ``` ![](https://i.imgur.com/Y9qQXXf.png) ```latex! % Ativando as cores \startcolor[defined-color] ... text ... \stopcolor \color[defined-color]{ ... text ... } ``` ### Background ```latex % Trocando a cor do fundo \setupbackgrounds [page] [background=color,backgroundcolor=blue] \setupcolors[textcolor=white] ``` ### Avançado #### Cores pré-definidas wiki.contextgarden.net/Color#Pre-defined_colors ```latex \showcolor[crayola] % crayola, ral, solarized, svg, x11, xwi, ema ``` #### Paleta de cores ```latex \usecolors[dem] \showpalet [beta] [vertical,name,number] \showpalet [gamma] [vertical,name] \showpalet [delta] [vertical,name] \showpalet [epsilon] [vertical,name] \showpalet [zeta] [vertical,name,value] ``` ``` # x-setup \showpalet [...] [...,...] >horizontal|vertical, number, value, name ``` ![](https://i.imgur.com/8ETpuwU.png) ## 001 Tamanho, lingua, hifenização ### Tamanho ```latex \setuppapersize[A5][A4] ``` ### Identação ```latex \setupindenting[yes,next,4ex] ``` ### Formato da página ```latex \setuplayout[ backspace=2cm, topspace=2cm, header=2cm, footer=2cm, location=middle, marking=on, cutspace=1cm, cutmark=yes, bleedoffset=1cm, trimoffset=1cm ] ``` ## 002 Fontes ![](https://hackmd.io/_uploads/rJmDn1Uth.png) ### Itálicos, negritos etc. \tf Regular, \it Italic, \bf Bold and \bi BoldItalic. ### Definindo uma fonte wiki.contextgarden.net/Command/definefontfamily ```latex= \definefontfamily [mainface] [rm] [TeX Gyre Pagella] \definefontfamily [mainface] [ss] [TeX Gyre Heros] \definefontfamily [mainface] [mm] [TeX Gyre Pagella Math] \definefontfamily[changedstyles][rm][TeX Gyre Pagella][tf=style:italic,it=style:bold,bf=style:bolditalic,bi=style:regular] \definefontfamily[changedfiles][rm][TeX Gyre Pagella][it=file:texgyreherositalic,bi=file:texgyrecursorbolditalic] \definefontfamily[changedfeatures][rm][TeX Gyre Pagella][tf=features:smallcaps,bf=features:none] \setupbodyfont[mainface] ... \rm Serif: TeX Gyre Pagella \ss Sans: TeX Gyre Heros ``` ### Mostrar características de uma fonte ```latex \usemodule[fonts-variable] \starttext \showfontvariations[font=file:AdobeDevanagari-Regular.otf] \stoptext ``` ## 003 Sumário wiki.contextgarden.net/Table_of_Contents ```latex \completecontent % with title \placecontent % without title ``` :::success Para colocar tudo no índice independente do lugar em que o Sumário aparece: `\completecontent[criterium=all]` ::: Título do sumário ```latex \setupheadtext[content=Sumário] ``` Tirando números e das partes ```latex \setuphead [subsection] [number=yes] \setuphead [subsection] [number=no] \setuphead [subsubsection] [number=no] ``` Diagramação (formatos, disposição, fontes) ```latex \setuplist [chapter] [width=2em, style=bold, style=\bfc, headnumber=no, % Tira número da partes pagenumber=no, % Tira número das páginas ] \setuplist [section] [width=2em] \setuplist [subsection] [width=3em] ``` O que entra no sumário ```latex \setupcombinedlist[content] [list={chapter,section}, alternative=c] %dots ``` Entrelinhas ```latex \setupinterlinespace[15pt] ``` ### Avançado 003b Para colocar os números na frente dos títulos das partes ```latex= \define[3]\SectionListEntry {\par \leftaligned\bgroup \hbox to 0em{\color[red]{\bfc #3}}% %\hskip 0em \vtop{\hsize\dimexpr\textwidth-3em\relax#2} \egroup \par} \setuplist[{chapter,section,subsection}][alternative=command,command=\SectionListEntry] ``` 003e Acrescentar um label antes do título do capítulo (Ex: ">>Capítulo<< 1: Nome do cap.") ```latex \def\DotAfterNumber#1{\doiftext{#1}{Capítulo #1}} \setuphead [chapter] [number=yes,numbercommand=\DotAfterNumber] ``` 003f Colocar duas variáveis "autor" e "subtítulo" nas partes. ```latex= \setupheadtext[content=Sumário] \define[1]\SectionTocEntry{% \structurelistuservariable{author}\crlf% #1\crlf% title \structurelistuservariable{subtitle}}% \setuplist[section][ textcommand=\SectionTocEntry,] \starttext \completecontent \startsection[title={Whatever}][author={A. Uthor},subtitle={I’d like to say}] \input knuth \stopsection \stoptext ``` ## 004 Poemas wiki.contextgarden.net/Verse :::warning Não há nada muito consistente. Precisamos resolver ainda (1) quebras de versos (asteriscos no pacote `verse.sty` em LaTeX), (2) equilíbrio (algo como `gmverses.sty` no LaTeX), (3) quebras em versos longos. ::: ```latex \setuplines[indenting={yes, small, even}] \startlines But chiefly, when the shadowy moon had shed O'er woods and waters her mysterious hue, Their passive hearts and vacant fancies fed With thoughts and aspirations strange and new, Till their brute souls with inward working bred Dark hints that in the depths of instinct grew Subjection not from Locke's associations, Nor David Hartley's doctrine of vibrations. \stoplines \definelines[EdLabVersos][][indenting={no, small, even}] %align=middle \startEdLabVersos But chiefly, when the shadowy moon had shed O'er woods and waters her mysterious hue, Their passive hearts and vacant fancies fed With thoughts and aspirations strange and new, Till their brute souls with inward working bred Dark hints that in the depths of instinct grew Subjection not from Locke's associations, Nor David Hartley's doctrine of vibrations. \stopEdLabVersos And now we can typeset a nursery rhyme with its own formatting: \definelines[nurseryRhyme][][indenting={yes, big, even}] \startnurseryRhyme Hey diddle diddle, the cat played the fiddle, The cow jumped over the moon. The little dog laughed to see such craft, And the dish ran away with the spoon. \stopnurseryRhyme ``` ## 005 `itemize` e `enumerate` wiki.contextgarden.net/Enumerations ## 006 Footnotes, endnotes wiki.contextgarden.net/Footnotes ### Tirar linha ```latex \setupfootnotes[rule=off] ``` ### Entrelinha das notas ```latex \startsetups[footnote:interlinespace] \setupinterlinespace[line=2ex] % Entrelinhas da nota \stopsetups \setupnote[footnote][setups=footnote:interlinespace] ``` ### Numeração especial ```latex \setupnotation[footnote][way=bypage,numberconversion=set 3] ``` OBS: `set 3` para estrelas e `set 2` para adagas. ### Notas corridas (para livros muito grandes) ```latex \setupnote [footnote] [paragraph=yes] \setupnotation [footnote] [alternative=serried, width=broad, distance=.5em, display=no] ``` ### Nota em tabelas ```latex \section{First} Way to \ConTeXt\footnote{First footnote.} is painful. \section{Second} But \ConTeXt\ is amazing.\footnote{Second footnote} \placetable {Complex Table\footnote{A table head footnote.}} {\startlocalfootnotes \placelegend {\starttable[|l|l|] \HL \NC First Column \NC Second Column \NC \FR \HL \NC East\footnote{Footnote inside graphic.} \NC North \NC \FR \NC West \NC South \NC \LR \HL \stoptable} {\placelocalfootnotes} \stoplocalfootnotes} ``` ## 00X Divisões Existem comandos para partes numeradas e partes não numeradas. ``` Numbered Unnumbered ------------------------------------ \part \chapter \title \section \subject \subsection \subsubject \subsubsection \subsubsubject ``` ## 012 Marca de cortes ```latex \setuplayout[ backspace=2cm, topspace=2cm, width=10cm, % tamanho do livro height=21cm, % tamanho do livro header=2cm, footer=2cm, location=middle, marking=on, cutspace=2cm, cutmark=yes, grid=yes, bleedoffset=1cm, trimoffset=1cm ] \showframe % mostrar o trimframe ``` ## 014 Referências ### Remissivos https://wiki.contextgarden.net/Registers ```latex \usemodule[register] \setupcombinedlist[content][ alternative=c, before={\blank[big]}, after={\blank[big]}, style=bold, pagestyle=] \starttext \setupcombinedlist[content][ alternative=c, before={\blank[big]}, after={\blank[big]}, style=bold, pagestyle=] \starttext \index{banana} \index{maçã} \index{banana!madura} \index{banana!verde} \index{maçã!vermelha} \placeindex \stoptext ``` ## 017 Images ### Caption wiki.contextgarden.net/Command/setupcaptions ```latex \setuppapersize[A5][A4] \setupexternalfigures[location=default] \setupcaptions[location={right,low},prefix=yes, style={\tfx\setupinterlinespace[line=10pt]}, headstyle=\rm, numberstopper={:}, ] ... \placefigure {Oh caption, my caption!\crlf (Apologies to Walt Whitman)} {\externalfigure[cow][width=2cm]} ``` ## Grid ### Mostrar todas as distâncias ```latex \setuppapersize[A6,landscape] \starttext \showallmakeup \input knuth \stoptext ```